diff mbox

[v2] core/init: Add hdat-map property to OPAL node

Message ID 20170302034955.12688-1-matthew.brown.dev@gmail.com
State Superseded
Headers show

Commit Message

Matt Brown March 2, 2017, 3:49 a.m. UTC
Exports the HDAT heap to the OS. This allows the OS to view the HDAT heap
directly.  This allows us to view the HDAT area without having to use
getmemproc.

Signed-off-by: Matt Brown <matthew.brown.dev@gmail.com>
---
Changes between v1 and v2:
	- added exports node to opal/firmware
	- added all attributes to be exported to the opal/firmware/exports node

---
 core/opal.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

Comments

Oliver O'Halloran March 2, 2017, 4:03 a.m. UTC | #1
On Thu, Mar 2, 2017 at 2:49 PM, Matt Brown <matthew.brown.dev@gmail.com> wrote:
> Exports the HDAT heap to the OS. This allows the OS to view the HDAT heap
> directly.  This allows us to view the HDAT area without having to use
> getmemproc.
>
> Signed-off-by: Matt Brown <matthew.brown.dev@gmail.com>
> ---
> Changes between v1 and v2:
>         - added exports node to opal/firmware
>         - added all attributes to be exported to the opal/firmware/exports node
>
> ---
>  core/opal.c | 16 +++++++++++++++-
>  1 file changed, 15 insertions(+), 1 deletion(-)
>
> diff --git a/core/opal.c b/core/opal.c
> index 6087e65..9c8b97b 100644
> --- a/core/opal.c
> +++ b/core/opal.c
> @@ -121,13 +121,27 @@ void __opal_register(uint64_t token, void *func, unsigned int nargs)
>
>  static void add_opal_firmware_node(void)
>  {
> -       struct dt_node *firmware = dt_new(opal_node, "firmware");
>         uint64_t sym_start = (uint64_t)__sym_map_start;
>         uint64_t sym_size = (uint64_t)__sym_map_end - sym_start;
> +       struct dt_node *firmware = dt_new(opal_node, "firmware");
> +
This looks superfluous.

>         dt_add_property_string(firmware, "compatible", "ibm,opal-firmware");
>         dt_add_property_string(firmware, "name", "firmware");
>         dt_add_property_string(firmware, "version", version);

>         dt_add_property_u64s(firmware, "symbol-map", sym_start, sym_size);
Can you add a comment explaining that this needs to be here for
backwards compatibility?

> +
> +       add_opal_firmware_exports_node(firmware);
> +}
> +
> +static void add_opal_firmware_exports_node(struct dt_node *node)
> +{
> +       struct dt_node *exports = dt_new(node, "exports");
> +       uint64_t sym_start = (uint64_t)__sym_map_start;
> +       uint64_t sym_size = (uint64_t)__sym_map_end - sym_start;
> +
> +       dt_add_property_u64s(exports, "symbol-map", sym_start, sym_size);
> +       dt_add_property_u64s(exports, "hdat-map", SPIRA_HEAP_BASE,
> +                               SPIRA_HEAP_SIZE);
>  }

Can you add some documentation about how the bindings work here? If we
want new exports to be handled automatically by the OS we should be
explicit about the the property format.

>
>  void add_opal_node(void)
> --
> 2.9.3
>
> _______________________________________________
> Skiboot mailing list
> Skiboot@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/skiboot
diff mbox

Patch

diff --git a/core/opal.c b/core/opal.c
index 6087e65..9c8b97b 100644
--- a/core/opal.c
+++ b/core/opal.c
@@ -121,13 +121,27 @@  void __opal_register(uint64_t token, void *func, unsigned int nargs)
 
 static void add_opal_firmware_node(void)
 {
-	struct dt_node *firmware = dt_new(opal_node, "firmware");
 	uint64_t sym_start = (uint64_t)__sym_map_start;
 	uint64_t sym_size = (uint64_t)__sym_map_end - sym_start;
+	struct dt_node *firmware = dt_new(opal_node, "firmware");
+
 	dt_add_property_string(firmware, "compatible", "ibm,opal-firmware");
 	dt_add_property_string(firmware, "name", "firmware");
 	dt_add_property_string(firmware, "version", version);
 	dt_add_property_u64s(firmware, "symbol-map", sym_start, sym_size);
+
+	add_opal_firmware_exports_node(firmware);
+}
+
+static void add_opal_firmware_exports_node(struct dt_node *node)
+{
+	struct dt_node *exports = dt_new(node, "exports");
+	uint64_t sym_start = (uint64_t)__sym_map_start;
+	uint64_t sym_size = (uint64_t)__sym_map_end - sym_start;
+
+	dt_add_property_u64s(exports, "symbol-map", sym_start, sym_size);
+	dt_add_property_u64s(exports, "hdat-map", SPIRA_HEAP_BASE,
+				SPIRA_HEAP_SIZE);
 }
 
 void add_opal_node(void)