diff mbox series

hdata: Ensure the prd-label hbrt-code-image is prefixed

Message ID 20200717040903.1192849-1-oohall@gmail.com
State Accepted
Headers show
Series hdata: Ensure the prd-label hbrt-code-image is prefixed | expand

Checks

Context Check Description
snowpatch_ozlabs/apply_patch success Successfully applied on branch master (abe4c4799ffee4be12674ad59fc0bc521b0724f3)
snowpatch_ozlabs/snowpatch_job_snowpatch-skiboot success Test snowpatch/job/snowpatch-skiboot on branch master
snowpatch_ozlabs/snowpatch_job_snowpatch-skiboot-dco success Signed-off-by present

Commit Message

Oliver O'Halloran July 17, 2020, 4:09 a.m. UTC
Older versions of opal-prd (i.e. most of them shipped by distros)
expect the HBRT image to have the PRD label of "ibm,hbrt-code-image".
Commit c3bfa3209559 ("hdata: Fix reserved node label search") made
opal-prd check for both strings, but since opal-prd itself is the only
component interested in locating the hbrt-code-image we might as well
just add the prefix in firmware.

Cc: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
---
 hdata/memory.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Vasant Hegde July 20, 2020, 5:45 a.m. UTC | #1
On 7/17/20 9:39 AM, Oliver O'Halloran wrote:
> Older versions of opal-prd (i.e. most of them shipped by distros)
> expect the HBRT image to have the PRD label of "ibm,hbrt-code-image".
> Commit c3bfa3209559 ("hdata: Fix reserved node label search") made
> opal-prd check for both strings, but since opal-prd itself is the only
> component interested in locating the hbrt-code-image we might as well
> just add the prefix in firmware.
> 
> Cc: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
> Signed-off-by: Oliver O'Halloran <oohall@gmail.com>

Patch looks good to me. May be we should make below change as well.. so that 
`opal-prd`
search for `ibm,hbrt-code-image` first.

diff --git a/external/opal-prd/opal-prd.c b/external/opal-prd/opal-prd.c
index 40e5a9841..665005434 100644
--- a/external/opal-prd/opal-prd.c
+++ b/external/opal-prd/opal-prd.c
@@ -2192,10 +2192,9 @@ static int run_prd_daemon(struct opal_prd_ctx *ctx)
                         goto out_close;
                 }
         } else {
-               rc = map_hbrt_physmem(ctx, hbrt_code_region_name);
+               rc = map_hbrt_physmem(ctx, hbrt_code_region_name_ibm);
                 if (rc) {
-                       /* Fallback to old style ibm,prd-label */
-                       rc = map_hbrt_physmem(ctx, hbrt_code_region_name_ibm);
+                       rc = map_hbrt_physmem(ctx, hbrt_code_region_name);
                         if (rc) {
                                 pr_log(LOG_ERR, "IMAGE: Can't access hbrt "
                                                 "physical memory");


-Vasant
Oliver O'Halloran July 20, 2020, 5:48 a.m. UTC | #2
On Mon, Jul 20, 2020 at 3:46 PM Vasant Hegde
<hegdevasant@linux.vnet.ibm.com> wrote:
>
> On 7/17/20 9:39 AM, Oliver O'Halloran wrote:
> > Older versions of opal-prd (i.e. most of them shipped by distros)
> > expect the HBRT image to have the PRD label of "ibm,hbrt-code-image".
> > Commit c3bfa3209559 ("hdata: Fix reserved node label search") made
> > opal-prd check for both strings, but since opal-prd itself is the only
> > component interested in locating the hbrt-code-image we might as well
> > just add the prefix in firmware.
> >
> > Cc: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
> > Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
>
> Patch looks good to me. May be we should make below change as well.. so that
> `opal-prd`
> search for `ibm,hbrt-code-image` first.

Can't hurt. Send a patch :)
diff mbox series

Patch

diff --git a/hdata/memory.c b/hdata/memory.c
index 5b1a05d23371..0d9486b92ac2 100755
--- a/hdata/memory.c
+++ b/hdata/memory.c
@@ -827,6 +827,15 @@  static void get_hb_reserved_mem(struct HDIF_common_hdr *ms_vpd)
 		dt_add_property_cells(node, "ibm,prd-instance",
 			(be32_to_cpu(hb_resv_mem->type_instance) & 0xffffff));
 
+		/*
+		 * Most reservations are used by HBRT itself so we should leave
+		 * the label as-is. The exception is hbrt-code-image which is
+		 * used by opal-prd to locate the HBRT image. Older versions
+		 * of opal-prd expect this to be "ibm,hbrt-code-image" so make
+		 * sure the prefix is there.
+		 */
+		if (!strcmp(label, "hbrt-code-image"))
+			strcpy(label, "ibm,hbrt-code-image");
 		dt_add_property_string(node, "ibm,prd-label", label);
 	}
 }