Shovel firmware specific code to appropriate locations
Subsystems (4)
Sakari Ailus
reviewerv2 cover Shovel firmware specific code to appropriate locations
Hi folks,
This set moves the implementation of recently added device property API functions to OF and ACPI frameworks, where the rest of such functionality resides.
Compile tested.
The dependencies can be found in Rafael's devprop branch now.
changes since v1:
- Drop wrongly placed Depends-on: tag from the first patch.
- Drop IS_ENABLED(CONFIG_OF_ADDRESS) && is_of_node(fwnode) check (3rd patch).
Sakari Ailus (4):
device property: Convert device_{dma_supported,get_dma_attr} to fwnode
ACPI: property: Move acpi_fwnode_device_get_match_data() up device property: Add iomap to fwnode operations
device property: Add irq_get to fwnode operation
drivers/acpi/property.c | 36 +++++++++++++++++++++++++++++++---- drivers/base/property.c | 42 ++++++----------------------------------- drivers/of/property.c | 30 +++++++++++++++++++++++++++++ include/linux/fwnode.h | 5 +++++ 4 files changed, 73 insertions(+), 40 deletions(-)
Signature · 1 line
2.30.2
Sakari Ailus
reviewerPATCH v2 1/4 device property: Convert device_{dma_supported,get_dma_attr} to fwnode
Make the device_dma_supported and device_get_dma_attr functions to use the fwnode ops, and move the implementation to ACPI and OF frameworks.
--- drivers/acpi/property.c | 14 ++++++++++++++ drivers/base/property.c | 25 ++++--------------------- drivers/of/property.c | 17 +++++++++++++++++ include/linux/fwnode.h | 3 +++ 4 files changed, 38 insertions(+), 21 deletions(-)
drivers/acpi/property.c +14 -0
@@ -1253,6 +1253,17 @@ static bool acpi_fwnode_device_is_available(const struct fwnode_handle *fwnode)return acpi_device_is_present (to_acpi_device_node (fwnode)); } +static bool acpi_fwnode_device_dma_supported (const struct fwnode_handle *fwnode) +{ +return acpi_dma_supported (to_acpi_device_node (fwnode)); +} + +static enum dev_dma_attr +acpi_fwnode_device_get_dma_attr (const struct fwnode_handle *fwnode) +{ +return acpi_get_dma_attr (to_acpi_device_node (fwnode)); +} +static bool acpi_fwnode_property_present (const struct fwnode_handle *fwnode,const char *propname) {
@@ -1384,6 +1395,9 @@ acpi_fwnode_device_get_match_data(const struct fwnode_handle *fwnode,const struct fwnode_operations ops = { \ .device_is_available = acpi_fwnode_device_is_available, \ .device_get_match_data = acpi_fwnode_device_get_match_data, \ + .device_dma_supported = \ + acpi_fwnode_device_dma_supported, \ + .device_get_dma_attr = acpi_fwnode_device_get_dma_attr, \ .property_present = acpi_fwnode_property_present, \ .property_read_int_array = \ acpi_fwnode_property_read_int_array, \
drivers/base/property.c +4 -21
@@ -823,33 +823,16 @@ EXPORT_SYMBOL_GPL(device_get_child_node_count);bool device_dma_supported (struct device *dev) { -const struct fwnode_handle *fwnode =dev_fwnode (dev); - -/* For DT, this is always supported. -* For ACPI, this depends on CCA, which -* is determined by the acpi_dma_supported(). -*/ -if (is_of_node (fwnode)) -return true; - -return acpi_dma_supported (to_acpi_device_node (fwnode)); +return fwnode_call_bool_op (dev_fwnode (dev), device_dma_supported); }EXPORT_SYMBOL_GPL (device_dma_supported);enum dev_dma_attr device_get_dma_attr (struct device *dev) { -const struct fwnode_handle *fwnode =dev_fwnode (dev); -enum dev_dma_attr attr =DEV_DMA_NOT_SUPPORTED ; - -if (is_of_node (fwnode)) { -if (of_dma_is_coherent (to_of_node (fwnode))) - attr =DEV_DMA_COHERENT ; -else - attr =DEV_DMA_NON_COHERENT ; - }else - attr =acpi_get_dma_attr (to_acpi_device_node (fwnode)); +if (!fwnode_has_op (dev_fwnode (dev), device_get_dma_attr)) +return DEV_DMA_NOT_SUPPORTED ; -return attr; +return fwnode_call_int_op (dev_fwnode (dev), device_get_dma_attr); }EXPORT_SYMBOL_GPL (device_get_dma_attr);
drivers/of/property.c +17 -0
@@ -22,6 +22,7 @@#define pr_fmt (fmt) "OF: " fmt#include <linux/of.h> +#include <linux/of_address.h> #include <linux/of_device.h> #include <linux/of_graph.h> #include <linux/of_irq.h>
@@ -872,6 +873,20 @@ static bool of_fwnode_device_is_available(const struct fwnode_handle *fwnode)return of_device_is_available (to_of_node (fwnode)); } +static bool of_fwnode_device_dma_supported (const struct fwnode_handle *fwnode) +{ +return true; +} + +static enum dev_dma_attr +of_fwnode_device_get_dma_attr (const struct fwnode_handle *fwnode) +{ +if (of_dma_is_coherent (to_of_node (fwnode))) +return DEV_DMA_COHERENT ; +else +return DEV_DMA_NON_COHERENT ; +} +static bool of_fwnode_property_present (const struct fwnode_handle *fwnode,const char *propname) {
@@ -1472,6 +1487,8 @@ const struct fwnode_operations of_fwnode_ops = { .put = of_fwnode_put, .device_is_available = of_fwnode_device_is_available, .device_get_match_data = of_fwnode_device_get_match_data, + .device_dma_supported = of_fwnode_device_dma_supported, + .device_get_dma_attr = of_fwnode_device_get_dma_attr, .property_present = of_fwnode_property_present, .property_read_int_array = of_fwnode_property_read_int_array, .property_read_string_array = of_fwnode_property_read_string_array,
include/linux/fwnode.h +3 -0
@@ -113,6 +113,9 @@ struct fwnode_operations {bool (*device_is_available)(const struct fwnode_handle *fwnode);const void *(*device_get_match_data)(const struct fwnode_handle *fwnode,const struct device *dev); +bool (*device_dma_supported)(const struct fwnode_handle *fwnode); +enum dev_dma_attr + (*device_get_dma_attr)(const struct fwnode_handle *fwnode);bool (*property_present)(const struct fwnode_handle *fwnode,const char *propname); int (*property_read_int_array)(const struct fwnode_handle *fwnode,
Signature · 1 line
2.30.2
Sakari Ailus
reviewerPATCH v2 2/4 ACPI: property: Move acpi_fwnode_device_get_match_data() up
In reply to Sakari AilusMove acpi_fwnode_device_get_match_data() up below acpi_fwnode_device_is_available() so the order matches that in struct fwnode_operations.
--- drivers/acpi/property.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/acpi/property.c +7 -7
@@ -1253,6 +1253,13 @@ static bool acpi_fwnode_device_is_available(const struct fwnode_handle *fwnode)return acpi_device_is_present (to_acpi_device_node (fwnode)); } +static const void * +acpi_fwnode_device_get_match_data (const struct fwnode_handle *fwnode, +const struct device *dev) +{ +return acpi_device_get_match_data (dev); +} +static bool acpi_fwnode_device_dma_supported (const struct fwnode_handle *fwnode) {return acpi_dma_supported (to_acpi_device_node (fwnode));
@@ -1384,13 +1391,6 @@ static int acpi_fwnode_graph_parse_endpoint(const struct fwnode_handle *fwnode,return 0 ; } -static const void * -acpi_fwnode_device_get_match_data (const struct fwnode_handle *fwnode, -const struct device *dev) -{ -return acpi_device_get_match_data (dev); -} -#define DECLARE_ACPI_FWNODE_OPS (ops) \ const struct fwnode_operations ops = { \ .device_is_available = acpi_fwnode_device_is_available, \
Signature · 1 line
2.30.2
Sakari Ailus
reviewerPATCH v2 3/4 device property: Add iomap to fwnode operations
In reply to Sakari AilusAdd iomap() fwnode operation to implement fwnode_iomap() through fwnode operations, moving the code in fwnode_iomap() to OF framework.
Note that the IS_ENABLED(CONFIG_OF_ADDRESS) && is_of_node(fwnode) check is needed for Sparc that has its own implementation of of_iomap anyway. Remove that check.
--- drivers/base/property.c | 5 +---- drivers/of/property.c | 6 ++++++ include/linux/fwnode.h | 1 + 3 files changed, 8 insertions(+), 4 deletions(-)
drivers/base/property.c +1 -4
@@ -887,10 +887,7 @@ EXPORT_SYMBOL_GPL(device_get_phy_mode);*/ void __iomem *fwnode_iomap (struct fwnode_handle *fwnode,int index) { -if (IS_ENABLED (CONFIG_OF_ADDRESS ) &&is_of_node (fwnode)) -return of_iomap (to_of_node (fwnode), index); - -return NULL ; +return fwnode_call_ptr_op (fwnode, iomap, index); }EXPORT_SYMBOL (fwnode_iomap);
drivers/of/property.c +6 -0
@@ -1465,6 +1465,11 @@ static int of_link_property(struct device_node *con_np, const char *prop_name)return 0 ; } +static void __iomem *of_fwnode_iomap (struct fwnode_handle *fwnode,int index) +{ +return of_iomap (to_of_node (fwnode), index); +} +static int of_fwnode_add_links (struct fwnode_handle *fwnode) {struct property *p;
@@ -1502,6 +1507,7 @@ const struct fwnode_operations of_fwnode_ops = { .graph_get_remote_endpoint = of_fwnode_graph_get_remote_endpoint, .graph_get_port_parent = of_fwnode_graph_get_port_parent, .graph_parse_endpoint = of_fwnode_graph_parse_endpoint, + .iomap = of_fwnode_iomap, .add_links = of_fwnode_add_links, };EXPORT_SYMBOL_GPL (of_fwnode_ops);
include/linux/fwnode.h +1 -0
@@ -148,6 +148,7 @@ struct fwnode_operations { (*graph_get_port_parent)(struct fwnode_handle *fwnode);int (*graph_parse_endpoint)(const struct fwnode_handle *fwnode,struct fwnode_endpoint *endpoint); +void __iomem *(*iomap)(struct fwnode_handle *fwnode,int index);int (*add_links)(struct fwnode_handle *fwnode); };
Signature · 1 line
2.30.2
kernel test robot
build botRe: [PATCH v2 3/4] device property: Add iomap to fwnode operations
I love your patch! Yet something to improve:
Hi Sakari,
I love your patch! Yet something to improve:
[auto build test ERROR on rafael-pm/linux-next]
[also build test ERROR on next-20220323]
[cannot apply to driver-core/driver-core-testing robh/for-next v5.17] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Sakari-Ailus/Shovel-firmware-specific-code-to-appropriate-locations/20220324-000256 base: https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next config: s390-allmodconfig (https://download.01.org/0day-ci/archive/20220324/[email protected]/config) compiler: s390-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/c9025bc8f89f50eaf9b9d628f1ac5d47b77c6bc8
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Sakari-Ailus/Shovel-firmware-specific-code-to-appropriate-locations/20220324-000256 git checkout c9025bc8f89f50eaf9b9d628f1ac5d47b77c6bc8
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=s390 SHELL=/bin/bash
If you fix the issue, kindly add following tag as appropriate
All errors (new ones prefixed by >>):
s390-linux-ld: kernel/dma/coherent.o: in function `dma_init_coherent_memory':
coherent.c:(.text+0x122): undefined reference to `memremap'
s390-linux-ld: coherent.c:(.text+0x230): undefined reference to `memunmap'
s390-linux-ld: kernel/dma/coherent.o: in function `dma_declare_coherent_memory':
coherent.c:(.text+0x69c): undefined reference to `memunmap'
s390-linux-ld: drivers/irqchip/irq-al-fic.o: in function `al_fic_init_dt':
irq-al-fic.c:(.init.text+0x7e): undefined reference to `of_iomap'
s390-linux-ld: irq-al-fic.c:(.init.text+0x502): undefined reference to `iounmap'
s390-linux-ld: drivers/clk/clk-fixed-mmio.o: in function `fixed_mmio_clk_setup':
clk-fixed-mmio.c:(.text+0x90): undefined reference to `of_iomap'
s390-linux-ld: clk-fixed-mmio.c:(.text+0xcc): undefined reference to `iounmap'
s390-linux-ld: drivers/clocksource/timer-of.o: in function `timer_of_init':
timer-of.c:(.init.text+0x144): undefined reference to `of_iomap'
s390-linux-ld: timer-of.c:(.init.text+0x76c): undefined reference to `iounmap'
s390-linux-ld: drivers/clocksource/timer-of.o: in function `timer_of_cleanup':
timer-of.c:(.init.text+0x960): undefined reference to `iounmap'
s390-linux-ld: drivers/clocksource/timer-microchip-pit64b.o: in function `mchp_pit64b_dt_init_timer':
timer-microchip-pit64b.c:(.init.text+0x67c): undefined reference to `of_iomap'
s390-linux-ld: timer-microchip-pit64b.c:(.init.text+0xcd2): undefined reference to `iounmap'
s390-linux-ld: drivers/of/property.o: in function `of_fwnode_iomap':
>> property.c:(.text+0x1b8c): undefined reference to `of_iomap'
Signature · 2 lines
0-DAY CI Kernel Test Service https://01.org/lkp
Andy Shevchenko
reviewerRe: [PATCH v2 3/4] device property: Add iomap to fwnode operations
Quoted 3 lines · kernel test robot
Hi Sakari,
I love your patch! Yet something to improve:
...
Quoted 12 lines
compiler: s390-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/c9025bc8f89f50eaf9b9d628f1ac5d47b77c6bc8
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Sakari-Ailus/Shovel-firmware-specific-code-to-appropriate-locations/20220324-000256 git checkoutc9025bc8f89f50eaf9b9d628f1ac5d47b77c6bc8
# save the config file to linux build tree
mkdirbuild_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=s390 SHELL=/bin/bash
Quoted 4 lines
If you fix the issue, kindly add following tag as appropriate
Reported-by kernel test robot <[email protected]>All errors (new ones prefixed by >>):
Seems it needs some ifdeffery to be added.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Sakari Ailus
reviewerRe: [PATCH v2 3/4] device property: Add iomap to fwnode operations
Quoted 19 lines · Andy Shevchenko
Quoted 3 lines · kernel test robot
Hi Sakari,
I love your patch! Yet something to improve:
...
Quoted 12 lines
compiler: s390-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/c9025bc8f89f50eaf9b9d628f1ac5d47b77c6bc8
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Sakari-Ailus/Shovel-firmware-specific-code-to-appropriate-locations/20220324-000256 git checkoutc9025bc8f89f50eaf9b9d628f1ac5d47b77c6bc8
# save the config file to linux build tree
mkdirbuild_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=s390 SHELL=/bin/bash
Quoted 6 lines
Quoted 4 lines
If you fix the issue, kindly add following tag as appropriate
Reported-by kernel test robot <[email protected]>All errors (new ones prefixed by >>):
Seems it needs some ifdeffery to be added.
Yeah. What surprises me though is there seem to be quite a few other sources of such warnings, too.
Signature · 1 line
Sakari Ailus
Sakari Ailus
reviewerPATCH v2 4/4 device property: Add irq_get to fwnode operation
In reply to Sakari AilusAdd irq_get() fwnode operation to implement fwnode_irq_get() through fwnode operations, moving the code in fwnode_irq_get() to OF and ACPI frameworks.
--- drivers/acpi/property.c | 14 ++++++++++++++ drivers/base/property.c | 12 +----------- drivers/of/property.c | 7 +++++++ include/linux/fwnode.h | 1 + 4 files changed, 23 insertions(+), 11 deletions(-)
drivers/acpi/property.c +14 -0
@@ -1391,6 +1391,19 @@ static int acpi_fwnode_graph_parse_endpoint(const struct fwnode_handle *fwnode,return 0 ; } +static int acpi_fwnode_irq_get (const struct fwnode_handle *fwnode, +unsigned int index) +{ +struct resource res; +int ret; + + ret =acpi_irq_get (ACPI_HANDLE_FWNODE (fwnode), index, &res); +if (ret) +return ret; + +return res.start; +} +#define DECLARE_ACPI_FWNODE_OPS (ops) \ const struct fwnode_operations ops = { \ .device_is_available = acpi_fwnode_device_is_available, \
@@ -1415,6 +1428,7 @@ static int acpi_fwnode_graph_parse_endpoint(const struct fwnode_handle *fwnode, acpi_graph_get_remote_endpoint, \ .graph_get_port_parent = acpi_fwnode_get_parent, \ .graph_parse_endpoint = acpi_fwnode_graph_parse_endpoint, \ + .irq_get = acpi_fwnode_irq_get, \ }; \EXPORT_SYMBOL_GPL (ops)
drivers/base/property.c +1 -11
@@ -901,17 +901,7 @@ EXPORT_SYMBOL(fwnode_iomap);*/ int fwnode_irq_get (const struct fwnode_handle *fwnode,unsigned int index) { -struct resource res; -int ret; - -if (is_of_node (fwnode)) -return of_irq_get (to_of_node (fwnode), index); - - ret =acpi_irq_get (ACPI_HANDLE_FWNODE (fwnode), index, &res); -if (ret) -return ret; - -return res.start; +return fwnode_call_int_op (fwnode, irq_get, index); }EXPORT_SYMBOL (fwnode_irq_get);
drivers/of/property.c +7 -0
@@ -1470,6 +1470,12 @@ static void __iomem *of_fwnode_iomap(struct fwnode_handle *fwnode, int index)return of_iomap (to_of_node (fwnode), index); } +static int of_fwnode_irq_get (const struct fwnode_handle *fwnode, +unsigned int index) +{ +return of_irq_get (to_of_node (fwnode), index); +} +static int of_fwnode_add_links (struct fwnode_handle *fwnode) {struct property *p;
@@ -1508,6 +1514,7 @@ const struct fwnode_operations of_fwnode_ops = { .graph_get_port_parent = of_fwnode_graph_get_port_parent, .graph_parse_endpoint = of_fwnode_graph_parse_endpoint, .iomap = of_fwnode_iomap, + .irq_get = of_fwnode_irq_get, .add_links = of_fwnode_add_links, };EXPORT_SYMBOL_GPL (of_fwnode_ops);
include/linux/fwnode.h +1 -0
@@ -149,6 +149,7 @@ struct fwnode_operations {int (*graph_parse_endpoint)(const struct fwnode_handle *fwnode,struct fwnode_endpoint *endpoint);void __iomem *(*iomap)(struct fwnode_handle *fwnode,int index); +int (*irq_get)(const struct fwnode_handle *fwnode,unsigned int index);int (*add_links)(struct fwnode_handle *fwnode); };
Signature · 1 line
2.30.2
Andy Shevchenko
reviewerQuoted 7 lines · Sakari Ailus
Hi folks,
This set moves the implementation of recently added device property API functions to OF and ACPI frameworks, where the rest of such functionality resides.
Compile tested.
Thanks!
It would be nice to use --base when creating a cover letter. Because it has been sent during merge window, I'm not sure what base you have chosen for it (v5.17 or latest Linus' master or ...).
Quoted 20 lines
The dependencies can be found in Rafael's devprop branch now.
changes since v1:
- Drop wrongly placed Depends-on: tag from the first patch.
- Drop
IS_ENABLED(CONFIG_OF_ADDRESS)&&is_of_node(fwnode)check (3rd patch).Sakari Ailus (4):
device property: Convert device_{dma_supported,get_dma_attr} to fwnode
ACPI: property: Moveacpi_fwnode_device_get_match_data()up device property: Add iomap to fwnode operations
device property: Addirq_getto fwnode operationdrivers/acpi/property.c | 36 +++++++++++++++++++++++++++++++---- drivers/base/property.c | 42 ++++++----------------------------------- drivers/of/property.c | 30 +++++++++++++++++++++++++++++ include/linux/fwnode.h | 5 +++++ 4 files changed, 73 insertions(+), 40 deletions(-)
Signature · 2 lines
With Best Regards, Andy Shevchenko
Sakari Ailus
reviewerQuoted 7 lines · Andy Shevchenko
Quoted 6 lines · Sakari Ailus
Hi folks,
This set moves the implementation of recently added device property API functions to OF and ACPI frameworks, where the rest of such functionality resides.
Quoted 8 lines
Quoted 1 line
Compile tested.
Thanks!
It would be nice to use --base when creating a cover letter. Because it has been sent during merge window, I'm not sure what base you have chosen for it (v5.17 or latest Linus' master or ...).
As noted below, Rafael's devprop branch. But I'll use --base on the next time. It seems v3 will be needed in any case.
Quoted 27 lines
Quoted 21 lines
The dependencies can be found in Rafael's devprop branch now.
changes since v1:
- Drop wrongly placed Depends-on: tag from the first patch.
- Drop
IS_ENABLED(CONFIG_OF_ADDRESS)&&is_of_node(fwnode)check (3rd patch).Sakari Ailus (4):
device property: Convert device_{dma_supported,get_dma_attr} to fwnode
ACPI: property: Moveacpi_fwnode_device_get_match_data()up device property: Add iomap to fwnode operations
device property: Addirq_getto fwnode operationdrivers/acpi/property.c | 36 +++++++++++++++++++++++++++++++---- drivers/base/property.c | 42 ++++++----------------------------------- drivers/of/property.c | 30 +++++++++++++++++++++++++++++ include/linux/fwnode.h | 5 +++++ 4 files changed, 73 insertions(+), 40 deletions(-)Signature · 2 lines
With Best Regards, Andy Shevchenko
Signature · 1 line
Sakari Ailus