2020-04-15 23:21:48

by 王文虎

[permalink] [raw]
Subject: [PATCH 0/5] drivers: uio: new driver uio_fsl_85xx_cache_sram

This series add a new uio driver for freescale 85xx platforms to
access the Cache-Sram form user level. This is extremely helpful
for the user-space applications that require high performance memory
accesses.

It fixes the compile errors and warning of the hardware level drivers
and implements the uio driver in uio_fsl_85xx_cache_sram.c.

Wang Wenhu (5):
powerpc: 85xx: make FSL_85XX_CACHE_SRAM configurable
powerpc: sysdev: fix compile error for fsl_85xx_cache_sram
powerpc: sysdev: fix compile warning for fsl_85xx_cache_sram
powerpc: sysdev: fix compile error for fsl_85xx_l2ctlr
drivers: uio: new driver for fsl_85xx_cache_sram

arch/powerpc/platforms/85xx/Kconfig | 2 +-
arch/powerpc/platforms/Kconfig.cputype | 5 +-
arch/powerpc/sysdev/fsl_85xx_cache_sram.c | 3 +-
arch/powerpc/sysdev/fsl_85xx_l2ctlr.c | 1 +
drivers/uio/Kconfig | 8 +
drivers/uio/Makefile | 1 +
drivers/uio/uio_fsl_85xx_cache_sram.c | 195 ++++++++++++++++++++++
7 files changed, 211 insertions(+), 4 deletions(-)
create mode 100644 drivers/uio/uio_fsl_85xx_cache_sram.c

--
2.17.1


2020-04-15 23:25:44

by 王文虎

[permalink] [raw]
Subject: [PATCH 4/5] powerpc: sysdev: fix compile error for fsl_85xx_l2ctlr

Include "linux/of_address.h" to fix the compile error for
mpc85xx_l2ctlr_of_probe() when compiling fsl_85xx_cache_sram.c.

CC arch/powerpc/sysdev/fsl_85xx_l2ctlr.o
arch/powerpc/sysdev/fsl_85xx_l2ctlr.c: In function ‘mpc85xx_l2ctlr_of_probe’:
arch/powerpc/sysdev/fsl_85xx_l2ctlr.c:90:11: error: implicit declaration of function ‘of_iomap’; did you mean ‘pci_iomap’? [-Werror=implicit-function-declaration]
l2ctlr = of_iomap(dev->dev.of_node, 0);
^~~~~~~~
pci_iomap
arch/powerpc/sysdev/fsl_85xx_l2ctlr.c:90:9: error: assignment makes pointer from integer without a cast [-Werror=int-conversion]
l2ctlr = of_iomap(dev->dev.of_node, 0);
^
cc1: all warnings being treated as errors
scripts/Makefile.build:267: recipe for target 'arch/powerpc/sysdev/fsl_85xx_l2ctlr.o' failed
make[2]: *** [arch/powerpc/sysdev/fsl_85xx_l2ctlr.o] Error 1

Cc: Greg Kroah-Hartman <[email protected]>
Cc: Christophe Leroy <[email protected]>
Cc: Scott Wood <[email protected]>
Cc: Michael Ellerman <[email protected]>
Cc: [email protected]
Fixes: 6db92cc9d07d ("powerpc/85xx: add cache-sram support")
Signed-off-by: Wang Wenhu <[email protected]>
---
arch/powerpc/sysdev/fsl_85xx_l2ctlr.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/arch/powerpc/sysdev/fsl_85xx_l2ctlr.c b/arch/powerpc/sysdev/fsl_85xx_l2ctlr.c
index 2d0af0c517bb..7533572492f0 100644
--- a/arch/powerpc/sysdev/fsl_85xx_l2ctlr.c
+++ b/arch/powerpc/sysdev/fsl_85xx_l2ctlr.c
@@ -10,6 +10,7 @@
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/of_platform.h>
+#include <linux/of_address.h>
#include <asm/io.h>

#include "fsl_85xx_cache_ctlr.h"
--
2.17.1

2020-04-15 23:48:59

by 王文虎

[permalink] [raw]
Subject: [PATCH 3/5] powerpc: sysdev: fix compile warning for fsl_85xx_cache_sram

Function instantiate_cache_sram should not be linked into the init
section for its caller mpc85xx_l2ctlr_of_probe is none-__init.

Cc: Greg Kroah-Hartman <[email protected]>
Cc: Christophe Leroy <[email protected]>
Cc: Scott Wood <[email protected]>
Cc: Michael Ellerman <[email protected]>
Cc: [email protected]
Fixes: 6db92cc9d07d ("powerpc/85xx: add cache-sram support")
Signed-off-by: Wang Wenhu <[email protected]>

Warning information:
MODPOST vmlinux.o
WARNING: modpost: vmlinux.o(.text+0x1e540): Section mismatch in reference from the function mpc85xx_l2ctlr_of_probe() to the function .init.text:instantiate_cache_sram()
The function mpc85xx_l2ctlr_of_probe() references
the function __init instantiate_cache_sram().
This is often because mpc85xx_l2ctlr_of_probe lacks a __init
annotation or the annotation of instantiate_cache_sram is wrong.
---
arch/powerpc/sysdev/fsl_85xx_cache_sram.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/sysdev/fsl_85xx_cache_sram.c b/arch/powerpc/sysdev/fsl_85xx_cache_sram.c
index be3aef4229d7..3de5ac8382c0 100644
--- a/arch/powerpc/sysdev/fsl_85xx_cache_sram.c
+++ b/arch/powerpc/sysdev/fsl_85xx_cache_sram.c
@@ -68,7 +68,7 @@ void mpc85xx_cache_sram_free(void *ptr)
}
EXPORT_SYMBOL(mpc85xx_cache_sram_free);

-int __init instantiate_cache_sram(struct platform_device *dev,
+int instantiate_cache_sram(struct platform_device *dev,
struct sram_parameters sram_params)
{
int ret = 0;
--
2.17.1

2020-04-15 23:49:15

by 王文虎

[permalink] [raw]
Subject: [PATCH 5/5] drivers: uio: new driver for fsl_85xx_cache_sram

A driver for freescale 85xx platforms to access the Cache-Sram form
user level. This is extremely helpful for some user-space applications
that require high performance memory accesses.

Cc: Greg Kroah-Hartman <[email protected]>
Cc: Christophe Leroy <[email protected]>
Cc: Scott Wood <[email protected]>
Cc: Michael Ellerman <[email protected]>
Cc: [email protected]
Signed-off-by: Wang Wenhu <[email protected]>
---
drivers/uio/Kconfig | 8 ++
drivers/uio/Makefile | 1 +
drivers/uio/uio_fsl_85xx_cache_sram.c | 195 ++++++++++++++++++++++++++
3 files changed, 204 insertions(+)
create mode 100644 drivers/uio/uio_fsl_85xx_cache_sram.c

diff --git a/drivers/uio/Kconfig b/drivers/uio/Kconfig
index 202ee81cfc2b..afd38ec13de0 100644
--- a/drivers/uio/Kconfig
+++ b/drivers/uio/Kconfig
@@ -105,6 +105,14 @@ config UIO_NETX
To compile this driver as a module, choose M here; the module
will be called uio_netx.

+config UIO_FSL_85XX_CACHE_SRAM
+ tristate "Freescale 85xx Cache-Sram driver"
+ depends on FSL_85XX_CACHE_SRAM
+ help
+ Generic driver for accessing the Cache-Sram form user level. This
+ is extremely helpful for some user-space applications that require
+ high performance memory accesses.
+
config UIO_FSL_ELBC_GPCM
tristate "eLBC/GPCM driver"
depends on FSL_LBC
diff --git a/drivers/uio/Makefile b/drivers/uio/Makefile
index c285dd2a4539..be2056cffc21 100644
--- a/drivers/uio/Makefile
+++ b/drivers/uio/Makefile
@@ -10,4 +10,5 @@ obj-$(CONFIG_UIO_NETX) += uio_netx.o
obj-$(CONFIG_UIO_PRUSS) += uio_pruss.o
obj-$(CONFIG_UIO_MF624) += uio_mf624.o
obj-$(CONFIG_UIO_FSL_ELBC_GPCM) += uio_fsl_elbc_gpcm.o
+obj-$(CONFIG_UIO_FSL_85XX_CACHE_SRAM) += uio_fsl_85xx_cache_sram.o
obj-$(CONFIG_UIO_HV_GENERIC) += uio_hv_generic.o
diff --git a/drivers/uio/uio_fsl_85xx_cache_sram.c b/drivers/uio/uio_fsl_85xx_cache_sram.c
new file mode 100644
index 000000000000..e11202dd5b93
--- /dev/null
+++ b/drivers/uio/uio_fsl_85xx_cache_sram.c
@@ -0,0 +1,195 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2020 Vivo Communication Technology Co. Ltd.
+ * Copyright (C) 2020 Wang Wenhu <[email protected]>
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published
+ * by the Free Software Foundation.
+ */
+
+#include <linux/platform_device.h>
+#include <linux/uio_driver.h>
+#include <linux/stringify.h>
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <asm/fsl_85xx_cache_sram.h>
+
+#define DRIVER_VERSION "0.1.0"
+#define DRIVER_NAME "uio_fsl_85xx_cache_sram"
+#define UIO_NAME "uio_cache_sram"
+
+static const struct of_device_id uio_mpc85xx_l2ctlr_of_match[] = {
+ { .compatible = "uio,fsl,p2020-l2-cache-controller", },
+ { .compatible = "uio,fsl,p2010-l2-cache-controller", },
+ { .compatible = "uio,fsl,p1020-l2-cache-controller", },
+ { .compatible = "uio,fsl,p1011-l2-cache-controller", },
+ { .compatible = "uio,fsl,p1013-l2-cache-controller", },
+ { .compatible = "uio,fsl,p1022-l2-cache-controller", },
+ { .compatible = "uio,fsl,mpc8548-l2-cache-controller", },
+ { .compatible = "uio,fsl,mpc8544-l2-cache-controller", },
+ { .compatible = "uio,fsl,mpc8572-l2-cache-controller", },
+ { .compatible = "uio,fsl,mpc8536-l2-cache-controller", },
+ { .compatible = "uio,fsl,p1021-l2-cache-controller", },
+ { .compatible = "uio,fsl,p1012-l2-cache-controller", },
+ { .compatible = "uio,fsl,p1025-l2-cache-controller", },
+ { .compatible = "uio,fsl,p1016-l2-cache-controller", },
+ { .compatible = "uio,fsl,p1024-l2-cache-controller", },
+ { .compatible = "uio,fsl,p1015-l2-cache-controller", },
+ { .compatible = "uio,fsl,p1010-l2-cache-controller", },
+ { .compatible = "uio,fsl,bsc9131-l2-cache-controller", },
+ {},
+};
+
+static void uio_info_free_internal(struct uio_info *info)
+{
+ struct uio_mem *uiomem = &info->mem[0];
+
+ while (uiomem < &info->mem[MAX_UIO_MAPS]) {
+ if (uiomem->size) {
+ mpc85xx_cache_sram_free(uiomem->internal_addr);
+ kfree(uiomem->name);
+ }
+ uiomem++;
+ }
+}
+
+static int uio_fsl_85xx_cache_sram_probe(struct platform_device *pdev)
+{
+ struct device_node *parent = pdev->dev.of_node;
+ struct device_node *node = NULL;
+ struct uio_info *info;
+ struct uio_mem *uiomem;
+ const char *dt_name;
+ u32 mem_size;
+ u32 align;
+ void *virt;
+ phys_addr_t phys;
+ int ret = -ENODEV;
+
+ /* alloc uio_info for one device */
+ info = kzalloc(sizeof(*info), GFP_KERNEL);
+ if (!info) {
+ dev_err(&pdev->dev, "kzalloc uio_info failed\n");
+ ret = -ENOMEM;
+ goto err_out;
+ }
+
+ /* get optional uio name */
+ if (of_property_read_string(parent, "uio_name", &dt_name))
+ dt_name = UIO_NAME;
+
+ info->name = kstrdup(dt_name, GFP_KERNEL);
+ if (!info->name) {
+ dev_err(&pdev->dev, "error kstrdup uio_name\n");
+ ret = -ENOMEM;
+ goto err_info_free;
+ }
+
+ uiomem = &info->mem[0];
+ for_each_child_of_node(parent, node) {
+ if (!node) {
+ dev_err(&pdev->dev, "device's OF-node is NULL\n");
+ continue;
+ }
+
+ ret = of_property_read_u32(node, "cache-mem-size", &mem_size);
+ if (ret) {
+ dev_err(&pdev->dev, "missing cache-mem-size value\n");
+ continue;
+ }
+
+ if (mem_size == 0) {
+ dev_err(&pdev->dev, "cache-mem-size should not be 0\n");
+ continue;
+ }
+
+ align = 2;
+ while (align < mem_size)
+ align *= 2;
+ virt = mpc85xx_cache_sram_alloc(mem_size, &phys, align);
+ if (!virt) {
+ dev_err(&pdev->dev, "allocate 0x%x cache-mem failed\n", mem_size);
+ continue;
+ }
+
+ uiomem->memtype = UIO_MEM_PHYS;
+ uiomem->addr = phys;
+ uiomem->size = mem_size;
+ uiomem->name = kstrdup(node->name, GFP_KERNEL);;
+ uiomem->internal_addr = virt;
+ ++uiomem;
+
+ if (uiomem >= &info->mem[MAX_UIO_MAPS]) {
+ dev_warn(&pdev->dev, "device has more than "
+ __stringify(MAX_UIO_MAPS)
+ " I/O memory resources.\n");
+ break;
+ }
+ }
+
+ while (uiomem < &info->mem[MAX_UIO_MAPS]) {
+ uiomem->size = 0;
+ ++uiomem;
+ }
+
+ if (info->mem[0].size == 0) {
+ dev_err(&pdev->dev, "error no valid uio-map configured\n");
+ ret = -EINVAL;
+ goto err_name_free;
+ }
+
+ info->version = DRIVER_VERSION;
+
+ /* register UIO device */
+ if (uio_register_device(&pdev->dev, info)) {
+ dev_err(&pdev->dev, "UIO registration failed\n");
+ ret = -ENODEV;
+ goto err_unregister;
+ }
+
+ platform_set_drvdata(pdev, info);
+
+ return 0;
+err_unregister:
+ uio_info_free_internal(info);
+err_name_free:
+ kfree(info->name);
+err_info_free:
+ kfree(info);
+err_out:
+ return ret;
+}
+
+static int uio_fsl_85xx_cache_sram_remove(struct platform_device *pdev)
+{
+ struct uio_info *info = platform_get_drvdata(pdev);
+
+ uio_unregister_device(info);
+
+ uio_info_free_internal(info);
+
+ kfree(info->name);
+
+ kfree(info);
+
+ return 0;
+}
+
+static struct platform_driver uio_fsl_85xx_cache_sram = {
+ .probe = uio_fsl_85xx_cache_sram_probe,
+ .remove = uio_fsl_85xx_cache_sram_remove,
+ .driver = {
+ .name = DRIVER_NAME,
+ .owner = THIS_MODULE,
+ .of_match_table = uio_mpc85xx_l2ctlr_of_match,
+ },
+};
+
+module_platform_driver(uio_fsl_85xx_cache_sram);
+
+MODULE_AUTHOR("Wang Wenhu <[email protected]>");
+MODULE_DESCRIPTION("Freescale MPC85xx Cache-Sram UIO Platform Driver");
+MODULE_ALIAS("platform:" DRIVER_NAME);
+MODULE_LICENSE("GPL v2");
--
2.17.1

2020-04-15 23:49:19

by 王文虎

[permalink] [raw]
Subject: [PATCH 2/5] powerpc: sysdev: fix compile error for fsl_85xx_cache_sram

Include linux/io.h into fsl_85xx_cache_sram.c to fix the
implicit-declaration compile error when building Cache-Sram.

arch/powerpc/sysdev/fsl_85xx_cache_sram.c: In function ‘instantiate_cache_sram’:
arch/powerpc/sysdev/fsl_85xx_cache_sram.c:97:26: error: implicit declaration of function ‘ioremap_coherent’; did you mean ‘bitmap_complement’? [-Werror=implicit-function-declaration]
cache_sram->base_virt = ioremap_coherent(cache_sram->base_phys,
^~~~~~~~~~~~~~~~
bitmap_complement
arch/powerpc/sysdev/fsl_85xx_cache_sram.c:97:24: error: assignment makes pointer from integer without a cast [-Werror=int-conversion]
cache_sram->base_virt = ioremap_coherent(cache_sram->base_phys,
^
arch/powerpc/sysdev/fsl_85xx_cache_sram.c:123:2: error: implicit declaration of function ‘iounmap’; did you mean ‘roundup’? [-Werror=implicit-function-declaration]
iounmap(cache_sram->base_virt);
^~~~~~~
roundup
cc1: all warnings being treated as errors

Cc: Greg Kroah-Hartman <[email protected]>
Cc: Christophe Leroy <[email protected]>
Cc: Scott Wood <[email protected]>
Cc: Michael Ellerman <[email protected]>
Cc: [email protected]
Fixes: 6db92cc9d07d ("powerpc/85xx: add cache-sram support")
Signed-off-by: Wang Wenhu <[email protected]>
---
arch/powerpc/sysdev/fsl_85xx_cache_sram.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/arch/powerpc/sysdev/fsl_85xx_cache_sram.c b/arch/powerpc/sysdev/fsl_85xx_cache_sram.c
index f6c665dac725..be3aef4229d7 100644
--- a/arch/powerpc/sysdev/fsl_85xx_cache_sram.c
+++ b/arch/powerpc/sysdev/fsl_85xx_cache_sram.c
@@ -17,6 +17,7 @@
#include <linux/of_platform.h>
#include <asm/pgtable.h>
#include <asm/fsl_85xx_cache_sram.h>
+#include <linux/io.h>

#include "fsl_85xx_cache_ctlr.h"

--
2.17.1

2020-04-15 23:50:27

by 王文虎

[permalink] [raw]
Subject: [PATCH 1/5] powerpc: 85xx: make FSL_85XX_CACHE_SRAM configurable

Enable FSL_85XX_CACHE_SRAM selection. On e500 platforms, the cache
could be configured and used as a piece of SRAM which is hignly
friendly for some user level application performances.

Cc: Greg Kroah-Hartman <[email protected]>
Cc: Christophe Leroy <[email protected]>
Cc: Scott Wood <[email protected]>
Cc: Michael Ellerman <[email protected]>
Cc: [email protected]
Signed-off-by: Wang Wenhu <[email protected]>
---
arch/powerpc/platforms/85xx/Kconfig | 2 +-
arch/powerpc/platforms/Kconfig.cputype | 5 +++--
2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/platforms/85xx/Kconfig b/arch/powerpc/platforms/85xx/Kconfig
index fa3d29dcb57e..6debb4f1b9cc 100644
--- a/arch/powerpc/platforms/85xx/Kconfig
+++ b/arch/powerpc/platforms/85xx/Kconfig
@@ -17,7 +17,7 @@ if FSL_SOC_BOOKE
if PPC32

config FSL_85XX_CACHE_SRAM
- bool
+ bool "Freescale 85xx Cache-Sram"
select PPC_LIB_RHEAP
help
When selected, this option enables cache-sram support
diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype
index 0c3c1902135c..1921e9a573e8 100644
--- a/arch/powerpc/platforms/Kconfig.cputype
+++ b/arch/powerpc/platforms/Kconfig.cputype
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: GPL-2.0
config PPC32
- bool
+ bool "32-bit kernel"
default y if !PPC64
select KASAN_VMALLOC if KASAN && MODULES

@@ -15,6 +15,7 @@ config PPC_BOOK3S_32
bool

menu "Processor support"
+
choice
prompt "Processor Type"
depends on PPC32
@@ -211,9 +212,9 @@ config PPC_BOOK3E
depends on PPC_BOOK3E_64

config E500
+ bool "e500 Support"
select FSL_EMB_PERFMON
select PPC_FSL_BOOK3E
- bool

config PPC_E500MC
bool "e500mc Support"
--
2.17.1

2020-04-15 23:56:39

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 5/5] drivers: uio: new driver for fsl_85xx_cache_sram

On Wed, Apr 15, 2020 at 05:33:46AM -0700, Wang Wenhu wrote:
> A driver for freescale 85xx platforms to access the Cache-Sram form
> user level. This is extremely helpful for some user-space applications
> that require high performance memory accesses.
>
> Cc: Greg Kroah-Hartman <[email protected]>
> Cc: Christophe Leroy <[email protected]>
> Cc: Scott Wood <[email protected]>
> Cc: Michael Ellerman <[email protected]>
> Cc: [email protected]
> Signed-off-by: Wang Wenhu <[email protected]>
> ---
> drivers/uio/Kconfig | 8 ++
> drivers/uio/Makefile | 1 +
> drivers/uio/uio_fsl_85xx_cache_sram.c | 195 ++++++++++++++++++++++++++
> 3 files changed, 204 insertions(+)
> create mode 100644 drivers/uio/uio_fsl_85xx_cache_sram.c
>
> diff --git a/drivers/uio/Kconfig b/drivers/uio/Kconfig
> index 202ee81cfc2b..afd38ec13de0 100644
> --- a/drivers/uio/Kconfig
> +++ b/drivers/uio/Kconfig
> @@ -105,6 +105,14 @@ config UIO_NETX
> To compile this driver as a module, choose M here; the module
> will be called uio_netx.
>
> +config UIO_FSL_85XX_CACHE_SRAM
> + tristate "Freescale 85xx Cache-Sram driver"
> + depends on FSL_85XX_CACHE_SRAM
> + help
> + Generic driver for accessing the Cache-Sram form user level. This
> + is extremely helpful for some user-space applications that require
> + high performance memory accesses.
> +
> config UIO_FSL_ELBC_GPCM
> tristate "eLBC/GPCM driver"
> depends on FSL_LBC
> diff --git a/drivers/uio/Makefile b/drivers/uio/Makefile
> index c285dd2a4539..be2056cffc21 100644
> --- a/drivers/uio/Makefile
> +++ b/drivers/uio/Makefile
> @@ -10,4 +10,5 @@ obj-$(CONFIG_UIO_NETX) += uio_netx.o
> obj-$(CONFIG_UIO_PRUSS) += uio_pruss.o
> obj-$(CONFIG_UIO_MF624) += uio_mf624.o
> obj-$(CONFIG_UIO_FSL_ELBC_GPCM) += uio_fsl_elbc_gpcm.o
> +obj-$(CONFIG_UIO_FSL_85XX_CACHE_SRAM) += uio_fsl_85xx_cache_sram.o
> obj-$(CONFIG_UIO_HV_GENERIC) += uio_hv_generic.o
> diff --git a/drivers/uio/uio_fsl_85xx_cache_sram.c b/drivers/uio/uio_fsl_85xx_cache_sram.c
> new file mode 100644
> index 000000000000..e11202dd5b93
> --- /dev/null
> +++ b/drivers/uio/uio_fsl_85xx_cache_sram.c
> @@ -0,0 +1,195 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * Copyright (C) 2020 Vivo Communication Technology Co. Ltd.
> + * Copyright (C) 2020 Wang Wenhu <[email protected]>
> + * All rights reserved.
> + *
> + * This program is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU General Public License version 2 as published
> + * by the Free Software Foundation.

Nit, you don't need this sentance anymore now that you have the SPDX
line above

> + */
> +
> +#include <linux/platform_device.h>
> +#include <linux/uio_driver.h>
> +#include <linux/stringify.h>
> +#include <linux/module.h>
> +#include <linux/kernel.h>
> +#include <asm/fsl_85xx_cache_sram.h>
> +
> +#define DRIVER_VERSION "0.1.0"

Don't do DRIVER_VERSIONs, they never work once the code is in the kernel
tree.

> +#define DRIVER_NAME "uio_fsl_85xx_cache_sram"

KBUILD_MODNAME?

> +#define UIO_NAME "uio_cache_sram"
> +
> +static const struct of_device_id uio_mpc85xx_l2ctlr_of_match[] = {
> + { .compatible = "uio,fsl,p2020-l2-cache-controller", },
> + { .compatible = "uio,fsl,p2010-l2-cache-controller", },
> + { .compatible = "uio,fsl,p1020-l2-cache-controller", },
> + { .compatible = "uio,fsl,p1011-l2-cache-controller", },
> + { .compatible = "uio,fsl,p1013-l2-cache-controller", },
> + { .compatible = "uio,fsl,p1022-l2-cache-controller", },
> + { .compatible = "uio,fsl,mpc8548-l2-cache-controller", },
> + { .compatible = "uio,fsl,mpc8544-l2-cache-controller", },
> + { .compatible = "uio,fsl,mpc8572-l2-cache-controller", },
> + { .compatible = "uio,fsl,mpc8536-l2-cache-controller", },
> + { .compatible = "uio,fsl,p1021-l2-cache-controller", },
> + { .compatible = "uio,fsl,p1012-l2-cache-controller", },
> + { .compatible = "uio,fsl,p1025-l2-cache-controller", },
> + { .compatible = "uio,fsl,p1016-l2-cache-controller", },
> + { .compatible = "uio,fsl,p1024-l2-cache-controller", },
> + { .compatible = "uio,fsl,p1015-l2-cache-controller", },
> + { .compatible = "uio,fsl,p1010-l2-cache-controller", },
> + { .compatible = "uio,fsl,bsc9131-l2-cache-controller", },
> + {},
> +};
> +
> +static void uio_info_free_internal(struct uio_info *info)
> +{
> + struct uio_mem *uiomem = &info->mem[0];
> +
> + while (uiomem < &info->mem[MAX_UIO_MAPS]) {
> + if (uiomem->size) {
> + mpc85xx_cache_sram_free(uiomem->internal_addr);
> + kfree(uiomem->name);
> + }
> + uiomem++;
> + }
> +}
> +
> +static int uio_fsl_85xx_cache_sram_probe(struct platform_device *pdev)
> +{
> + struct device_node *parent = pdev->dev.of_node;
> + struct device_node *node = NULL;
> + struct uio_info *info;
> + struct uio_mem *uiomem;
> + const char *dt_name;
> + u32 mem_size;
> + u32 align;
> + void *virt;
> + phys_addr_t phys;
> + int ret = -ENODEV;
> +
> + /* alloc uio_info for one device */
> + info = kzalloc(sizeof(*info), GFP_KERNEL);
> + if (!info) {
> + dev_err(&pdev->dev, "kzalloc uio_info failed\n");

kzalloc already says this.

> + ret = -ENOMEM;
> + goto err_out;
> + }
> +
> + /* get optional uio name */
> + if (of_property_read_string(parent, "uio_name", &dt_name))
> + dt_name = UIO_NAME;
> +
> + info->name = kstrdup(dt_name, GFP_KERNEL);
> + if (!info->name) {
> + dev_err(&pdev->dev, "error kstrdup uio_name\n");

kstrdup should have given you an error string already, right?

> + ret = -ENOMEM;
> + goto err_info_free;
> + }
> +
> + uiomem = &info->mem[0];
> + for_each_child_of_node(parent, node) {
> + if (!node) {
> + dev_err(&pdev->dev, "device's OF-node is NULL\n");

How can this happen?

> + continue;

Why not error out?

> + }
> +
> + ret = of_property_read_u32(node, "cache-mem-size", &mem_size);
> + if (ret) {
> + dev_err(&pdev->dev, "missing cache-mem-size value\n");

You don't exit?

> + continue;
> + }
> +
> + if (mem_size == 0) {
> + dev_err(&pdev->dev, "cache-mem-size should not be 0\n");

Again, you don't exit?

> + continue;
> + }
> +
> + align = 2;
> + while (align < mem_size)
> + align *= 2;
> + virt = mpc85xx_cache_sram_alloc(mem_size, &phys, align);
> + if (!virt) {
> + dev_err(&pdev->dev, "allocate 0x%x cache-mem failed\n", mem_size);

You don't exit?

> + continue;
> + }
> +
> + uiomem->memtype = UIO_MEM_PHYS;
> + uiomem->addr = phys;
> + uiomem->size = mem_size;
> + uiomem->name = kstrdup(node->name, GFP_KERNEL);;
> + uiomem->internal_addr = virt;
> + ++uiomem;
> +
> + if (uiomem >= &info->mem[MAX_UIO_MAPS]) {
> + dev_warn(&pdev->dev, "device has more than "
> + __stringify(MAX_UIO_MAPS)
> + " I/O memory resources.\n");

What can someone do with that?

thanks,

greg k-h

2020-04-16 00:09:23

by 王文虎

[permalink] [raw]
Subject: Re: [PATCH 5/5] drivers: uio: new driver for fsl_85xx_cache_sram>On Wed, Apr 15, 2020 at 05:33:46AM -0700, Wang Wenhu wrote:

Hi, Greg k-h!
Thank you for you fast reply. All the comments will
be addressed with v2 soon. Detailed explanations are
just below specific comment.

>> A driver for freescale 85xx platforms to access the Cache-Sram form
>> user level. This is extremely helpful for some user-space applications
>> that require high performance memory accesses.
>>
>> Cc: Greg Kroah-Hartman <[email protected]>
>> Cc: Christophe Leroy <[email protected]>
>> Cc: Scott Wood <[email protected]>
>> Cc: Michael Ellerman <[email protected]>
>> Cc: [email protected]
>> Signed-off-by: Wang Wenhu <[email protected]>
>> ---
>> drivers/uio/Kconfig | 8 ++
>> drivers/uio/Makefile | 1 +
>> drivers/uio/uio_fsl_85xx_cache_sram.c | 195 ++++++++++++++++++++++++++
>> 3 files changed, 204 insertions(+)
>> create mode 100644 drivers/uio/uio_fsl_85xx_cache_sram.c
>>
>> diff --git a/drivers/uio/Kconfig b/drivers/uio/Kconfig
>> index 202ee81cfc2b..afd38ec13de0 100644
>> --- a/drivers/uio/Kconfig
>> +++ b/drivers/uio/Kconfig
>> @@ -105,6 +105,14 @@ config UIO_NETX
>> To compile this driver as a module, choose M here; the module
>> will be called uio_netx.
>>
>> +config UIO_FSL_85XX_CACHE_SRAM
>> + tristate "Freescale 85xx Cache-Sram driver"
>> + depends on FSL_85XX_CACHE_SRAM
>> + help
>> + Generic driver for accessing the Cache-Sram form user level. This
>> + is extremely helpful for some user-space applications that require
>> + high performance memory accesses.
>> +
>> config UIO_FSL_ELBC_GPCM
>> tristate "eLBC/GPCM driver"
>> depends on FSL_LBC
>> diff --git a/drivers/uio/Makefile b/drivers/uio/Makefile
>> index c285dd2a4539..be2056cffc21 100644
>> --- a/drivers/uio/Makefile
>> +++ b/drivers/uio/Makefile
>> @@ -10,4 +10,5 @@ obj-$(CONFIG_UIO_NETX) += uio_netx.o
>> obj-$(CONFIG_UIO_PRUSS) += uio_pruss.o
>> obj-$(CONFIG_UIO_MF624) += uio_mf624.o
>> obj-$(CONFIG_UIO_FSL_ELBC_GPCM) += uio_fsl_elbc_gpcm.o
>> +obj-$(CONFIG_UIO_FSL_85XX_CACHE_SRAM) += uio_fsl_85xx_cache_sram.o
>> obj-$(CONFIG_UIO_HV_GENERIC) += uio_hv_generic.o
>> diff --git a/drivers/uio/uio_fsl_85xx_cache_sram.c b/drivers/uio/uio_fsl_85xx_cache_sram.c
>> new file mode 100644
>> index 000000000000..e11202dd5b93
>> --- /dev/null
>> +++ b/drivers/uio/uio_fsl_85xx_cache_sram.c
>> @@ -0,0 +1,195 @@
>> +// SPDX-License-Identifier: GPL-2.0
>> +/*
>> + * Copyright (C) 2020 Vivo Communication Technology Co. Ltd.
>> + * Copyright (C) 2020 Wang Wenhu <[email protected]>
>> + * All rights reserved.
>> + *
>> + * This program is free software; you can redistribute it and/or modify it
>> + * under the terms of the GNU General Public License version 2 as published
>> + * by the Free Software Foundation.
>
>Nit, you don't need this sentance anymore now that you have the SPDX
>line above
>
Got, I will delete it with v2.
>> + */
>> +
>> +#include <linux/platform_device.h>
>> +#include <linux/uio_driver.h>
>> +#include <linux/stringify.h>
>> +#include <linux/module.h>
>> +#include <linux/kernel.h>
>> +#include <asm/fsl_85xx_cache_sram.h>
>> +
>> +#define DRIVER_VERSION "0.1.0"
>
>Don't do DRIVER_VERSIONs, they never work once the code is in the kernel
>tree.
>
>> +#define DRIVER_NAME "uio_fsl_85xx_cache_sram"
>
>KBUILD_MODNAME?

Yes, and sorry for that I did not get what should have been done?

>
>> +#define UIO_NAME "uio_cache_sram"
>> +
>> +static const struct of_device_id uio_mpc85xx_l2ctlr_of_match[] = {
>> + { .compatible = "uio,fsl,p2020-l2-cache-controller", },
>> + { .compatible = "uio,fsl,p2010-l2-cache-controller", },
>> + { .compatible = "uio,fsl,p1020-l2-cache-controller", },
>> + { .compatible = "uio,fsl,p1011-l2-cache-controller", },
>> + { .compatible = "uio,fsl,p1013-l2-cache-controller", },
>> + { .compatible = "uio,fsl,p1022-l2-cache-controller", },
>> + { .compatible = "uio,fsl,mpc8548-l2-cache-controller", },
>> + { .compatible = "uio,fsl,mpc8544-l2-cache-controller", },
>> + { .compatible = "uio,fsl,mpc8572-l2-cache-controller", },
>> + { .compatible = "uio,fsl,mpc8536-l2-cache-controller", },
>> + { .compatible = "uio,fsl,p1021-l2-cache-controller", },
>> + { .compatible = "uio,fsl,p1012-l2-cache-controller", },
>> + { .compatible = "uio,fsl,p1025-l2-cache-controller", },
>> + { .compatible = "uio,fsl,p1016-l2-cache-controller", },
>> + { .compatible = "uio,fsl,p1024-l2-cache-controller", },
>> + { .compatible = "uio,fsl,p1015-l2-cache-controller", },
>> + { .compatible = "uio,fsl,p1010-l2-cache-controller", },
>> + { .compatible = "uio,fsl,bsc9131-l2-cache-controller", },
>> + {},
>> +};
>> +
>> +static void uio_info_free_internal(struct uio_info *info)
>> +{
>> + struct uio_mem *uiomem = &info->mem[0];
>> +
>> + while (uiomem < &info->mem[MAX_UIO_MAPS]) {
>> + if (uiomem->size) {
>> + mpc85xx_cache_sram_free(uiomem->internal_addr);
>> + kfree(uiomem->name);
>> + }
>> + uiomem++;
>> + }
>> +}
>> +
>> +static int uio_fsl_85xx_cache_sram_probe(struct platform_device *pdev)
>> +{
>> + struct device_node *parent = pdev->dev.of_node;
>> + struct device_node *node = NULL;
>> + struct uio_info *info;
>> + struct uio_mem *uiomem;
>> + const char *dt_name;
>> + u32 mem_size;
>> + u32 align;
>> + void *virt;
>> + phys_addr_t phys;
>> + int ret = -ENODEV;
>> +
>> + /* alloc uio_info for one device */
>> + info = kzalloc(sizeof(*info), GFP_KERNEL);
>> + if (!info) {
>> + dev_err(&pdev->dev, "kzalloc uio_info failed\n");
>
>kzalloc already says this.
>

Surely, I will delete with v2.

>> + ret = -ENOMEM;
>> + goto err_out;
>> + }
>> +
>> + /* get optional uio name */
>> + if (of_property_read_string(parent, "uio_name", &dt_name))
>> + dt_name = UIO_NAME;
>> +
>> + info->name = kstrdup(dt_name, GFP_KERNEL);
>> + if (!info->name) {
>> + dev_err(&pdev->dev, "error kstrdup uio_name\n");
>
>kstrdup should have given you an error string already, right?
>

Surely, I will delete with v2.

>> + ret = -ENOMEM;
>> + goto err_info_free;
>> + }
>> +
>> + uiomem = &info->mem[0];
>> + for_each_child_of_node(parent, node) {
>> + if (!node) {
>> + dev_err(&pdev->dev, "device's OF-node is NULL\n");
>
>How can this happen?
>
My fault, this would never happen. I will address it in v2.
>> + continue;
>
>Why not error out?
>
>> + }
>> +
>> + ret = of_property_read_u32(node, "cache-mem-size", &mem_size);
>> + if (ret) {
>> + dev_err(&pdev->dev, "missing cache-mem-size value\n");
>
>You don't exit?
>
>> + continue;
>> + }
>> +
>> + if (mem_size == 0) {
>> + dev_err(&pdev->dev, "cache-mem-size should not be 0\n");
>
>Again, you don't exit?
>
>> + continue;
>> + }
>> +
>> + align = 2;
>> + while (align < mem_size)
>> + align *= 2;
>> + virt = mpc85xx_cache_sram_alloc(mem_size, &phys, align);
>> + if (!virt) {
>> + dev_err(&pdev->dev, "allocate 0x%x cache-mem failed\n", mem_size);
>
>You don't exit?
>

Actual all these situations should error out. For the continue branches,
we got a situation that we accept all the possibly correct child node
configurations, and it works. But it is not the common circumstance.
I have tested all these situations and I will change all these to error
out processes with v2.

>> + continue;
>> + }
>> +
>> + uiomem->memtype = UIO_MEM_PHYS;
>> + uiomem->addr = phys;
>> + uiomem->size = mem_size;
>> + uiomem->name = kstrdup(node->name, GFP_KERNEL);;
>> + uiomem->internal_addr = virt;
>> + ++uiomem;
>> +
>> + if (uiomem >= &info->mem[MAX_UIO_MAPS]) {
>> + dev_warn(&pdev->dev, "device has more than "
>> + __stringify(MAX_UIO_MAPS)
>> + " I/O memory resources.\n");
>
>What can someone do with that?
>

Surely it should be more friendly. I will address it with v2.

>thanks,
>
>greg k-h

2020-04-16 00:16:45

by 王文虎

[permalink] [raw]
Subject: [PATCH v2,0/5] drivers: uio: new driver uio_fsl_85xx_cache_sram

This series add a new uio driver for freescale 85xx platforms to
access the Cache-Sram form user level. This is extremely helpful
for the user-space applications that require high performance memory
accesses.

It fixes the compile errors and warning of the hardware level drivers
and implements the uio driver in uio_fsl_85xx_cache_sram.c.

Changes since v1:
* Addressed comments of Greg K-H
* Moved kfree(info->name) into uio_info_free_internal()

Wang Wenhu (5):
powerpc: 85xx: make FSL_85XX_CACHE_SRAM configurable
powerpc: sysdev: fix compile error for fsl_85xx_cache_sram
powerpc: sysdev: fix compile warning for fsl_85xx_cache_sram
powerpc: sysdev: fix compile error for fsl_85xx_l2ctlr
drivers: uio: new driver for fsl_85xx_cache_sram

arch/powerpc/platforms/85xx/Kconfig | 2 +-
arch/powerpc/platforms/Kconfig.cputype | 5 +-
arch/powerpc/sysdev/fsl_85xx_cache_sram.c | 3 +-
arch/powerpc/sysdev/fsl_85xx_l2ctlr.c | 1 +
drivers/uio/Kconfig | 8 +
drivers/uio/Makefile | 1 +
drivers/uio/uio_fsl_85xx_cache_sram.c | 182 ++++++++++++++++++++++
7 files changed, 198 insertions(+), 4 deletions(-)
create mode 100644 drivers/uio/uio_fsl_85xx_cache_sram.c

--
2.17.1

2020-04-16 00:16:46

by 王文虎

[permalink] [raw]
Subject: [PATCH v2,3/5] powerpc: sysdev: fix compile warning for fsl_85xx_cache_sram

Function instantiate_cache_sram should not be linked into the init
section for its caller mpc85xx_l2ctlr_of_probe is none-__init.

Cc: Greg Kroah-Hartman <[email protected]>
Cc: Christophe Leroy <[email protected]>
Cc: Scott Wood <[email protected]>
Cc: Michael Ellerman <[email protected]>
Cc: [email protected]
Fixes: 6db92cc9d07d ("powerpc/85xx: add cache-sram support")
Signed-off-by: Wang Wenhu <[email protected]>

Warning information:
MODPOST vmlinux.o
WARNING: modpost: vmlinux.o(.text+0x1e540): Section mismatch in reference from the function mpc85xx_l2ctlr_of_probe() to the function .init.text:instantiate_cache_sram()
The function mpc85xx_l2ctlr_of_probe() references
the function __init instantiate_cache_sram().
This is often because mpc85xx_l2ctlr_of_probe lacks a __init
annotation or the annotation of instantiate_cache_sram is wrong.
---
Changes since v1:
* None
---
arch/powerpc/sysdev/fsl_85xx_cache_sram.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/sysdev/fsl_85xx_cache_sram.c b/arch/powerpc/sysdev/fsl_85xx_cache_sram.c
index be3aef4229d7..3de5ac8382c0 100644
--- a/arch/powerpc/sysdev/fsl_85xx_cache_sram.c
+++ b/arch/powerpc/sysdev/fsl_85xx_cache_sram.c
@@ -68,7 +68,7 @@ void mpc85xx_cache_sram_free(void *ptr)
}
EXPORT_SYMBOL(mpc85xx_cache_sram_free);

-int __init instantiate_cache_sram(struct platform_device *dev,
+int instantiate_cache_sram(struct platform_device *dev,
struct sram_parameters sram_params)
{
int ret = 0;
--
2.17.1

2020-04-16 01:19:29

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH 1/5] powerpc: 85xx: make FSL_85XX_CACHE_SRAM configurable

Hi Wang,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on powerpc/next]
[also build test ERROR on char-misc/char-misc-testing staging/staging-testing v5.7-rc1 next-20200415]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url: https://github.com/0day-ci/linux/commits/Wang-Wenhu/drivers-uio-new-driver-uio_fsl_85xx_cache_sram/20200416-040633
base: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next
config: powerpc-allyesconfig (attached as .config)
compiler: powerpc64-linux-gcc (GCC) 9.3.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day GCC_VERSION=9.3.0 make.cross ARCH=powerpc

If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <[email protected]>

All error/warnings (new ones prefixed by >>):

WARNING: unmet direct dependencies detected for ARCH_32BIT_OFF_T
Depends on !64BIT
Selected by
- PPC && PPC32
In file included from include/linux/atomic-fallback.h:1185,
from include/linux/atomic.h:74,
from include/linux/debug_locks.h:6,
from include/linux/lockdep.h:28,
from include/linux/spinlock_types.h:18,
from kernel/bounds.c:14:
>> include/asm-generic/atomic64.h:14:3: error: conflicting types for 'atomic64_t'
14 | } atomic64_t;
| ^~~~~~~~~~
In file included from include/linux/page-flags.h:9,
from kernel/bounds.c:10:
include/linux/types.h:178:3: note: previous declaration of 'atomic64_t' was here
178 | } atomic64_t;
| ^~~~~~~~~~
In file included from include/linux/atomic-fallback.h:1185,
from include/linux/atomic.h:74,
from include/linux/debug_locks.h:6,
from include/linux/lockdep.h:28,
from include/linux/spinlock_types.h:18,
from kernel/bounds.c:14:
>> include/asm-generic/atomic64.h:18:12: error: conflicting types for 'atomic64_read'
18 | extern s64 atomic64_read(const atomic64_t
| ^~~~~~~~~~~~~
In file included from include/linux/atomic.h:7,
from include/linux/debug_locks.h:6,
from include/linux/lockdep.h:28,
from include/linux/spinlock_types.h:18,
from kernel/bounds.c:14:
arch/powerpc/include/asm/atomic.h:300:23: note: previous definition of 'atomic64_read' was here
300 | static __inline__ s64 atomic64_read(const atomic64_t
| ^~~~~~~~~~~~~
In file included from include/linux/atomic-fallback.h:1185,
from include/linux/atomic.h:74,
from include/linux/debug_locks.h:6,
from include/linux/lockdep.h:28,
from include/linux/spinlock_types.h:18,
from kernel/bounds.c:14:
>> include/asm-generic/atomic64.h:19:13: error: conflicting types for 'atomic64_set'
19 | extern void atomic64_set(atomic64_t s64 i);
| ^~~~~~~~~~~~
In file included from include/linux/atomic.h:7,
from include/linux/debug_locks.h:6,
from include/linux/lockdep.h:28,
from include/linux/spinlock_types.h:18,
from kernel/bounds.c:14:
arch/powerpc/include/asm/atomic.h:309:24: note: previous definition of 'atomic64_set' was here
309 | static __inline__ void atomic64_set(atomic64_t s64 i)
| ^~~~~~~~~~~~
In file included from include/linux/atomic-fallback.h:1185,
from include/linux/atomic.h:74,
from include/linux/debug_locks.h:6,
from include/linux/lockdep.h:28,
from include/linux/spinlock_types.h:18,
from kernel/bounds.c:14:
>> include/asm-generic/atomic64.h:32: warning: "ATOMIC64_OPS" redefined
32 | #define ATOMIC64_OPS(op) ATOMIC64_OP(op) ATOMIC64_OP_RETURN(op) ATOMIC64_FETCH_OP(op)
|
In file included from include/linux/atomic.h:7,
from include/linux/debug_locks.h:6,
from include/linux/lockdep.h:28,
from include/linux/spinlock_types.h:18,
from kernel/bounds.c:14:
arch/powerpc/include/asm/atomic.h:380: note: this is the location of the previous definition
380 | #define ATOMIC64_OPS(op, asm_op) |
In file included from include/linux/atomic-fallback.h:1185,
from include/linux/atomic.h:74,
from include/linux/debug_locks.h:6,
from include/linux/lockdep.h:28,
from include/linux/spinlock_types.h:18,
from kernel/bounds.c:14:
>> include/asm-generic/atomic64.h:24:14: error: conflicting types for 'atomic64_add'
24 | extern void atomic64_##op(s64 a, atomic64_t
| ^~~~~~~~~
>> include/asm-generic/atomic64.h:32:26: note: in expansion of macro 'ATOMIC64_OP'
32 | #define ATOMIC64_OPS(op) ATOMIC64_OP(op) ATOMIC64_OP_RETURN(op) ATOMIC64_FETCH_OP(op)
| ^~~~~~~~~~~
>> include/asm-generic/atomic64.h:34:1: note: in expansion of macro 'ATOMIC64_OPS'
34 | ATOMIC64_OPS(add)
| ^~~~~~~~~~~~
In file included from include/linux/atomic.h:7,
from include/linux/debug_locks.h:6,
from include/linux/lockdep.h:28,
from include/linux/spinlock_types.h:18,
from kernel/bounds.c:14:
arch/powerpc/include/asm/atomic.h:315:24: note: previous definition of 'atomic64_add' was here
315 | static __inline__ void atomic64_##op(s64 a, atomic64_t | ^~~~~~~~~
>> arch/powerpc/include/asm/atomic.h:366:2: note: in expansion of macro 'ATOMIC64_OP'
366 | ATOMIC64_OP(op, asm_op) | ^~~~~~~~~~~
>> arch/powerpc/include/asm/atomic.h:370:1: note: in expansion of macro 'ATOMIC64_OPS'
370 | ATOMIC64_OPS(add, add)
| ^~~~~~~~~~~~
In file included from include/linux/atomic-fallback.h:1185,
from include/linux/atomic.h:74,
from include/linux/debug_locks.h:6,
from include/linux/lockdep.h:28,
from include/linux/spinlock_types.h:18,
from kernel/bounds.c:14:
>> include/asm-generic/atomic64.h:24:14: error: conflicting types for 'atomic64_sub'
24 | extern void atomic64_##op(s64 a, atomic64_t
| ^~~~~~~~~
>> include/asm-generic/atomic64.h:32:26: note: in expansion of macro 'ATOMIC64_OP'
32 | #define ATOMIC64_OPS(op) ATOMIC64_OP(op) ATOMIC64_OP_RETURN(op) ATOMIC64_FETCH_OP(op)
| ^~~~~~~~~~~
include/asm-generic/atomic64.h:35:1: note: in expansion of macro 'ATOMIC64_OPS'
35 | ATOMIC64_OPS(sub)
| ^~~~~~~~~~~~
In file included from include/linux/atomic.h:7,
from include/linux/debug_locks.h:6,
from include/linux/lockdep.h:28,
from include/linux/spinlock_types.h:18,
from kernel/bounds.c:14:
arch/powerpc/include/asm/atomic.h:315:24: note: previous definition of 'atomic64_sub' was here
315 | static __inline__ void atomic64_##op(s64 a, atomic64_t | ^~~~~~~~~
>> arch/powerpc/include/asm/atomic.h:366:2: note: in expansion of macro 'ATOMIC64_OP'
366 | ATOMIC64_OP(op, asm_op) | ^~~~~~~~~~~
arch/powerpc/include/asm/atomic.h:371:1: note: in expansion of macro 'ATOMIC64_OPS'
371 | ATOMIC64_OPS(sub, subf)
| ^~~~~~~~~~~~
In file included from include/linux/atomic-fallback.h:1185,
from include/linux/atomic.h:74,
from include/linux/debug_locks.h:6,
from include/linux/lockdep.h:28,
from include/linux/spinlock_types.h:18,
from kernel/bounds.c:14:
>> include/asm-generic/atomic64.h:24:14: error: conflicting types for 'atomic64_and'
24 | extern void atomic64_##op(s64 a, atomic64_t
| ^~~~~~~~~
include/asm-generic/atomic64.h:38:26: note: in expansion of macro 'ATOMIC64_OP'
38 | #define ATOMIC64_OPS(op) ATOMIC64_OP(op) ATOMIC64_FETCH_OP(op)
| ^~~~~~~~~~~
include/asm-generic/atomic64.h:40:1: note: in expansion of macro 'ATOMIC64_OPS'
40 | ATOMIC64_OPS(and)
| ^~~~~~~~~~~~
In file included from include/linux/atomic.h:7,
from include/linux/debug_locks.h:6,
from include/linux/lockdep.h:28,
from include/linux/spinlock_types.h:18,
from kernel/bounds.c:14:
arch/powerpc/include/asm/atomic.h:315:24: note: previous definition of 'atomic64_and' was here
315 | static __inline__ void atomic64_##op(s64 a, atomic64_t | ^~~~~~~~~
arch/powerpc/include/asm/atomic.h:381:2: note: in expansion of macro 'ATOMIC64_OP'
381 | ATOMIC64_OP(op, asm_op) | ^~~~~~~~~~~
arch/powerpc/include/asm/atomic.h:384:1: note: in expansion of macro 'ATOMIC64_OPS'
384 | ATOMIC64_OPS(and, and)
| ^~~~~~~~~~~~
In file included from include/linux/atomic-fallback.h:1185,
from include/linux/atomic.h:74,
from include/linux/debug_locks.h:6,
from include/linux/lockdep.h:28,
from include/linux/spinlock_types.h:18,
from kernel/bounds.c:14:
>> include/asm-generic/atomic64.h:24:14: error: conflicting types for 'atomic64_or'
24 | extern void atomic64_##op(s64 a, atomic64_t
| ^~~~~~~~~
include/asm-generic/atomic64.h:38:26: note: in expansion of macro 'ATOMIC64_OP'
38 | #define ATOMIC64_OPS(op) ATOMIC64_OP(op) ATOMIC64_FETCH_OP(op)
| ^~~~~~~~~~~
include/asm-generic/atomic64.h:41:1: note: in expansion of macro 'ATOMIC64_OPS'
41 | ATOMIC64_OPS(or)
| ^~~~~~~~~~~~
In file included from include/linux/atomic.h:7,
from include/linux/debug_locks.h:6,
from include/linux/lockdep.h:28,
from include/linux/spinlock_types.h:18,
from kernel/bounds.c:14:
arch/powerpc/include/asm/atomic.h:315:24: note: previous definition of 'atomic64_or' was here
315 | static __inline__ void atomic64_##op(s64 a, atomic64_t | ^~~~~~~~~
arch/powerpc/include/asm/atomic.h:381:2: note: in expansion of macro 'ATOMIC64_OP'
381 | ATOMIC64_OP(op, asm_op) | ^~~~~~~~~~~
arch/powerpc/include/asm/atomic.h:385:1: note: in expansion of macro 'ATOMIC64_OPS'
385 | ATOMIC64_OPS(or, or)
| ^~~~~~~~~~~~
In file included from include/linux/atomic-fallback.h:1185,
from include/linux/atomic.h:74,
from include/linux/debug_locks.h:6,
from include/linux/lockdep.h:28,
from include/linux/spinlock_types.h:18,
from kernel/bounds.c:14:
>> include/asm-generic/atomic64.h:24:14: error: conflicting types for 'atomic64_xor'
24 | extern void atomic64_##op(s64 a, atomic64_t
| ^~~~~~~~~
include/asm-generic/atomic64.h:38:26: note: in expansion of macro 'ATOMIC64_OP'
38 | #define ATOMIC64_OPS(op) ATOMIC64_OP(op) ATOMIC64_FETCH_OP(op)
| ^~~~~~~~~~~
include/asm-generic/atomic64.h:42:1: note: in expansion of macro 'ATOMIC64_OPS'
42 | ATOMIC64_OPS(xor)
| ^~~~~~~~~~~~
In file included from include/linux/atomic.h:7,
from include/linux/debug_locks.h:6,
from include/linux/lockdep.h:28,
from include/linux/spinlock_types.h:18,
from kernel/bounds.c:14:
arch/powerpc/include/asm/atomic.h:315:24: note: previous definition of 'atomic64_xor' was here
315 | static __inline__ void atomic64_##op(s64 a, atomic64_t | ^~~~~~~~~
arch/powerpc/include/asm/atomic.h:381:2: note: in expansion of macro 'ATOMIC64_OP'
381 | ATOMIC64_OP(op, asm_op) | ^~~~~~~~~~~
arch/powerpc/include/asm/atomic.h:386:1: note: in expansion of macro 'ATOMIC64_OPS'
386 | ATOMIC64_OPS(xor, xor)
| ^~~~~~~~~~~~
>> arch/powerpc/include/asm/atomic.h:485:34: error: conflicting types for 'atomic64_dec_if_positive'
485 | #define atomic64_dec_if_positive atomic64_dec_if_positive
| ^~~~~~~~~~~~~~~~~~~~~~~~
>> include/asm-generic/atomic64.h:49:12: note: in expansion of macro 'atomic64_dec_if_positive'
49 | extern s64 atomic64_dec_if_positive(atomic64_t
| ^~~~~~~~~~~~~~~~~~~~~~~~
arch/powerpc/include/asm/atomic.h:466:23: note: previous definition of 'atomic64_dec_if_positive' was here
466 | static __inline__ s64 atomic64_dec_if_positive(atomic64_t
| ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from arch/powerpc/include/asm/atomic.h:11,
from include/linux/atomic.h:7,
from include/linux/debug_locks.h:6,
from include/linux/lockdep.h:28,
from include/linux/spinlock_types.h:18,
from kernel/bounds.c:14:
>> arch/powerpc/include/asm/cmpxchg.h:482:4: error: expected identifier or '(' before '{' token
482 | ({ | ^
>> arch/powerpc/include/asm/atomic.h:487:36: note: in expansion of macro 'cmpxchg'
487 | #define atomic64_cmpxchg(v, o, n) (cmpxchg(&((v)->counter), (o), (n)))
| ^~~~~~~
>> include/asm-generic/atomic64.h:51:12: note: in expansion of macro 'atomic64_cmpxchg'
51 | extern s64 atomic64_cmpxchg(atomic64_t s64 o, s64 n);
| ^~~~~~~~~~~~~~~~
In file included from include/linux/debug_locks.h:6,
from include/linux/lockdep.h:28,
from include/linux/spinlock_types.h:18,
from kernel/bounds.c:14:
include/linux/atomic.h:66:2: error: expected identifier or '(' before '{' token
66 | ({ | ^
include/linux/atomic-fallback.h:27:2: note: in expansion of macro '__atomic_op_fence'
27 | __atomic_op_fence(xchg, __VA_ARGS__)
| ^~~~~~~~~~~~~~~~~
arch/powerpc/include/asm/atomic.h:493:32: note: in expansion of macro 'xchg'
493 | #define atomic64_xchg(v, new) (xchg(&((v)->counter), new))
| ^~~~
include/asm-generic/atomic64.h:52:12: note: in expansion of macro 'atomic64_xchg'
52 | extern s64 atomic64_xchg(atomic64_t s64 new);
| ^~~~~~~~~~~~~
In file included from include/linux/atomic.h:7,
from include/linux/debug_locks.h:6,
from include/linux/lockdep.h:28,
from include/linux/spinlock_types.h:18,
from kernel/bounds.c:14:
arch/powerpc/include/asm/atomic.h:526:35: error: conflicting types for 'atomic64_fetch_add_unless'
526 | #define atomic64_fetch_add_unless atomic64_fetch_add_unless
| ^~~~~~~~~~~~~~~~~~~~~~~~~
include/asm-generic/atomic64.h:53:12: note: in expansion of macro 'atomic64_fetch_add_unless'
53 | extern s64 atomic64_fetch_add_unless(atomic64_t s64 a, s64 u);
| ^~~~~~~~~~~~~~~~~~~~~~~~~
arch/powerpc/include/asm/atomic.h:505:23: note: previous definition of 'atomic64_fetch_add_unless' was here
505 | static __inline__ s64 atomic64_fetch_add_unless(atomic64_t s64 a, s64 u)
| ^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from include/linux/atomic.h:74,
from include/linux/debug_locks.h:6,
from include/linux/lockdep.h:28,
from include/linux/spinlock_types.h:18,
from kernel/bounds.c:14:
include/linux/atomic-fallback.h: In function 'atomic64_add_return_acquire':
include/linux/atomic-fallback.h:1216:43: error: passing argument 2 of 'atomic64_add_return_relaxed' from incompatible pointer type
1216 | s64 ret = atomic64_add_return_relaxed(i, v);
| ^
| |
| atomic64_t Makefile arch block certs crypto drivers fs include init ipc kernel lib mm net scripts security sound source usr virt {aka struct <anonymous>
In file included from include/linux/atomic.h:7,
from include/linux/debug_locks.h:6,
from include/linux/lockdep.h:28,
from include/linux/spinlock_types.h:18,
from kernel/bounds.c:14:
arch/powerpc/include/asm/atomic.h:331:51: note: expected 'atomic64_t {aka 'struct <anonymous> but argument is of type 'atomic64_t {aka 'struct <anonymous>
331 | atomic64_##op##_return_relaxed(s64 a, atomic64_t | ~~~~~~~~~~~~^
arch/powerpc/include/asm/atomic.h:367:2: note: in expansion of macro 'ATOMIC64_OP_RETURN_RELAXED'
367 | ATOMIC64_OP_RETURN_RELAXED(op, asm_op) | ^~~~~~~~~~~~~~~~~~~~~~~~~~
arch/powerpc/include/asm/atomic.h:370:1: note: in expansion of macro 'ATOMIC64_OPS'
370 | ATOMIC64_OPS(add, add)
| ^~~~~~~~~~~~
In file included from include/linux/atomic.h:74,
from include/linux/debug_locks.h:6,
from include/linux/lockdep.h:28,
from include/linux/spinlock_types.h:18,
from kernel/bounds.c:14:
include/linux/atomic-fallback.h: In function 'atomic64_add_return_release':
include/linux/atomic-fallback.h:1228:40: error: passing argument 2 of 'atomic64_add_return_relaxed' from incompatible pointer type
1228 | return atomic64_add_return_relaxed(i, v);
| ^
| |
| atomic64_t Makefile arch block certs crypto drivers fs include init ipc kernel lib mm net scripts security sound source usr virt {aka struct <anonymous>
In file included from include/linux/atomic.h:7,
from include/linux/debug_locks.h:6,
from include/linux/lockdep.h:28,
from include/linux/spinlock_types.h:18,
from kernel/bounds.c:14:
arch/powerpc/include/asm/atomic.h:331:51: note: expected 'atomic64_t {aka 'struct <anonymous> but argument is of type 'atomic64_t {aka 'struct <anonymous>
331 | atomic64_##op##_return_relaxed(s64 a, atomic64_t | ~~~~~~~~~~~~^
arch/powerpc/include/asm/atomic.h:367:2: note: in expansion of macro 'ATOMIC64_OP_RETURN_RELAXED'
367 | ATOMIC64_OP_RETURN_RELAXED(op, asm_op) | ^~~~~~~~~~~~~~~~~~~~~~~~~~
arch/powerpc/include/asm/atomic.h:370:1: note: in expansion of macro 'ATOMIC64_OPS'
370 | ATOMIC64_OPS(add, add)
| ^~~~~~~~~~~~
In file included from include/linux/atomic.h:74,
from include/linux/debug_locks.h:6,
from include/linux/lockdep.h:28,
from include/linux/spinlock_types.h:18,
from kernel/bounds.c:14:
include/linux/atomic-fallback.h: At top level:
include/linux/atomic-fallback.h:1235:1: error: static declaration of 'atomic64_add_return' follows non-static declaration
1235 | atomic64_add_return(s64 i, atomic64_t
| ^~~~~~~~~~~~~~~~~~~
In file included from include/linux/atomic-fallback.h:1185,
from include/linux/atomic.h:74,
from include/linux/debug_locks.h:6,
from include/linux/lockdep.h:28,
from include/linux/spinlock_types.h:18,
from kernel/bounds.c:14:
include/asm-generic/atomic64.h:27:12: note: previous declaration of 'atomic64_add_return' was here
27 | extern s64 atomic64_##op##_return(s64 a, atomic64_t
| ^~~~~~~~~
include/asm-generic/atomic64.h:32:42: note: in expansion of macro 'ATOMIC64_OP_RETURN'
32 | #define ATOMIC64_OPS(op) ATOMIC64_OP(op) ATOMIC64_OP_RETURN(op) ATOMIC64_FETCH_OP(op)
| ^~~~~~~~~~~~~~~~~~
include/asm-generic/atomic64.h:34:1: note: in expansion of macro 'ATOMIC64_OPS'
34 | ATOMIC64_OPS(add)

vim +/atomic64_t +14 include/asm-generic/atomic64.h

09d4e0edd4614e7 Paul Mackerras 2009-06-12 11
09d4e0edd4614e7 Paul Mackerras 2009-06-12 12 typedef struct {
9255813d5841e15 Mark Rutland 2019-05-22 13 s64 counter;
09d4e0edd4614e7 Paul Mackerras 2009-06-12 @14 } atomic64_t;
09d4e0edd4614e7 Paul Mackerras 2009-06-12 15
09d4e0edd4614e7 Paul Mackerras 2009-06-12 16 #define ATOMIC64_INIT(i) { (i) }
09d4e0edd4614e7 Paul Mackerras 2009-06-12 17
9255813d5841e15 Mark Rutland 2019-05-22 @18 extern s64 atomic64_read(const atomic64_t *v);
9255813d5841e15 Mark Rutland 2019-05-22 @19 extern void atomic64_set(atomic64_t *v, s64 i);
560cb12a4080a48 Peter Zijlstra 2014-04-23 20
9d664c0aec3bfdb Peter Zijlstra 2017-06-09 21 #define atomic64_set_release(v, i) atomic64_set((v), (i))
9d664c0aec3bfdb Peter Zijlstra 2017-06-09 22
560cb12a4080a48 Peter Zijlstra 2014-04-23 23 #define ATOMIC64_OP(op) \
9255813d5841e15 Mark Rutland 2019-05-22 @24 extern void atomic64_##op(s64 a, atomic64_t *v);
560cb12a4080a48 Peter Zijlstra 2014-04-23 25
560cb12a4080a48 Peter Zijlstra 2014-04-23 26 #define ATOMIC64_OP_RETURN(op) \
9255813d5841e15 Mark Rutland 2019-05-22 27 extern s64 atomic64_##op##_return(s64 a, atomic64_t *v);
560cb12a4080a48 Peter Zijlstra 2014-04-23 28
28aa2bda2211f43 Peter Zijlstra 2016-04-18 29 #define ATOMIC64_FETCH_OP(op) \
9255813d5841e15 Mark Rutland 2019-05-22 30 extern s64 atomic64_fetch_##op(s64 a, atomic64_t *v);
28aa2bda2211f43 Peter Zijlstra 2016-04-18 31
28aa2bda2211f43 Peter Zijlstra 2016-04-18 @32 #define ATOMIC64_OPS(op) ATOMIC64_OP(op) ATOMIC64_OP_RETURN(op) ATOMIC64_FETCH_OP(op)
560cb12a4080a48 Peter Zijlstra 2014-04-23 33
560cb12a4080a48 Peter Zijlstra 2014-04-23 @34 ATOMIC64_OPS(add)
560cb12a4080a48 Peter Zijlstra 2014-04-23 35 ATOMIC64_OPS(sub)
560cb12a4080a48 Peter Zijlstra 2014-04-23 36
28aa2bda2211f43 Peter Zijlstra 2016-04-18 37 #undef ATOMIC64_OPS
28aa2bda2211f43 Peter Zijlstra 2016-04-18 38 #define ATOMIC64_OPS(op) ATOMIC64_OP(op) ATOMIC64_FETCH_OP(op)
28aa2bda2211f43 Peter Zijlstra 2016-04-18 39
28aa2bda2211f43 Peter Zijlstra 2016-04-18 40 ATOMIC64_OPS(and)
28aa2bda2211f43 Peter Zijlstra 2016-04-18 41 ATOMIC64_OPS(or)
28aa2bda2211f43 Peter Zijlstra 2016-04-18 42 ATOMIC64_OPS(xor)
e6942b7de2dfe44 Peter Zijlstra 2014-04-23 43
560cb12a4080a48 Peter Zijlstra 2014-04-23 44 #undef ATOMIC64_OPS
28aa2bda2211f43 Peter Zijlstra 2016-04-18 45 #undef ATOMIC64_FETCH_OP
560cb12a4080a48 Peter Zijlstra 2014-04-23 46 #undef ATOMIC64_OP_RETURN
560cb12a4080a48 Peter Zijlstra 2014-04-23 47 #undef ATOMIC64_OP
560cb12a4080a48 Peter Zijlstra 2014-04-23 48
9255813d5841e15 Mark Rutland 2019-05-22 @49 extern s64 atomic64_dec_if_positive(atomic64_t *v);
b3a2a05f9111de0 Mark Rutland 2018-06-21 50 #define atomic64_dec_if_positive atomic64_dec_if_positive
9255813d5841e15 Mark Rutland 2019-05-22 @51 extern s64 atomic64_cmpxchg(atomic64_t *v, s64 o, s64 n);
9255813d5841e15 Mark Rutland 2019-05-22 @52 extern s64 atomic64_xchg(atomic64_t *v, s64 new);
9255813d5841e15 Mark Rutland 2019-05-22 @53 extern s64 atomic64_fetch_add_unless(atomic64_t *v, s64 a, s64 u);
00b808ab79ead37 Mark Rutland 2018-06-21 54 #define atomic64_fetch_add_unless atomic64_fetch_add_unless
09d4e0edd4614e7 Paul Mackerras 2009-06-12 55

:::::: The code at line 14 was first introduced by commit
:::::: 09d4e0edd4614e787393acc582ac701c6ec3565b lib: Provide generic atomic64_t implementation

:::::: TO: Paul Mackerras <[email protected]>
:::::: CC: Benjamin Herrenschmidt <[email protected]>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]


Attachments:
(No filename) (21.33 kB)
.config.gz (67.26 kB)
Download all attachments

2020-04-16 08:10:43

by 王文虎

[permalink] [raw]
Subject: [PATCH v3,0/4] drivers: uio: new driver uio_fsl_85xx_cache_sram

This series add a new uio driver for freescale 85xx platforms to
access the Cache-Sram form user level. This is extremely helpful
for the user-space applications that require high performance memory
accesses.

It fixes the compile errors and warning of the hardware level drivers
and implements the uio driver in uio_fsl_85xx_cache_sram.c.

Changes since v1:
* Addressed comments from Greg K-H
* Moved kfree(info->name) into uio_info_free_internal()

Changes since v2:
* Drop the patch that modifies Kconfigs of arch/powerpc/platforms
and modified the sequence of patches:
01:dropped, 02->03, 03->02, 04->01, 05->04
* Addressed comments from Greg, Scott and Christophe
* Use "uiomem->internal_addr" as if condition for sram memory free,
and memset the uiomem entry
* Modified of_match_table make the driver apart from Cache-Sram HW info
which belong to the HW level driver fsl_85xx_cache_sram to match
* Use roundup_pow_of_two for align calc(really learned a lot from Christophe)
* Remove useless clear block of uiomem entries.
* Use UIO_INFO_VER micro for info->version, and define it as
"devicetree,pseudo", meaning this is pseudo device and probed from
device tree configuration
* Select FSL_85XX_CACHE_SRAM rather than depends on it

Wang Wenhu (4):
powerpc: sysdev: fix compile error for fsl_85xx_l2ctlr
powerpc: sysdev: fix compile error for fsl_85xx_cache_sram
powerpc: sysdev: fix compile warning for fsl_85xx_cache_sram
drivers: uio: new driver for fsl_85xx_cache_sram

arch/powerpc/sysdev/fsl_85xx_cache_sram.c | 3 +-
arch/powerpc/sysdev/fsl_85xx_l2ctlr.c | 1 +
drivers/uio/Kconfig | 9 ++
drivers/uio/Makefile | 1 +
drivers/uio/uio_fsl_85xx_cache_sram.c | 158 ++++++++++++++++++++++
5 files changed, 171 insertions(+), 1 deletion(-)
create mode 100644 drivers/uio/uio_fsl_85xx_cache_sram.c

--
2.17.1

2020-04-16 08:12:12

by 王文虎

[permalink] [raw]
Subject: [PATCH v3,3/4] powerpc: sysdev: fix compile warning for fsl_85xx_cache_sram

Function instantiate_cache_sram should not be linked into the init
section for its caller mpc85xx_l2ctlr_of_probe is none-__init.

Cc: Greg Kroah-Hartman <[email protected]>
Cc: Christophe Leroy <[email protected]>
Cc: Scott Wood <[email protected]>
Cc: Michael Ellerman <[email protected]>
Cc: [email protected]
Fixes: 6db92cc9d07d ("powerpc/85xx: add cache-sram support")
Signed-off-by: Wang Wenhu <[email protected]>

Warning information:
MODPOST vmlinux.o
WARNING: modpost: vmlinux.o(.text+0x1e540): Section mismatch in reference from the function mpc85xx_l2ctlr_of_probe() to the function .init.text:instantiate_cache_sram()
The function mpc85xx_l2ctlr_of_probe() references
the function __init instantiate_cache_sram().
This is often because mpc85xx_l2ctlr_of_probe lacks a __init
annotation or the annotation of instantiate_cache_sram is wrong.
---
Changes since v1:
* None
Changes since v2:
* None
---
arch/powerpc/sysdev/fsl_85xx_cache_sram.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/sysdev/fsl_85xx_cache_sram.c b/arch/powerpc/sysdev/fsl_85xx_cache_sram.c
index be3aef4229d7..3de5ac8382c0 100644
--- a/arch/powerpc/sysdev/fsl_85xx_cache_sram.c
+++ b/arch/powerpc/sysdev/fsl_85xx_cache_sram.c
@@ -68,7 +68,7 @@ void mpc85xx_cache_sram_free(void *ptr)
}
EXPORT_SYMBOL(mpc85xx_cache_sram_free);

-int __init instantiate_cache_sram(struct platform_device *dev,
+int instantiate_cache_sram(struct platform_device *dev,
struct sram_parameters sram_params)
{
int ret = 0;
--
2.17.1

2020-04-16 08:13:54

by 王文虎

[permalink] [raw]
Subject: [PATCH v3,2/4] powerpc: sysdev: fix compile error for fsl_85xx_cache_sram

Include linux/io.h into fsl_85xx_cache_sram.c to fix the
implicit-declaration compile error when building Cache-Sram.

arch/powerpc/sysdev/fsl_85xx_cache_sram.c: In function ‘instantiate_cache_sram’:
arch/powerpc/sysdev/fsl_85xx_cache_sram.c:97:26: error: implicit declaration of function ‘ioremap_coherent’; did you mean ‘bitmap_complement’? [-Werror=implicit-function-declaration]
cache_sram->base_virt = ioremap_coherent(cache_sram->base_phys,
^~~~~~~~~~~~~~~~
bitmap_complement
arch/powerpc/sysdev/fsl_85xx_cache_sram.c:97:24: error: assignment makes pointer from integer without a cast [-Werror=int-conversion]
cache_sram->base_virt = ioremap_coherent(cache_sram->base_phys,
^
arch/powerpc/sysdev/fsl_85xx_cache_sram.c:123:2: error: implicit declaration of function ‘iounmap’; did you mean ‘roundup’? [-Werror=implicit-function-declaration]
iounmap(cache_sram->base_virt);
^~~~~~~
roundup
cc1: all warnings being treated as errors

Cc: Greg Kroah-Hartman <[email protected]>
Cc: Christophe Leroy <[email protected]>
Cc: Scott Wood <[email protected]>
Cc: Michael Ellerman <[email protected]>
Cc: [email protected]
Fixes: 6db92cc9d07d ("powerpc/85xx: add cache-sram support")
Signed-off-by: WANG Wenhu <[email protected]>
---
Changes since v1:
* None
Changes since v2:
* None
---
arch/powerpc/sysdev/fsl_85xx_cache_sram.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/arch/powerpc/sysdev/fsl_85xx_cache_sram.c b/arch/powerpc/sysdev/fsl_85xx_cache_sram.c
index f6c665dac725..be3aef4229d7 100644
--- a/arch/powerpc/sysdev/fsl_85xx_cache_sram.c
+++ b/arch/powerpc/sysdev/fsl_85xx_cache_sram.c
@@ -17,6 +17,7 @@
#include <linux/of_platform.h>
#include <asm/pgtable.h>
#include <asm/fsl_85xx_cache_sram.h>
+#include <linux/io.h>

#include "fsl_85xx_cache_ctlr.h"

--
2.17.1

2020-04-16 08:16:26

by 王文虎

[permalink] [raw]
Subject: [PATCH v3,1/4] powerpc: sysdev: fix compile error for fsl_85xx_l2ctlr

Include "linux/of_address.h" to fix the compile error for
mpc85xx_l2ctlr_of_probe() when compiling fsl_85xx_cache_sram.c.

CC arch/powerpc/sysdev/fsl_85xx_l2ctlr.o
arch/powerpc/sysdev/fsl_85xx_l2ctlr.c: In function ‘mpc85xx_l2ctlr_of_probe’:
arch/powerpc/sysdev/fsl_85xx_l2ctlr.c:90:11: error: implicit declaration of function ‘of_iomap’; did you mean ‘pci_iomap’? [-Werror=implicit-function-declaration]
l2ctlr = of_iomap(dev->dev.of_node, 0);
^~~~~~~~
pci_iomap
arch/powerpc/sysdev/fsl_85xx_l2ctlr.c:90:9: error: assignment makes pointer from integer without a cast [-Werror=int-conversion]
l2ctlr = of_iomap(dev->dev.of_node, 0);
^
cc1: all warnings being treated as errors
scripts/Makefile.build:267: recipe for target 'arch/powerpc/sysdev/fsl_85xx_l2ctlr.o' failed
make[2]: *** [arch/powerpc/sysdev/fsl_85xx_l2ctlr.o] Error 1

Cc: Greg Kroah-Hartman <[email protected]>
Cc: Christophe Leroy <[email protected]>
Cc: Scott Wood <[email protected]>
Cc: Michael Ellerman <[email protected]>
Cc: [email protected]
Fixes: 6db92cc9d07d ("powerpc/85xx: add cache-sram support")
Signed-off-by: Wang Wenhu <[email protected]>
---
Changes since v1:
* None
Changes since v2:
* None
---
arch/powerpc/sysdev/fsl_85xx_l2ctlr.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/arch/powerpc/sysdev/fsl_85xx_l2ctlr.c b/arch/powerpc/sysdev/fsl_85xx_l2ctlr.c
index 2d0af0c517bb..7533572492f0 100644
--- a/arch/powerpc/sysdev/fsl_85xx_l2ctlr.c
+++ b/arch/powerpc/sysdev/fsl_85xx_l2ctlr.c
@@ -10,6 +10,7 @@
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/of_platform.h>
+#include <linux/of_address.h>
#include <asm/io.h>

#include "fsl_85xx_cache_ctlr.h"
--
2.17.1

2020-04-16 08:17:58

by 王文虎

[permalink] [raw]
Subject: [PATCH v3,4/4] drivers: uio: new driver for fsl_85xx_cache_sram

A driver for freescale 85xx platforms to access the Cache-Sram form
user level. This is extremely helpful for some user-space applications
that require high performance memory accesses.

Cc: Greg Kroah-Hartman <[email protected]>
Cc: Christophe Leroy <[email protected]>
Cc: Scott Wood <[email protected]>
Cc: Michael Ellerman <[email protected]>
Cc: [email protected]
Signed-off-by: Wang Wenhu <[email protected]>
---
Changes since v1:
* Addressed comments from Greg K-H
* Moved kfree(info->name) into uio_info_free_internal()
Changes since v2:
* Addressed comments from Greg, Scott and Christophe
* Use "uiomem->internal_addr" as if condition for sram memory free,
and memset the uiomem entry
* Modified of_match_table make the driver apart from Cache-Sram HW info
which belong to the HW level driver fsl_85xx_cache_sram to match
* Use roundup_pow_of_two for align calculation
* Remove useless clear block of uiomem entries.
* Use UIO_INFO_VER micro for info->version, and define it as
"devicetree,pseudo", meaning this is pseudo device and probed from
device tree configuration
* Select FSL_85XX_CACHE_SRAM rather than depends on it
---
drivers/uio/Kconfig | 9 ++
drivers/uio/Makefile | 1 +
drivers/uio/uio_fsl_85xx_cache_sram.c | 158 ++++++++++++++++++++++++++
3 files changed, 168 insertions(+)
create mode 100644 drivers/uio/uio_fsl_85xx_cache_sram.c

diff --git a/drivers/uio/Kconfig b/drivers/uio/Kconfig
index 202ee81cfc2b..9c3b47461b71 100644
--- a/drivers/uio/Kconfig
+++ b/drivers/uio/Kconfig
@@ -105,6 +105,15 @@ config UIO_NETX
To compile this driver as a module, choose M here; the module
will be called uio_netx.

+config UIO_FSL_85XX_CACHE_SRAM
+ tristate "Freescale 85xx Cache-Sram driver"
+ depends on FSL_SOC_BOOKE && PPC32
+ select FSL_85XX_CACHE_SRAM
+ help
+ Generic driver for accessing the Cache-Sram form user level. This
+ is extremely helpful for some user-space applications that require
+ high performance memory accesses.
+
config UIO_FSL_ELBC_GPCM
tristate "eLBC/GPCM driver"
depends on FSL_LBC
diff --git a/drivers/uio/Makefile b/drivers/uio/Makefile
index c285dd2a4539..be2056cffc21 100644
--- a/drivers/uio/Makefile
+++ b/drivers/uio/Makefile
@@ -10,4 +10,5 @@ obj-$(CONFIG_UIO_NETX) += uio_netx.o
obj-$(CONFIG_UIO_PRUSS) += uio_pruss.o
obj-$(CONFIG_UIO_MF624) += uio_mf624.o
obj-$(CONFIG_UIO_FSL_ELBC_GPCM) += uio_fsl_elbc_gpcm.o
+obj-$(CONFIG_UIO_FSL_85XX_CACHE_SRAM) += uio_fsl_85xx_cache_sram.o
obj-$(CONFIG_UIO_HV_GENERIC) += uio_hv_generic.o
diff --git a/drivers/uio/uio_fsl_85xx_cache_sram.c b/drivers/uio/uio_fsl_85xx_cache_sram.c
new file mode 100644
index 000000000000..8701df695307
--- /dev/null
+++ b/drivers/uio/uio_fsl_85xx_cache_sram.c
@@ -0,0 +1,158 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2020 Vivo Communication Technology Co. Ltd.
+ * Copyright (C) 2020 Wang Wenhu <[email protected]>
+ * All rights reserved.
+ */
+
+#include <linux/platform_device.h>
+#include <linux/uio_driver.h>
+#include <linux/stringify.h>
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <asm/fsl_85xx_cache_sram.h>
+
+#define DRIVER_NAME "uio_fsl_85xx_cache_sram"
+#define UIO_INFO_VER "devicetree,pseudo"
+#define UIO_NAME "uio_cache_sram"
+
+static void uio_info_free_internal(struct uio_info *info)
+{
+ struct uio_mem *uiomem = info->mem;
+
+ while (uiomem < &info->mem[MAX_UIO_MAPS]) {
+ if (uiomem->internal_addr) {
+ mpc85xx_cache_sram_free(uiomem->internal_addr);
+ kfree(uiomem->name);
+ memset(uiomem, 0, sizeof(*uiomem));
+ }
+ uiomem++;
+ }
+
+ kfree(info->name);
+}
+
+static int uio_fsl_85xx_cache_sram_probe(struct platform_device *pdev)
+{
+ struct device_node *parent = pdev->dev.of_node;
+ struct device_node *node = NULL;
+ struct uio_info *info;
+ struct uio_mem *uiomem;
+ const char *dt_name;
+ u32 mem_size;
+ int ret;
+
+ /* alloc uio_info for one device */
+ info = kzalloc(sizeof(*info), GFP_KERNEL);
+ if (!info)
+ return -ENOMEM;
+
+ /* get optional uio name */
+ if (of_property_read_string(parent, "uio_name", &dt_name))
+ dt_name = UIO_NAME;
+
+ info->name = kstrdup(dt_name, GFP_KERNEL);
+ if (!info->name) {
+ ret = -ENOMEM;
+ goto err_info_free;
+ }
+
+ uiomem = info->mem;
+ for_each_child_of_node(parent, node) {
+ void *virt;
+ phys_addr_t phys;
+
+ ret = of_property_read_u32(node, "cache-mem-size", &mem_size);
+ if (ret) {
+ ret = -EINVAL;
+ goto err_info_free_internal;
+ }
+
+ if (mem_size == 0) {
+ dev_err(&pdev->dev, "cache-mem-size should not be 0\n");
+ ret = -EINVAL;
+ goto err_info_free_internal;
+ }
+
+ virt = mpc85xx_cache_sram_alloc(mem_size,
+ &phys,
+ roundup_pow_of_two(mem_size));
+ if (!virt) {
+ /* mpc85xx_cache_sram_alloc to define the real cause */
+ ret = -ENOMEM;
+ goto err_info_free_internal;
+ }
+
+ uiomem->memtype = UIO_MEM_PHYS;
+ uiomem->addr = phys;
+ uiomem->size = mem_size;
+ uiomem->name = kstrdup(node->name, GFP_KERNEL);;
+ uiomem->internal_addr = virt;
+ uiomem++;
+
+ if (uiomem >= &info->mem[MAX_UIO_MAPS]) {
+ dev_warn(&pdev->dev, "more than %d uio-maps for device.\n",
+ MAX_UIO_MAPS);
+ break;
+ }
+ }
+
+ if (uiomem == info->mem) {
+ dev_err(&pdev->dev, "error no valid uio-map configured\n");
+ ret = -EINVAL;
+ goto err_info_free_internal;
+ }
+
+ info->version = UIO_INFO_VER;
+
+ /* register uio device */
+ if (uio_register_device(&pdev->dev, info)) {
+ dev_err(&pdev->dev, "uio registration failed\n");
+ ret = -ENODEV;
+ goto err_info_free_internal;
+ }
+
+ platform_set_drvdata(pdev, info);
+
+ return 0;
+err_info_free_internal:
+ uio_info_free_internal(info);
+err_info_free:
+ kfree(info);
+ return ret;
+}
+
+static int uio_fsl_85xx_cache_sram_remove(struct platform_device *pdev)
+{
+ struct uio_info *info = platform_get_drvdata(pdev);
+
+ uio_unregister_device(info);
+
+ uio_info_free_internal(info);
+
+ kfree(info);
+
+ return 0;
+}
+
+static const struct of_device_id uio_mpc85xx_l2ctlr_of_match[] = {
+ { .compatible = "uio,mpc85xx-cache-sram", },
+ {},
+};
+
+static struct platform_driver uio_fsl_85xx_cache_sram = {
+ .probe = uio_fsl_85xx_cache_sram_probe,
+ .remove = uio_fsl_85xx_cache_sram_remove,
+ .driver = {
+ .name = DRIVER_NAME,
+ .owner = THIS_MODULE,
+ .of_match_table = uio_mpc85xx_l2ctlr_of_match,
+ },
+};
+
+module_platform_driver(uio_fsl_85xx_cache_sram);
+
+MODULE_AUTHOR("Wang Wenhu <[email protected]>");
+MODULE_DESCRIPTION("Freescale MPC85xx Cache-Sram UIO Platform Driver");
+MODULE_ALIAS("platform:" DRIVER_NAME);
+MODULE_LICENSE("GPL v2");
--
2.17.1

2020-04-16 08:39:51

by 王文虎

[permalink] [raw]
Subject: [PATCH v3,0/4] drivers: uio: new driver uio_fsl_85xx_cache_sram

This series add a new uio driver for freescale 85xx platforms to
access the Cache-Sram form user level. This is extremely helpful
for the user-space applications that require high performance memory
accesses.

It fixes the compile errors and warning of the hardware level drivers
and implements the uio driver in uio_fsl_85xx_cache_sram.c.

Changes since v1:
* Addressed comments from Greg K-H
* Moved kfree(info->name) into uio_info_free_internal()

Changes since v2:
* Drop the patch that modifies Kconfigs of arch/powerpc/platforms
and modified the sequence of patches:
01:dropped, 02->03, 03->02, 04->01, 05->04
* Addressed comments from Greg, Scott and Christophe
* Use "uiomem->internal_addr" as if condition for sram memory free,
and memset the uiomem entry
* Modified of_match_table make the driver apart from Cache-Sram HW info
which belong to the HW level driver fsl_85xx_cache_sram to match
* Use roundup_pow_of_two for align calc(really learned a lot from Christophe)
* Remove useless clear block of uiomem entries.
* Use UIO_INFO_VER micro for info->version, and define it as
"devicetree,pseudo", meaning this is pseudo device and probed from
device tree configuration
* Select FSL_85XX_CACHE_SRAM rather than depends on it

Wang Wenhu (4):
powerpc: sysdev: fix compile error for fsl_85xx_l2ctlr
powerpc: sysdev: fix compile error for fsl_85xx_cache_sram
powerpc: sysdev: fix compile warning for fsl_85xx_cache_sram
drivers: uio: new driver for fsl_85xx_cache_sram

arch/powerpc/sysdev/fsl_85xx_cache_sram.c | 3 +-
arch/powerpc/sysdev/fsl_85xx_l2ctlr.c | 1 +
drivers/uio/Kconfig | 9 ++
drivers/uio/Makefile | 1 +
drivers/uio/uio_fsl_85xx_cache_sram.c | 158 ++++++++++++++++++++++
5 files changed, 171 insertions(+), 1 deletion(-)
create mode 100644 drivers/uio/uio_fsl_85xx_cache_sram.c

--
2.17.1

2020-04-16 08:40:23

by 王文虎

[permalink] [raw]
Subject: [PATCH v3,4/4] drivers: uio: new driver for fsl_85xx_cache_sram

A driver for freescale 85xx platforms to access the Cache-Sram form
user level. This is extremely helpful for some user-space applications
that require high performance memory accesses.

Cc: Greg Kroah-Hartman <[email protected]>
Cc: Christophe Leroy <[email protected]>
Cc: Scott Wood <[email protected]>
Cc: Michael Ellerman <[email protected]>
Cc: [email protected]
Signed-off-by: Wang Wenhu <[email protected]>
---
Changes since v1:
* Addressed comments from Greg K-H
* Moved kfree(info->name) into uio_info_free_internal()
Changes since v2:
* Addressed comments from Greg, Scott and Christophe
* Use "uiomem->internal_addr" as if condition for sram memory free,
and memset the uiomem entry
* Modified of_match_table make the driver apart from Cache-Sram HW info
which belong to the HW level driver fsl_85xx_cache_sram to match
* Use roundup_pow_of_two for align calculation
* Remove useless clear block of uiomem entries.
* Use UIO_INFO_VER micro for info->version, and define it as
"devicetree,pseudo", meaning this is pseudo device and probed from
device tree configuration
* Select FSL_85XX_CACHE_SRAM rather than depends on it
---
drivers/uio/Kconfig | 9 ++
drivers/uio/Makefile | 1 +
drivers/uio/uio_fsl_85xx_cache_sram.c | 158 ++++++++++++++++++++++++++
3 files changed, 168 insertions(+)
create mode 100644 drivers/uio/uio_fsl_85xx_cache_sram.c

diff --git a/drivers/uio/Kconfig b/drivers/uio/Kconfig
index 202ee81cfc2b..9c3b47461b71 100644
--- a/drivers/uio/Kconfig
+++ b/drivers/uio/Kconfig
@@ -105,6 +105,15 @@ config UIO_NETX
To compile this driver as a module, choose M here; the module
will be called uio_netx.

+config UIO_FSL_85XX_CACHE_SRAM
+ tristate "Freescale 85xx Cache-Sram driver"
+ depends on FSL_SOC_BOOKE && PPC32
+ select FSL_85XX_CACHE_SRAM
+ help
+ Generic driver for accessing the Cache-Sram form user level. This
+ is extremely helpful for some user-space applications that require
+ high performance memory accesses.
+
config UIO_FSL_ELBC_GPCM
tristate "eLBC/GPCM driver"
depends on FSL_LBC
diff --git a/drivers/uio/Makefile b/drivers/uio/Makefile
index c285dd2a4539..be2056cffc21 100644
--- a/drivers/uio/Makefile
+++ b/drivers/uio/Makefile
@@ -10,4 +10,5 @@ obj-$(CONFIG_UIO_NETX) += uio_netx.o
obj-$(CONFIG_UIO_PRUSS) += uio_pruss.o
obj-$(CONFIG_UIO_MF624) += uio_mf624.o
obj-$(CONFIG_UIO_FSL_ELBC_GPCM) += uio_fsl_elbc_gpcm.o
+obj-$(CONFIG_UIO_FSL_85XX_CACHE_SRAM) += uio_fsl_85xx_cache_sram.o
obj-$(CONFIG_UIO_HV_GENERIC) += uio_hv_generic.o
diff --git a/drivers/uio/uio_fsl_85xx_cache_sram.c b/drivers/uio/uio_fsl_85xx_cache_sram.c
new file mode 100644
index 000000000000..8701df695307
--- /dev/null
+++ b/drivers/uio/uio_fsl_85xx_cache_sram.c
@@ -0,0 +1,158 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2020 Vivo Communication Technology Co. Ltd.
+ * Copyright (C) 2020 Wang Wenhu <[email protected]>
+ * All rights reserved.
+ */
+
+#include <linux/platform_device.h>
+#include <linux/uio_driver.h>
+#include <linux/stringify.h>
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <asm/fsl_85xx_cache_sram.h>
+
+#define DRIVER_NAME "uio_fsl_85xx_cache_sram"
+#define UIO_INFO_VER "devicetree,pseudo"
+#define UIO_NAME "uio_cache_sram"
+
+static void uio_info_free_internal(struct uio_info *info)
+{
+ struct uio_mem *uiomem = info->mem;
+
+ while (uiomem < &info->mem[MAX_UIO_MAPS]) {
+ if (uiomem->internal_addr) {
+ mpc85xx_cache_sram_free(uiomem->internal_addr);
+ kfree(uiomem->name);
+ memset(uiomem, 0, sizeof(*uiomem));
+ }
+ uiomem++;
+ }
+
+ kfree(info->name);
+}
+
+static int uio_fsl_85xx_cache_sram_probe(struct platform_device *pdev)
+{
+ struct device_node *parent = pdev->dev.of_node;
+ struct device_node *node = NULL;
+ struct uio_info *info;
+ struct uio_mem *uiomem;
+ const char *dt_name;
+ u32 mem_size;
+ int ret;
+
+ /* alloc uio_info for one device */
+ info = kzalloc(sizeof(*info), GFP_KERNEL);
+ if (!info)
+ return -ENOMEM;
+
+ /* get optional uio name */
+ if (of_property_read_string(parent, "uio_name", &dt_name))
+ dt_name = UIO_NAME;
+
+ info->name = kstrdup(dt_name, GFP_KERNEL);
+ if (!info->name) {
+ ret = -ENOMEM;
+ goto err_info_free;
+ }
+
+ uiomem = info->mem;
+ for_each_child_of_node(parent, node) {
+ void *virt;
+ phys_addr_t phys;
+
+ ret = of_property_read_u32(node, "cache-mem-size", &mem_size);
+ if (ret) {
+ ret = -EINVAL;
+ goto err_info_free_internal;
+ }
+
+ if (mem_size == 0) {
+ dev_err(&pdev->dev, "cache-mem-size should not be 0\n");
+ ret = -EINVAL;
+ goto err_info_free_internal;
+ }
+
+ virt = mpc85xx_cache_sram_alloc(mem_size,
+ &phys,
+ roundup_pow_of_two(mem_size));
+ if (!virt) {
+ /* mpc85xx_cache_sram_alloc to define the real cause */
+ ret = -ENOMEM;
+ goto err_info_free_internal;
+ }
+
+ uiomem->memtype = UIO_MEM_PHYS;
+ uiomem->addr = phys;
+ uiomem->size = mem_size;
+ uiomem->name = kstrdup(node->name, GFP_KERNEL);;
+ uiomem->internal_addr = virt;
+ uiomem++;
+
+ if (uiomem >= &info->mem[MAX_UIO_MAPS]) {
+ dev_warn(&pdev->dev, "more than %d uio-maps for device.\n",
+ MAX_UIO_MAPS);
+ break;
+ }
+ }
+
+ if (uiomem == info->mem) {
+ dev_err(&pdev->dev, "error no valid uio-map configured\n");
+ ret = -EINVAL;
+ goto err_info_free_internal;
+ }
+
+ info->version = UIO_INFO_VER;
+
+ /* register uio device */
+ if (uio_register_device(&pdev->dev, info)) {
+ dev_err(&pdev->dev, "uio registration failed\n");
+ ret = -ENODEV;
+ goto err_info_free_internal;
+ }
+
+ platform_set_drvdata(pdev, info);
+
+ return 0;
+err_info_free_internal:
+ uio_info_free_internal(info);
+err_info_free:
+ kfree(info);
+ return ret;
+}
+
+static int uio_fsl_85xx_cache_sram_remove(struct platform_device *pdev)
+{
+ struct uio_info *info = platform_get_drvdata(pdev);
+
+ uio_unregister_device(info);
+
+ uio_info_free_internal(info);
+
+ kfree(info);
+
+ return 0;
+}
+
+static const struct of_device_id uio_mpc85xx_l2ctlr_of_match[] = {
+ { .compatible = "uio,mpc85xx-cache-sram", },
+ {},
+};
+
+static struct platform_driver uio_fsl_85xx_cache_sram = {
+ .probe = uio_fsl_85xx_cache_sram_probe,
+ .remove = uio_fsl_85xx_cache_sram_remove,
+ .driver = {
+ .name = DRIVER_NAME,
+ .owner = THIS_MODULE,
+ .of_match_table = uio_mpc85xx_l2ctlr_of_match,
+ },
+};
+
+module_platform_driver(uio_fsl_85xx_cache_sram);
+
+MODULE_AUTHOR("Wang Wenhu <[email protected]>");
+MODULE_DESCRIPTION("Freescale MPC85xx Cache-Sram UIO Platform Driver");
+MODULE_ALIAS("platform:" DRIVER_NAME);
+MODULE_LICENSE("GPL v2");
--
2.17.1

2020-04-16 08:41:54

by 王文虎

[permalink] [raw]
Subject: [PATCH v3,3/4] powerpc: sysdev: fix compile warning for fsl_85xx_cache_sram

Function instantiate_cache_sram should not be linked into the init
section for its caller mpc85xx_l2ctlr_of_probe is none-__init.

Cc: Greg Kroah-Hartman <[email protected]>
Cc: Christophe Leroy <[email protected]>
Cc: Scott Wood <[email protected]>
Cc: Michael Ellerman <[email protected]>
Cc: [email protected]
Fixes: 6db92cc9d07d ("powerpc/85xx: add cache-sram support")
Signed-off-by: Wang Wenhu <[email protected]>

Warning information:
MODPOST vmlinux.o
WARNING: modpost: vmlinux.o(.text+0x1e540): Section mismatch in reference from the function mpc85xx_l2ctlr_of_probe() to the function .init.text:instantiate_cache_sram()
The function mpc85xx_l2ctlr_of_probe() references
the function __init instantiate_cache_sram().
This is often because mpc85xx_l2ctlr_of_probe lacks a __init
annotation or the annotation of instantiate_cache_sram is wrong.
---
Changes since v1:
* None
Changes since v2:
* None
---
arch/powerpc/sysdev/fsl_85xx_cache_sram.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/sysdev/fsl_85xx_cache_sram.c b/arch/powerpc/sysdev/fsl_85xx_cache_sram.c
index be3aef4229d7..3de5ac8382c0 100644
--- a/arch/powerpc/sysdev/fsl_85xx_cache_sram.c
+++ b/arch/powerpc/sysdev/fsl_85xx_cache_sram.c
@@ -68,7 +68,7 @@ void mpc85xx_cache_sram_free(void *ptr)
}
EXPORT_SYMBOL(mpc85xx_cache_sram_free);

-int __init instantiate_cache_sram(struct platform_device *dev,
+int instantiate_cache_sram(struct platform_device *dev,
struct sram_parameters sram_params)
{
int ret = 0;
--
2.17.1

2020-04-16 08:42:34

by 王文虎

[permalink] [raw]
Subject: [PATCH v3,1/4] powerpc: sysdev: fix compile error for fsl_85xx_l2ctlr

Include "linux/of_address.h" to fix the compile error for
mpc85xx_l2ctlr_of_probe() when compiling fsl_85xx_cache_sram.c.

CC arch/powerpc/sysdev/fsl_85xx_l2ctlr.o
arch/powerpc/sysdev/fsl_85xx_l2ctlr.c: In function ‘mpc85xx_l2ctlr_of_probe’:
arch/powerpc/sysdev/fsl_85xx_l2ctlr.c:90:11: error: implicit declaration of function ‘of_iomap’; did you mean ‘pci_iomap’? [-Werror=implicit-function-declaration]
l2ctlr = of_iomap(dev->dev.of_node, 0);
^~~~~~~~
pci_iomap
arch/powerpc/sysdev/fsl_85xx_l2ctlr.c:90:9: error: assignment makes pointer from integer without a cast [-Werror=int-conversion]
l2ctlr = of_iomap(dev->dev.of_node, 0);
^
cc1: all warnings being treated as errors
scripts/Makefile.build:267: recipe for target 'arch/powerpc/sysdev/fsl_85xx_l2ctlr.o' failed
make[2]: *** [arch/powerpc/sysdev/fsl_85xx_l2ctlr.o] Error 1

Cc: Greg Kroah-Hartman <[email protected]>
Cc: Christophe Leroy <[email protected]>
Cc: Scott Wood <[email protected]>
Cc: Michael Ellerman <[email protected]>
Cc: [email protected]
Fixes: 6db92cc9d07d ("powerpc/85xx: add cache-sram support")
Signed-off-by: Wang Wenhu <[email protected]>
---
Changes since v1:
* None
Changes since v2:
* None
---
arch/powerpc/sysdev/fsl_85xx_l2ctlr.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/arch/powerpc/sysdev/fsl_85xx_l2ctlr.c b/arch/powerpc/sysdev/fsl_85xx_l2ctlr.c
index 2d0af0c517bb..7533572492f0 100644
--- a/arch/powerpc/sysdev/fsl_85xx_l2ctlr.c
+++ b/arch/powerpc/sysdev/fsl_85xx_l2ctlr.c
@@ -10,6 +10,7 @@
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/of_platform.h>
+#include <linux/of_address.h>
#include <asm/io.h>

#include "fsl_85xx_cache_ctlr.h"
--
2.17.1

2020-04-16 08:43:27

by 王文虎

[permalink] [raw]
Subject: [PATCH v3,2/4] powerpc: sysdev: fix compile error for fsl_85xx_cache_sram

Include linux/io.h into fsl_85xx_cache_sram.c to fix the
implicit-declaration compile error when building Cache-Sram.

arch/powerpc/sysdev/fsl_85xx_cache_sram.c: In function ‘instantiate_cache_sram’:
arch/powerpc/sysdev/fsl_85xx_cache_sram.c:97:26: error: implicit declaration of function ‘ioremap_coherent’; did you mean ‘bitmap_complement’? [-Werror=implicit-function-declaration]
cache_sram->base_virt = ioremap_coherent(cache_sram->base_phys,
^~~~~~~~~~~~~~~~
bitmap_complement
arch/powerpc/sysdev/fsl_85xx_cache_sram.c:97:24: error: assignment makes pointer from integer without a cast [-Werror=int-conversion]
cache_sram->base_virt = ioremap_coherent(cache_sram->base_phys,
^
arch/powerpc/sysdev/fsl_85xx_cache_sram.c:123:2: error: implicit declaration of function ‘iounmap’; did you mean ‘roundup’? [-Werror=implicit-function-declaration]
iounmap(cache_sram->base_virt);
^~~~~~~
roundup
cc1: all warnings being treated as errors

Cc: Greg Kroah-Hartman <[email protected]>
Cc: Christophe Leroy <[email protected]>
Cc: Scott Wood <[email protected]>
Cc: Michael Ellerman <[email protected]>
Cc: [email protected]
Fixes: 6db92cc9d07d ("powerpc/85xx: add cache-sram support")
Signed-off-by: WANG Wenhu <[email protected]>
---
Changes since v1:
* None
Changes since v2:
* None
---
arch/powerpc/sysdev/fsl_85xx_cache_sram.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/arch/powerpc/sysdev/fsl_85xx_cache_sram.c b/arch/powerpc/sysdev/fsl_85xx_cache_sram.c
index f6c665dac725..be3aef4229d7 100644
--- a/arch/powerpc/sysdev/fsl_85xx_cache_sram.c
+++ b/arch/powerpc/sysdev/fsl_85xx_cache_sram.c
@@ -17,6 +17,7 @@
#include <linux/of_platform.h>
#include <asm/pgtable.h>
#include <asm/fsl_85xx_cache_sram.h>
+#include <linux/io.h>

#include "fsl_85xx_cache_ctlr.h"

--
2.17.1

2020-04-16 09:31:27

by 王文虎

[permalink] [raw]
Subject: Re:[PATCH v3,0/4] drivers: uio: new driver uio_fsl_85xx_cache_sram

Hi,
Seems there is something wrong with the server that multiple dumplications
of the v3 patches were sent out, please ignore the rest and take this newest
series as formal count.

Thanks,
Wenhu

From: Wang Wenhu <[email protected]>
Date: 2020-04-16 15:49:14
To: [email protected],[email protected],[email protected],[email protected],[email protected]
Cc: [email protected],Wang Wenhu <[email protected]>
Subject: [PATCH v3,0/4] drivers: uio: new driver uio_fsl_85xx_cache_sram>This series add a new uio driver for freescale 85xx platforms to
>access the Cache-Sram form user level. This is extremely helpful
>for the user-space applications that require high performance memory
>accesses.
>
>It fixes the compile errors and warning of the hardware level drivers
>and implements the uio driver in uio_fsl_85xx_cache_sram.c.
>
>Changes since v1:
> * Addressed comments from Greg K-H
> * Moved kfree(info->name) into uio_info_free_internal()
>
>Changes since v2:
> * Drop the patch that modifies Kconfigs of arch/powerpc/platforms
> and modified the sequence of patches:
> 01:dropped, 02->03, 03->02, 04->01, 05->04
> * Addressed comments from Greg, Scott and Christophe
> * Use "uiomem->internal_addr" as if condition for sram memory free,
> and memset the uiomem entry
> * Modified of_match_table make the driver apart from Cache-Sram HW info
> which belong to the HW level driver fsl_85xx_cache_sram to match
> * Use roundup_pow_of_two for align calc(really learned a lot from Christophe)
> * Remove useless clear block of uiomem entries.
> * Use UIO_INFO_VER micro for info->version, and define it as
> "devicetree,pseudo", meaning this is pseudo device and probed from
> device tree configuration
> * Select FSL_85XX_CACHE_SRAM rather than depends on it
>
>Wang Wenhu (4):
> powerpc: sysdev: fix compile error for fsl_85xx_l2ctlr
> powerpc: sysdev: fix compile error for fsl_85xx_cache_sram
> powerpc: sysdev: fix compile warning for fsl_85xx_cache_sram
> drivers: uio: new driver for fsl_85xx_cache_sram
>
> arch/powerpc/sysdev/fsl_85xx_cache_sram.c | 3 +-
> arch/powerpc/sysdev/fsl_85xx_l2ctlr.c | 1 +
> drivers/uio/Kconfig | 9 ++
> drivers/uio/Makefile | 1 +
> drivers/uio/uio_fsl_85xx_cache_sram.c | 158 ++++++++++++++++++++++
> 5 files changed, 171 insertions(+), 1 deletion(-)
> create mode 100644 drivers/uio/uio_fsl_85xx_cache_sram.c
>
>--
>2.17.1
>


2020-04-16 09:59:03

by 王文虎

[permalink] [raw]
Subject: [PATCH v3,0/4] drivers: uio: new driver uio_fsl_85xx_cache_sram

This series add a new uio driver for freescale 85xx platforms to
access the Cache-Sram form user level. This is extremely helpful
for the user-space applications that require high performance memory
accesses.

It fixes the compile errors and warning of the hardware level drivers
and implements the uio driver in uio_fsl_85xx_cache_sram.c.

Changes since v1:
* Addressed comments from Greg K-H
* Moved kfree(info->name) into uio_info_free_internal()

Changes since v2:
* Drop the patch that modifies Kconfigs of arch/powerpc/platforms
and modified the sequence of patches:
01:dropped, 02->03, 03->02, 04->01, 05->04
* Addressed comments from Greg, Scott and Christophe
* Use "uiomem->internal_addr" as if condition for sram memory free,
and memset the uiomem entry
* Modified of_match_table make the driver apart from Cache-Sram HW info
which belong to the HW level driver fsl_85xx_cache_sram to match
* Use roundup_pow_of_two for align calc(really learned a lot from Christophe)
* Remove useless clear block of uiomem entries.
* Use UIO_INFO_VER micro for info->version, and define it as
"devicetree,pseudo", meaning this is pseudo device and probed from
device tree configuration
* Select FSL_85XX_CACHE_SRAM rather than depends on it

Wang Wenhu (4):
powerpc: sysdev: fix compile error for fsl_85xx_l2ctlr
powerpc: sysdev: fix compile error for fsl_85xx_cache_sram
powerpc: sysdev: fix compile warning for fsl_85xx_cache_sram
drivers: uio: new driver for fsl_85xx_cache_sram

arch/powerpc/sysdev/fsl_85xx_cache_sram.c | 3 +-
arch/powerpc/sysdev/fsl_85xx_l2ctlr.c | 1 +
drivers/uio/Kconfig | 9 ++
drivers/uio/Makefile | 1 +
drivers/uio/uio_fsl_85xx_cache_sram.c | 158 ++++++++++++++++++++++
5 files changed, 171 insertions(+), 1 deletion(-)
create mode 100644 drivers/uio/uio_fsl_85xx_cache_sram.c

--
2.17.1

2020-04-16 09:59:19

by 王文虎

[permalink] [raw]
Subject: [PATCH v3,4/4] drivers: uio: new driver for fsl_85xx_cache_sram

A driver for freescale 85xx platforms to access the Cache-Sram form
user level. This is extremely helpful for some user-space applications
that require high performance memory accesses.

Cc: Greg Kroah-Hartman <[email protected]>
Cc: Christophe Leroy <[email protected]>
Cc: Scott Wood <[email protected]>
Cc: Michael Ellerman <[email protected]>
Cc: [email protected]
Signed-off-by: Wang Wenhu <[email protected]>
---
Changes since v1:
* Addressed comments from Greg K-H
* Moved kfree(info->name) into uio_info_free_internal()
Changes since v2:
* Addressed comments from Greg, Scott and Christophe
* Use "uiomem->internal_addr" as if condition for sram memory free,
and memset the uiomem entry
* Modified of_match_table make the driver apart from Cache-Sram HW info
which belong to the HW level driver fsl_85xx_cache_sram to match
* Use roundup_pow_of_two for align calculation
* Remove useless clear block of uiomem entries.
* Use UIO_INFO_VER micro for info->version, and define it as
"devicetree,pseudo", meaning this is pseudo device and probed from
device tree configuration
* Select FSL_85XX_CACHE_SRAM rather than depends on it
---
drivers/uio/Kconfig | 9 ++
drivers/uio/Makefile | 1 +
drivers/uio/uio_fsl_85xx_cache_sram.c | 158 ++++++++++++++++++++++++++
3 files changed, 168 insertions(+)
create mode 100644 drivers/uio/uio_fsl_85xx_cache_sram.c

diff --git a/drivers/uio/Kconfig b/drivers/uio/Kconfig
index 202ee81cfc2b..9c3b47461b71 100644
--- a/drivers/uio/Kconfig
+++ b/drivers/uio/Kconfig
@@ -105,6 +105,15 @@ config UIO_NETX
To compile this driver as a module, choose M here; the module
will be called uio_netx.

+config UIO_FSL_85XX_CACHE_SRAM
+ tristate "Freescale 85xx Cache-Sram driver"
+ depends on FSL_SOC_BOOKE && PPC32
+ select FSL_85XX_CACHE_SRAM
+ help
+ Generic driver for accessing the Cache-Sram form user level. This
+ is extremely helpful for some user-space applications that require
+ high performance memory accesses.
+
config UIO_FSL_ELBC_GPCM
tristate "eLBC/GPCM driver"
depends on FSL_LBC
diff --git a/drivers/uio/Makefile b/drivers/uio/Makefile
index c285dd2a4539..be2056cffc21 100644
--- a/drivers/uio/Makefile
+++ b/drivers/uio/Makefile
@@ -10,4 +10,5 @@ obj-$(CONFIG_UIO_NETX) += uio_netx.o
obj-$(CONFIG_UIO_PRUSS) += uio_pruss.o
obj-$(CONFIG_UIO_MF624) += uio_mf624.o
obj-$(CONFIG_UIO_FSL_ELBC_GPCM) += uio_fsl_elbc_gpcm.o
+obj-$(CONFIG_UIO_FSL_85XX_CACHE_SRAM) += uio_fsl_85xx_cache_sram.o
obj-$(CONFIG_UIO_HV_GENERIC) += uio_hv_generic.o
diff --git a/drivers/uio/uio_fsl_85xx_cache_sram.c b/drivers/uio/uio_fsl_85xx_cache_sram.c
new file mode 100644
index 000000000000..8701df695307
--- /dev/null
+++ b/drivers/uio/uio_fsl_85xx_cache_sram.c
@@ -0,0 +1,158 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2020 Vivo Communication Technology Co. Ltd.
+ * Copyright (C) 2020 Wang Wenhu <[email protected]>
+ * All rights reserved.
+ */
+
+#include <linux/platform_device.h>
+#include <linux/uio_driver.h>
+#include <linux/stringify.h>
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <asm/fsl_85xx_cache_sram.h>
+
+#define DRIVER_NAME "uio_fsl_85xx_cache_sram"
+#define UIO_INFO_VER "devicetree,pseudo"
+#define UIO_NAME "uio_cache_sram"
+
+static void uio_info_free_internal(struct uio_info *info)
+{
+ struct uio_mem *uiomem = info->mem;
+
+ while (uiomem < &info->mem[MAX_UIO_MAPS]) {
+ if (uiomem->internal_addr) {
+ mpc85xx_cache_sram_free(uiomem->internal_addr);
+ kfree(uiomem->name);
+ memset(uiomem, 0, sizeof(*uiomem));
+ }
+ uiomem++;
+ }
+
+ kfree(info->name);
+}
+
+static int uio_fsl_85xx_cache_sram_probe(struct platform_device *pdev)
+{
+ struct device_node *parent = pdev->dev.of_node;
+ struct device_node *node = NULL;
+ struct uio_info *info;
+ struct uio_mem *uiomem;
+ const char *dt_name;
+ u32 mem_size;
+ int ret;
+
+ /* alloc uio_info for one device */
+ info = kzalloc(sizeof(*info), GFP_KERNEL);
+ if (!info)
+ return -ENOMEM;
+
+ /* get optional uio name */
+ if (of_property_read_string(parent, "uio_name", &dt_name))
+ dt_name = UIO_NAME;
+
+ info->name = kstrdup(dt_name, GFP_KERNEL);
+ if (!info->name) {
+ ret = -ENOMEM;
+ goto err_info_free;
+ }
+
+ uiomem = info->mem;
+ for_each_child_of_node(parent, node) {
+ void *virt;
+ phys_addr_t phys;
+
+ ret = of_property_read_u32(node, "cache-mem-size", &mem_size);
+ if (ret) {
+ ret = -EINVAL;
+ goto err_info_free_internal;
+ }
+
+ if (mem_size == 0) {
+ dev_err(&pdev->dev, "cache-mem-size should not be 0\n");
+ ret = -EINVAL;
+ goto err_info_free_internal;
+ }
+
+ virt = mpc85xx_cache_sram_alloc(mem_size,
+ &phys,
+ roundup_pow_of_two(mem_size));
+ if (!virt) {
+ /* mpc85xx_cache_sram_alloc to define the real cause */
+ ret = -ENOMEM;
+ goto err_info_free_internal;
+ }
+
+ uiomem->memtype = UIO_MEM_PHYS;
+ uiomem->addr = phys;
+ uiomem->size = mem_size;
+ uiomem->name = kstrdup(node->name, GFP_KERNEL);;
+ uiomem->internal_addr = virt;
+ uiomem++;
+
+ if (uiomem >= &info->mem[MAX_UIO_MAPS]) {
+ dev_warn(&pdev->dev, "more than %d uio-maps for device.\n",
+ MAX_UIO_MAPS);
+ break;
+ }
+ }
+
+ if (uiomem == info->mem) {
+ dev_err(&pdev->dev, "error no valid uio-map configured\n");
+ ret = -EINVAL;
+ goto err_info_free_internal;
+ }
+
+ info->version = UIO_INFO_VER;
+
+ /* register uio device */
+ if (uio_register_device(&pdev->dev, info)) {
+ dev_err(&pdev->dev, "uio registration failed\n");
+ ret = -ENODEV;
+ goto err_info_free_internal;
+ }
+
+ platform_set_drvdata(pdev, info);
+
+ return 0;
+err_info_free_internal:
+ uio_info_free_internal(info);
+err_info_free:
+ kfree(info);
+ return ret;
+}
+
+static int uio_fsl_85xx_cache_sram_remove(struct platform_device *pdev)
+{
+ struct uio_info *info = platform_get_drvdata(pdev);
+
+ uio_unregister_device(info);
+
+ uio_info_free_internal(info);
+
+ kfree(info);
+
+ return 0;
+}
+
+static const struct of_device_id uio_mpc85xx_l2ctlr_of_match[] = {
+ { .compatible = "uio,mpc85xx-cache-sram", },
+ {},
+};
+
+static struct platform_driver uio_fsl_85xx_cache_sram = {
+ .probe = uio_fsl_85xx_cache_sram_probe,
+ .remove = uio_fsl_85xx_cache_sram_remove,
+ .driver = {
+ .name = DRIVER_NAME,
+ .owner = THIS_MODULE,
+ .of_match_table = uio_mpc85xx_l2ctlr_of_match,
+ },
+};
+
+module_platform_driver(uio_fsl_85xx_cache_sram);
+
+MODULE_AUTHOR("Wang Wenhu <[email protected]>");
+MODULE_DESCRIPTION("Freescale MPC85xx Cache-Sram UIO Platform Driver");
+MODULE_ALIAS("platform:" DRIVER_NAME);
+MODULE_LICENSE("GPL v2");
--
2.17.1

2020-04-16 09:59:19

by 王文虎

[permalink] [raw]
Subject: [PATCH v3,3/4] powerpc: sysdev: fix compile warning for fsl_85xx_cache_sram

Function instantiate_cache_sram should not be linked into the init
section for its caller mpc85xx_l2ctlr_of_probe is none-__init.

Cc: Greg Kroah-Hartman <[email protected]>
Cc: Christophe Leroy <[email protected]>
Cc: Scott Wood <[email protected]>
Cc: Michael Ellerman <[email protected]>
Cc: [email protected]
Fixes: 6db92cc9d07d ("powerpc/85xx: add cache-sram support")
Signed-off-by: Wang Wenhu <[email protected]>

Warning information:
MODPOST vmlinux.o
WARNING: modpost: vmlinux.o(.text+0x1e540): Section mismatch in reference from the function mpc85xx_l2ctlr_of_probe() to the function .init.text:instantiate_cache_sram()
The function mpc85xx_l2ctlr_of_probe() references
the function __init instantiate_cache_sram().
This is often because mpc85xx_l2ctlr_of_probe lacks a __init
annotation or the annotation of instantiate_cache_sram is wrong.
---
Changes since v1:
* None
Changes since v2:
* None
---
arch/powerpc/sysdev/fsl_85xx_cache_sram.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/sysdev/fsl_85xx_cache_sram.c b/arch/powerpc/sysdev/fsl_85xx_cache_sram.c
index be3aef4229d7..3de5ac8382c0 100644
--- a/arch/powerpc/sysdev/fsl_85xx_cache_sram.c
+++ b/arch/powerpc/sysdev/fsl_85xx_cache_sram.c
@@ -68,7 +68,7 @@ void mpc85xx_cache_sram_free(void *ptr)
}
EXPORT_SYMBOL(mpc85xx_cache_sram_free);

-int __init instantiate_cache_sram(struct platform_device *dev,
+int instantiate_cache_sram(struct platform_device *dev,
struct sram_parameters sram_params)
{
int ret = 0;
--
2.17.1

2020-04-16 09:59:41

by 王文虎

[permalink] [raw]
Subject: [PATCH v3,2/4] powerpc: sysdev: fix compile error for fsl_85xx_cache_sram

Include linux/io.h into fsl_85xx_cache_sram.c to fix the
implicit-declaration compile error when building Cache-Sram.

arch/powerpc/sysdev/fsl_85xx_cache_sram.c: In function ‘instantiate_cache_sram’:
arch/powerpc/sysdev/fsl_85xx_cache_sram.c:97:26: error: implicit declaration of function ‘ioremap_coherent’; did you mean ‘bitmap_complement’? [-Werror=implicit-function-declaration]
cache_sram->base_virt = ioremap_coherent(cache_sram->base_phys,
^~~~~~~~~~~~~~~~
bitmap_complement
arch/powerpc/sysdev/fsl_85xx_cache_sram.c:97:24: error: assignment makes pointer from integer without a cast [-Werror=int-conversion]
cache_sram->base_virt = ioremap_coherent(cache_sram->base_phys,
^
arch/powerpc/sysdev/fsl_85xx_cache_sram.c:123:2: error: implicit declaration of function ‘iounmap’; did you mean ‘roundup’? [-Werror=implicit-function-declaration]
iounmap(cache_sram->base_virt);
^~~~~~~
roundup
cc1: all warnings being treated as errors

Cc: Greg Kroah-Hartman <[email protected]>
Cc: Christophe Leroy <[email protected]>
Cc: Scott Wood <[email protected]>
Cc: Michael Ellerman <[email protected]>
Cc: [email protected]
Fixes: 6db92cc9d07d ("powerpc/85xx: add cache-sram support")
Signed-off-by: WANG Wenhu <[email protected]>
---
Changes since v1:
* None
Changes since v2:
* None
---
arch/powerpc/sysdev/fsl_85xx_cache_sram.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/arch/powerpc/sysdev/fsl_85xx_cache_sram.c b/arch/powerpc/sysdev/fsl_85xx_cache_sram.c
index f6c665dac725..be3aef4229d7 100644
--- a/arch/powerpc/sysdev/fsl_85xx_cache_sram.c
+++ b/arch/powerpc/sysdev/fsl_85xx_cache_sram.c
@@ -17,6 +17,7 @@
#include <linux/of_platform.h>
#include <asm/pgtable.h>
#include <asm/fsl_85xx_cache_sram.h>
+#include <linux/io.h>

#include "fsl_85xx_cache_ctlr.h"

--
2.17.1

2020-04-16 11:23:15

by 王文虎

[permalink] [raw]
Subject: Re: [PATCH v3,0/4] drivers: uio: new driver uio_fsl_85xx_cache_sram

Hi,
From: Christophe Leroy <[email protected]>
Date: 2020-04-16 18:36:38
To:"王文虎" <[email protected]>
cc: [email protected],[email protected],[email protected],[email protected],[email protected]
Subject: Re: [PATCH v3,0/4] drivers: uio: new driver uio_fsl_85xx_cache_sram>
>
>Le 16/04/2020 à 11:29, 王文虎 a écrit :
>> Hi,
>> Seems there is something wrong with the server that multiple dumplications
>> of the v3 patches were sent out, please ignore the rest and take this newest
>> series as formal count.
>
>Which series ?
>
>It seems you sent 3 times, at 9:29, 9:41 and 9:49 (Paris Time)
>
> From the series of 9:29, I received patches 0 to 3
> From the series of 9:41, I received patches 0 to 3
> From the series of 9:49, I received patches 0 and 4.
>
>Looks like powerpc patchwork
>(https://patchwork.ozlabs.org/project/linuxppc-dev/list/?submitter=78320)
>got:
> From the series of 9:29, I received patches 0 to 4
> From the series of 9:41, I received patches 1 to 4
> From the series of 9:49, I received patches 1 to 4
>
>So this seems to be something wrong somewhere.
>
>Christophe
>

Hi Christophe,
Sorry again, and I don't know which best fit you all. I guess a RESEND tag might help.
So I will send another series with RESEND tag, please just drop all this three.

Hope that relly won't trouble you yelling, and hope the mail server would work well.

Thanks,
Wenhu
>>
>> From: Wang Wenhu <[email protected]>
>> Date: 2020-04-16 15:49:14
>> To: [email protected],[email protected],[email protected],[email protected],[email protected]
>> Cc: [email protected],Wang Wenhu <[email protected]>
>> Subject: [PATCH v3,0/4] drivers: uio: new driver uio_fsl_85xx_cache_sram>This series add a new uio driver for freescale 85xx platforms to
>>> access the Cache-Sram form user level. This is extremely helpful
>>> for the user-space applications that require high performance memory
>>> accesses.
>>>
>>> It fixes the compile errors and warning of the hardware level drivers
>>> and implements the uio driver in uio_fsl_85xx_cache_sram.c.
>>>
>>> Changes since v1:
>>> * Addressed comments from Greg K-H
>>> * Moved kfree(info->name) into uio_info_free_internal()
>>>
>>> Changes since v2:
>>> * Drop the patch that modifies Kconfigs of arch/powerpc/platforms
>>> and modified the sequence of patches:
>>> 01:dropped, 02->03, 03->02, 04->01, 05->04
>>> * Addressed comments from Greg, Scott and Christophe
>>> * Use "uiomem->internal_addr" as if condition for sram memory free,
>>> and memset the uiomem entry
>>> * Modified of_match_table make the driver apart from Cache-Sram HW info
>>> which belong to the HW level driver fsl_85xx_cache_sram to match
>>> * Use roundup_pow_of_two for align calc(really learned a lot from Christophe)
>>> * Remove useless clear block of uiomem entries.
>>> * Use UIO_INFO_VER micro for info->version, and define it as
>>> "devicetree,pseudo", meaning this is pseudo device and probed from
>>> device tree configuration
>>> * Select FSL_85XX_CACHE_SRAM rather than depends on it
>>>
>>> Wang Wenhu (4):
>>> powerpc: sysdev: fix compile error for fsl_85xx_l2ctlr
>>> powerpc: sysdev: fix compile error for fsl_85xx_cache_sram
>>> powerpc: sysdev: fix compile warning for fsl_85xx_cache_sram
>>> drivers: uio: new driver for fsl_85xx_cache_sram
>>>
>>> arch/powerpc/sysdev/fsl_85xx_cache_sram.c | 3 +-
>>> arch/powerpc/sysdev/fsl_85xx_l2ctlr.c | 1 +
>>> drivers/uio/Kconfig | 9 ++
>>> drivers/uio/Makefile | 1 +
>>> drivers/uio/uio_fsl_85xx_cache_sram.c | 158 ++++++++++++++++++++++
>>> 5 files changed, 171 insertions(+), 1 deletion(-)
>>> create mode 100644 drivers/uio/uio_fsl_85xx_cache_sram.c
>>>
>>> --
>>> 2.17.1
>>>
>>
>>


2020-04-16 16:56:10

by Christophe Leroy

[permalink] [raw]
Subject: Re: [PATCH v3,0/4] drivers: uio: new driver uio_fsl_85xx_cache_sram



Le 16/04/2020 à 11:29, 王文虎 a écrit :
> Hi,
> Seems there is something wrong with the server that multiple dumplications
> of the v3 patches were sent out, please ignore the rest and take this newest
> series as formal count.

Which series ?

It seems you sent 3 times, at 9:29, 9:41 and 9:49 (Paris Time)

From the series of 9:29, I received patches 0 to 3
From the series of 9:41, I received patches 0 to 3
From the series of 9:49, I received patches 0 and 4.

Looks like powerpc patchwork
(https://patchwork.ozlabs.org/project/linuxppc-dev/list/?submitter=78320)
got:
From the series of 9:29, I received patches 0 to 4
From the series of 9:41, I received patches 1 to 4
From the series of 9:49, I received patches 1 to 4

So this seems to be something wrong somewhere.

Christophe


>
> Thanks,
> Wenhu
>
> From: Wang Wenhu <[email protected]>
> Date: 2020-04-16 15:49:14
> To: [email protected],[email protected],[email protected],[email protected],[email protected]
> Cc: [email protected],Wang Wenhu <[email protected]>
> Subject: [PATCH v3,0/4] drivers: uio: new driver uio_fsl_85xx_cache_sram>This series add a new uio driver for freescale 85xx platforms to
>> access the Cache-Sram form user level. This is extremely helpful
>> for the user-space applications that require high performance memory
>> accesses.
>>
>> It fixes the compile errors and warning of the hardware level drivers
>> and implements the uio driver in uio_fsl_85xx_cache_sram.c.
>>
>> Changes since v1:
>> * Addressed comments from Greg K-H
>> * Moved kfree(info->name) into uio_info_free_internal()
>>
>> Changes since v2:
>> * Drop the patch that modifies Kconfigs of arch/powerpc/platforms
>> and modified the sequence of patches:
>> 01:dropped, 02->03, 03->02, 04->01, 05->04
>> * Addressed comments from Greg, Scott and Christophe
>> * Use "uiomem->internal_addr" as if condition for sram memory free,
>> and memset the uiomem entry
>> * Modified of_match_table make the driver apart from Cache-Sram HW info
>> which belong to the HW level driver fsl_85xx_cache_sram to match
>> * Use roundup_pow_of_two for align calc(really learned a lot from Christophe)
>> * Remove useless clear block of uiomem entries.
>> * Use UIO_INFO_VER micro for info->version, and define it as
>> "devicetree,pseudo", meaning this is pseudo device and probed from
>> device tree configuration
>> * Select FSL_85XX_CACHE_SRAM rather than depends on it
>>
>> Wang Wenhu (4):
>> powerpc: sysdev: fix compile error for fsl_85xx_l2ctlr
>> powerpc: sysdev: fix compile error for fsl_85xx_cache_sram
>> powerpc: sysdev: fix compile warning for fsl_85xx_cache_sram
>> drivers: uio: new driver for fsl_85xx_cache_sram
>>
>> arch/powerpc/sysdev/fsl_85xx_cache_sram.c | 3 +-
>> arch/powerpc/sysdev/fsl_85xx_l2ctlr.c | 1 +
>> drivers/uio/Kconfig | 9 ++
>> drivers/uio/Makefile | 1 +
>> drivers/uio/uio_fsl_85xx_cache_sram.c | 158 ++++++++++++++++++++++
>> 5 files changed, 171 insertions(+), 1 deletion(-)
>> create mode 100644 drivers/uio/uio_fsl_85xx_cache_sram.c
>>
>> --
>> 2.17.1
>>
>
>