diff mbox series

[2/2] powerpc/powernv: Use common code for the symbol_map export

Message ID 20191004084335.16157-2-oohall@gmail.com (mailing list archive)
State Superseded
Headers show
Series [1/2] powerpc/powernv: Rework exports to support subnodes | expand

Checks

Context Check Description
snowpatch_ozlabs/apply_patch success Successfully applied on branch next (6edfc6487b474fe01857dc3f1a9cd701bb9b21c8)
snowpatch_ozlabs/build-ppc64le fail build failed!
snowpatch_ozlabs/build-ppc64be fail build failed!
snowpatch_ozlabs/build-ppc64e success Build succeeded
snowpatch_ozlabs/build-pmac32 success Build succeeded
snowpatch_ozlabs/checkpatch success total: 0 errors, 0 warnings, 0 checks, 65 lines checked

Commit Message

Oliver O'Halloran Oct. 4, 2019, 8:43 a.m. UTC
Long before we had a generic way for firmware to export memory ranges of
interest we added a special case for the skiboot symbol map. The code is
pretty much identical to the generic export so re-use the code.

Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
---
 arch/powerpc/platforms/powernv/opal.c | 47 +++++++----------------------------
 1 file changed, 9 insertions(+), 38 deletions(-)

Comments

Oliver O'Halloran Oct. 4, 2019, 9:44 a.m. UTC | #1
On Fri, Oct 4, 2019 at 7:24 PM kbuild test robot <lkp@intel.com> wrote:
>
> Hi Oliver,
>
> I love your patch! Yet something to improve:
>
> [auto build test ERROR on powerpc/next]
> [cannot apply to v5.4-rc1 next-20191004]
> [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/Oliver-O-Halloran/powerpc-powernv-Rework-exports-to-support-subnodes/20191004-165257
> 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) 7.4.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
>         GCC_VERSION=7.4.0 make.cross ARCH=powerpc
>
> If you fix the issue, kindly add following tag
> Reported-by: kbuild test robot <lkp@intel.com>
>
> All errors (new ones prefixed by >>):
>
>    arch/powerpc/platforms/powernv/opal.c: In function 'opal_export_attrs':
> >> arch/powerpc/platforms/powernv/opal.c:817:2: error: 'rc' undeclared (first use in this function); did you mean 'rq'?
>      rc = opal_add_one_export(opal_kobj, "symbol_map",
>      ^~
>      rq
>    arch/powerpc/platforms/powernv/opal.c:817:2: note: each undeclared identifier is reported only once for each function it appears in
>

I really need to start checking stuff still compiles after a rebase

*sigh*

>    787
>    788  /*
>    789   * opal_export_attrs: creates a sysfs node for each property listed in
>    790   * the device-tree under /ibm,opal/firmware/exports/
>    791   * All new sysfs nodes are created under /opal/exports/.
>    792   * This allows for reserved memory regions (e.g. HDAT) to be read.
>    793   * The new sysfs nodes are only readable by root.
>    794   */
>    795  static void opal_export_attrs(void)
>    796  {
>    797          struct device_node *np;
>    798          struct kobject *kobj;
>    799
>    800          np = of_find_node_by_path("/ibm,opal/firmware/exports");
>    801          if (!np)
>    802                  return;
>    803
>    804          /* Create new 'exports' directory - /sys/firmware/opal/exports */
>    805          kobj = kobject_create_and_add("exports", opal_kobj);
>    806          if (!kobj) {
>    807                  pr_warn("kobject_create_and_add() of exports failed\n");
>    808                  return;
>    809          }
>    810
>    811          opal_add_exported_attrs(np, kobj);
>    812
>    813          /*
>    814           * NB: symbol_map existed before the generic export interface so it
>    815           * lives under the top level opal_kobj.
>    816           */
>  > 817          rc = opal_add_one_export(opal_kobj, "symbol_map",
>    818                                   np->parent, "symbol-map");
>    819          if (rc)
>    820                  pr_warn("Error %d creating OPAL symbols file\n", rc);
>    821
>    822          of_node_put(np);
>    823  }
>    824
>
> ---
> 0-DAY kernel test infrastructure                Open Source Technology Center
> https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
diff mbox series

Patch

diff --git a/arch/powerpc/platforms/powernv/opal.c b/arch/powerpc/platforms/powernv/opal.c
index 0373da5..1ef26e2 100644
--- a/arch/powerpc/platforms/powernv/opal.c
+++ b/arch/powerpc/platforms/powernv/opal.c
@@ -708,42 +708,6 @@  static int opal_sysfs_init(void)
 	return 0;
 }
 
-static ssize_t symbol_map_read(struct file *fp, struct kobject *kobj,
-			       struct bin_attribute *bin_attr,
-			       char *buf, loff_t off, size_t count)
-{
-	return memory_read_from_buffer(buf, count, &off, bin_attr->private,
-				       bin_attr->size);
-}
-
-static struct bin_attribute symbol_map_attr = {
-	.attr = {.name = "symbol_map", .mode = 0400},
-	.read = symbol_map_read
-};
-
-static void opal_export_symmap(void)
-{
-	const __be64 *syms;
-	unsigned int size;
-	struct device_node *fw;
-	int rc;
-
-	fw = of_find_node_by_path("/ibm,opal/firmware");
-	if (!fw)
-		return;
-	syms = of_get_property(fw, "symbol-map", &size);
-	if (!syms || size != 2 * sizeof(__be64))
-		return;
-
-	/* Setup attributes */
-	symbol_map_attr.private = __va(be64_to_cpu(syms[0]));
-	symbol_map_attr.size = be64_to_cpu(syms[1]);
-
-	rc = sysfs_create_bin_file(opal_kobj, &symbol_map_attr);
-	if (rc)
-		pr_warn("Error %d creating OPAL symbols file\n", rc);
-}
-
 static ssize_t export_attr_read(struct file *fp, struct kobject *kobj,
 				struct bin_attribute *bin_attr, char *buf,
 				loff_t off, size_t count)
@@ -846,6 +810,15 @@  static void opal_export_attrs(void)
 
 	opal_add_exported_attrs(np, kobj);
 
+	/*
+	 * NB: symbol_map existed before the generic export interface so it
+	 * lives under the top level opal_kobj.
+	 */
+	rc = opal_add_one_export(opal_kobj, "symbol_map",
+				 np->parent, "symbol-map");
+	if (rc)
+		pr_warn("Error %d creating OPAL symbols file\n", rc);
+
 	of_node_put(np);
 }
 
@@ -991,8 +964,6 @@  static int __init opal_init(void)
 	/* Create "opal" kobject under /sys/firmware */
 	rc = opal_sysfs_init();
 	if (rc == 0) {
-		/* Export symbol map to userspace */
-		opal_export_symmap();
 		/* Setup dump region interface */
 		opal_dump_region_init();
 		/* Setup error log interface */