diff mbox

[01/14] hdat: Add new fields to IPL params structure

Message ID 58771D30.2030804@linux.vnet.ibm.com
State Accepted
Headers show

Commit Message

Vasant Hegde Jan. 12, 2017, 6:07 a.m. UTC
On 01/12/2017 09:24 AM, Oliver O'Halloran wrote:
> From: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
>
> Add new fields to sys params structure and update sys family for p9.
>
> In P9 the compatible string is supplied by hostboot through the HDAT.
> This patch add support for using these strings to set the compatible
> property in the device tree rather than using the machine ID number
> scheme traditionally used in the HDAT.
>
> [removed ibm,firenze from, add some prints - Oliver]
> Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
> [Folded Oliver's changes to original patch - Vasant]
> Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
> ---
>   hdata/spira.c | 63 +++++++++++++++++++++++++++++++++++++----------------------
>   hdata/spira.h | 28 +++++++++++++++++++++++++-
>   2 files changed, 67 insertions(+), 24 deletions(-)
>
> diff --git a/hdata/spira.c b/hdata/spira.c
> index f87aa2712023..a19b4db92a8a 100644
> --- a/hdata/spira.c
> +++ b/hdata/spira.c
> @@ -756,8 +756,6 @@ static void add_nx(void)
>   static void add_iplparams_sys_params(const void *iplp, struct dt_node *node)
>   {
>   	const struct iplparams_sysparams *p;
> -	u32 sys_type;
> -	const char *sys_family;
>   	const struct HDIF_common_hdr *hdif = iplp;
>   	u16 version = be16_to_cpu(hdif->version);
>
> @@ -776,29 +774,48 @@ static void add_iplparams_sys_params(const void *iplp, struct dt_node *node)
>
>   	dt_add_property_nstr(node, "ibm,sys-model", p->sys_model, 4);
>
> -	/* Compatible is 2 entries: ibm,powernv and ibm,<platform>
> +	/*
> +	 * Compatible has up to three entries:
> +	 *	"ibm,powernv", the system family and system type.
> +	 *
> +	 * On P9 and above the family and type strings come from the HDAT
> +	 * directly. On P8 we find it from the system ID numbers.
>   	 */
> -	sys_type = be32_to_cpu(p->system_type);
> -	switch(sys_type >> 28) {
> -	case 0:
> -		sys_family = "ibm,squadrons";
> -		break;
> -	case 1:
> -		sys_family = "ibm,eclipz";
> -		break;
> -	case 2:
> -		sys_family = "ibm,apollo";
> -		break;
> -	case 3:
> -		sys_family = "ibm,firenze";
> -		break;
> -	default:
> -		sys_family = NULL;
> -		prerror("IPLPARAMS: Unknown system family\n");
> -		break;
> +	if (proc_gen >= proc_gen_p9) {
> +		dt_add_property_strings(dt_root, "compatible", "ibm,powernv",
> +					p->sys_family_str, p->sys_type_str);
> +
> +		prlog(PR_INFO, "IPLPARAMS: v0x70 Platform family/type: %s/%s\n",
> +		      p->sys_family_str, p->sys_type_str);
> +	} else {
> +		u32 sys_type = be32_to_cpu(p->system_type);
> +		const char *sys_family;
> +
> +		switch (sys_type >> 28) {
> +		case 0:
> +			sys_family = "ibm,squadrons";
> +			break;
> +		case 1:
> +			sys_family = "ibm,eclipz";
> +			break;
> +		case 2:
> +			sys_family = "ibm,apollo";
> +			break;
> +		case 3:
> +			sys_family = "ibm,firenze";
> +			break;
> +		default:
> +			sys_family = NULL;
> +			prerror("IPLPARAMS: Unknown system family\n");
> +			break;
> +		}
> +
> +		dt_add_property_strings(dt_root, "compatible", "ibm,powernv",
> +					sys_family);
> +		prlog(PR_INFO,
> +		      "IPLPARAMS: Legacy platform family: %s"
> +		      " (sys_type=0x%08x)\n", sys_family, sys_type);

Now like me you are also started breaking test cases ;-)

Can you please update test case?


>   	}
> -	dt_add_property_strings(dt_root, "compatible", "ibm,powernv",
> -				sys_family);
>
>   	/* Grab nest frequency when available */
>   	if (version >= 0x005b) {
> diff --git a/hdata/spira.h b/hdata/spira.h
> index eae7ac909d7c..b04a3df33f73 100644
> --- a/hdata/spira.h
> +++ b/hdata/spira.h
> @@ -323,6 +323,17 @@ struct iplparams_sysparams {
>   	uint8_t		hw_page_table_size;	/* >= 0x59 */
>   	__be16		hv_disp_wheel;		/* >= 0x58 */
>   	__be32		nest_freq_mhz;		/* >= 0x5b */
> +	uint8_t		split_core_mode;	/* >= 0x5c */
> +	uint8_t		reserved[3];
> +	uint8_t		sys_vendor[64];		/* >= 0x5f */
> +	/* >= 0x60 */
> +	__be16		sys_sec_setting;
> +	__be16		tpm_config_bit;
> +	__be16		tpm_drawer;
> +	__be16		reserved2;
> +	uint8_t		hw_key_hash[64];
> +	uint8_t		sys_family_str[64];	/* vendor,name */
> +	uint8_t		sys_type_str[64];	/* vendor,type */
>   } __packed;
>
>   /* Idata index 1: IPL parameters */
> @@ -351,7 +362,11 @@ struct iplparams_iplparams {
>   	uint8_t		huge_page_size;
>   #define IPLPARAMS_HUGE_PG_SIZE_16G	0
>   	uint8_t		num_vlan_switches;
> -	__be64		reserved2;
> +	__be32		reserved2;
> +	__be32		enlarge_io;	/* >= 0x5a */
> +	uint8_t		core_config;
> +#define IPLPARAMS_CORE_NORMAL	0x00
> +#define IPLPARAMS_CORE_FUSE	0x01
>   };
>
>   /* Idata index 4: Platform Dump Descriptor */
> @@ -461,6 +476,17 @@ struct msvpd_pmover_bsr_synchro {
>
>   /* Idata index 4: UE Address Array */
>
> +/* Idata index 5: Hostboot reserved memory address range */
> +#define MSVPD_IDATA_HB_RESERVED_MEM	5
> +struct msvpd_hb_reserved_mem {
> +	__be32		node_instance;
> +	__be64		start_addr;
> +	__be64		end_addr;
> +	__be32		label_size;
> +	uint8_t		label[64];
> +	__be64		reserved;
> +};
> +

I think we should move this hunk to next patch as its related to hostboot 
memory. Otherwise I'm fine with this patch.

-Vasant

Comments

Vasant Hegde Jan. 12, 2017, 6:11 a.m. UTC | #1
On 01/12/2017 11:37 AM, Vasant Hegde wrote:
> On 01/12/2017 09:24 AM, Oliver O'Halloran wrote:
>> From: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
>>
>> Add new fields to sys params structure and update sys family for p9.
>>
>> In P9 the compatible string is supplied by hostboot through the HDAT.
>> This patch add support for using these strings to set the compatible
>> property in the device tree rather than using the machine ID number
>> scheme traditionally used in the HDAT.
>>
>> [removed ibm,firenze from, add some prints - Oliver]
>> Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
>> [Folded Oliver's changes to original patch - Vasant]
>> Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
>> ---
>>   hdata/spira.c | 63 +++++++++++++++++++++++++++++++++++++----------------------
>>   hdata/spira.h | 28 +++++++++++++++++++++++++-
>>   2 files changed, 67 insertions(+), 24 deletions(-)
>>
>> diff --git a/hdata/spira.c b/hdata/spira.c
>> index f87aa2712023..a19b4db92a8a 100644
>> --- a/hdata/spira.c
>> +++ b/hdata/spira.c
>> @@ -756,8 +756,6 @@ static void add_nx(void)
>>   static void add_iplparams_sys_params(const void *iplp, struct dt_node *node)
>>   {
>>       const struct iplparams_sysparams *p;
>> -    u32 sys_type;
>> -    const char *sys_family;
>>       const struct HDIF_common_hdr *hdif = iplp;
>>       u16 version = be16_to_cpu(hdif->version);
>>
>> @@ -776,29 +774,48 @@ static void add_iplparams_sys_params(const void *iplp,
>> struct dt_node *node)
>>
>>       dt_add_property_nstr(node, "ibm,sys-model", p->sys_model, 4);
>>
>> -    /* Compatible is 2 entries: ibm,powernv and ibm,<platform>
>> +    /*
>> +     * Compatible has up to three entries:
>> +     *    "ibm,powernv", the system family and system type.
>> +     *
>> +     * On P9 and above the family and type strings come from the HDAT
>> +     * directly. On P8 we find it from the system ID numbers.
>>        */
>> -    sys_type = be32_to_cpu(p->system_type);
>> -    switch(sys_type >> 28) {
>> -    case 0:
>> -        sys_family = "ibm,squadrons";
>> -        break;
>> -    case 1:
>> -        sys_family = "ibm,eclipz";
>> -        break;
>> -    case 2:
>> -        sys_family = "ibm,apollo";
>> -        break;
>> -    case 3:
>> -        sys_family = "ibm,firenze";
>> -        break;
>> -    default:
>> -        sys_family = NULL;
>> -        prerror("IPLPARAMS: Unknown system family\n");
>> -        break;
>> +    if (proc_gen >= proc_gen_p9) {
>> +        dt_add_property_strings(dt_root, "compatible", "ibm,powernv",
>> +                    p->sys_family_str, p->sys_type_str);
>> +
>> +        prlog(PR_INFO, "IPLPARAMS: v0x70 Platform family/type: %s/%s\n",
>> +              p->sys_family_str, p->sys_type_str);
>> +    } else {
>> +        u32 sys_type = be32_to_cpu(p->system_type);
>> +        const char *sys_family;
>> +
>> +        switch (sys_type >> 28) {
>> +        case 0:
>> +            sys_family = "ibm,squadrons";
>> +            break;
>> +        case 1:
>> +            sys_family = "ibm,eclipz";
>> +            break;
>> +        case 2:
>> +            sys_family = "ibm,apollo";
>> +            break;
>> +        case 3:
>> +            sys_family = "ibm,firenze";
>> +            break;
>> +        default:
>> +            sys_family = NULL;
>> +            prerror("IPLPARAMS: Unknown system family\n");
>> +            break;
>> +        }
>> +
>> +        dt_add_property_strings(dt_root, "compatible", "ibm,powernv",
>> +                    sys_family);
>> +        prlog(PR_INFO,
>> +              "IPLPARAMS: Legacy platform family: %s"
>> +              " (sys_type=0x%08x)\n", sys_family, sys_type);
>
> Now like me you are also started breaking test cases ;-)
>
> Can you please update test case?

Actually we have to fix hdata/test/p8-840-spira.dt as well.

-Vasant
Oliver O'Halloran Jan. 12, 2017, 6:15 a.m. UTC | #2
On Thu, Jan 12, 2017 at 5:07 PM, Vasant Hegde
<hegdevasant@linux.vnet.ibm.com> wrote:
> On 01/12/2017 09:24 AM, Oliver O'Halloran wrote:
>>
>> From: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
>>
>> Add new fields to sys params structure and update sys family for p9.
>>
>> In P9 the compatible string is supplied by hostboot through the HDAT.
>> This patch add support for using these strings to set the compatible
>> property in the device tree rather than using the machine ID number
>> scheme traditionally used in the HDAT.
>>
>> [removed ibm,firenze from, add some prints - Oliver]
>> Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
>> [Folded Oliver's changes to original patch - Vasant]
>> Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
>> ---
>>   hdata/spira.c | 63
>> +++++++++++++++++++++++++++++++++++++----------------------
>>   hdata/spira.h | 28 +++++++++++++++++++++++++-
>>   2 files changed, 67 insertions(+), 24 deletions(-)
>>
>> diff --git a/hdata/spira.c b/hdata/spira.c
>> index f87aa2712023..a19b4db92a8a 100644
>> --- a/hdata/spira.c
>> +++ b/hdata/spira.c
>> @@ -756,8 +756,6 @@ static void add_nx(void)
>>   static void add_iplparams_sys_params(const void *iplp, struct dt_node
>> *node)
>>   {
>>         const struct iplparams_sysparams *p;
>> -       u32 sys_type;
>> -       const char *sys_family;
>>         const struct HDIF_common_hdr *hdif = iplp;
>>         u16 version = be16_to_cpu(hdif->version);
>>
>> @@ -776,29 +774,48 @@ static void add_iplparams_sys_params(const void
>> *iplp, struct dt_node *node)
>>
>>         dt_add_property_nstr(node, "ibm,sys-model", p->sys_model, 4);
>>
>> -       /* Compatible is 2 entries: ibm,powernv and ibm,<platform>
>> +       /*
>> +        * Compatible has up to three entries:
>> +        *      "ibm,powernv", the system family and system type.
>> +        *
>> +        * On P9 and above the family and type strings come from the HDAT
>> +        * directly. On P8 we find it from the system ID numbers.
>>          */
>> -       sys_type = be32_to_cpu(p->system_type);
>> -       switch(sys_type >> 28) {
>> -       case 0:
>> -               sys_family = "ibm,squadrons";
>> -               break;
>> -       case 1:
>> -               sys_family = "ibm,eclipz";
>> -               break;
>> -       case 2:
>> -               sys_family = "ibm,apollo";
>> -               break;
>> -       case 3:
>> -               sys_family = "ibm,firenze";
>> -               break;
>> -       default:
>> -               sys_family = NULL;
>> -               prerror("IPLPARAMS: Unknown system family\n");
>> -               break;
>> +       if (proc_gen >= proc_gen_p9) {
>> +               dt_add_property_strings(dt_root, "compatible",
>> "ibm,powernv",
>> +                                       p->sys_family_str,
>> p->sys_type_str);
>> +
>> +               prlog(PR_INFO, "IPLPARAMS: v0x70 Platform family/type:
>> %s/%s\n",
>> +                     p->sys_family_str, p->sys_type_str);
>> +       } else {
>> +               u32 sys_type = be32_to_cpu(p->system_type);
>> +               const char *sys_family;
>> +
>> +               switch (sys_type >> 28) {
>> +               case 0:
>> +                       sys_family = "ibm,squadrons";
>> +                       break;
>> +               case 1:
>> +                       sys_family = "ibm,eclipz";
>> +                       break;
>> +               case 2:
>> +                       sys_family = "ibm,apollo";
>> +                       break;
>> +               case 3:
>> +                       sys_family = "ibm,firenze";
>> +                       break;
>> +               default:
>> +                       sys_family = NULL;
>> +                       prerror("IPLPARAMS: Unknown system family\n");
>> +                       break;
>> +               }
>> +
>> +               dt_add_property_strings(dt_root, "compatible",
>> "ibm,powernv",
>> +                                       sys_family);
>> +               prlog(PR_INFO,
>> +                     "IPLPARAMS: Legacy platform family: %s"
>> +                     " (sys_type=0x%08x)\n", sys_family, sys_type);
>
>
> Now like me you are also started breaking test cases ;-)
>
> Can you please update test case?
>
> --- hdata/test/p81-811.spira.dt 2017-01-12 11:23:31.798738346 +0530
> +++ -   2017-01-12 11:31:17.888269642 +0530
> @@ -59,6 +59,7 @@
>  CORE[19]: HW_PROC_ID=23 PROC_CHIP_ID=3 EC=0x21 OK
>  CORE[19]: PIR=-267911168 RES=-267911168 OK (8 threads)
>      Cache: I=32 D=64/512/8192/0
> +IPLPARAMS: Legacy platform family: ibm,firenze (sys_type=0x30110000)
>  IPLPARAMS: 1 serial ports in array
>  IPLPARAMS: Serial 0 rsrc: 2a00 loc: U78CB.001.WZS00AL-P1-C1-T1
>  MS VPD: Total MB of RAM: 0x20000

Heh, I noticed this about a minute after I sent it. Oh well.

>
>
>>         }
>> -       dt_add_property_strings(dt_root, "compatible", "ibm,powernv",
>> -                               sys_family);
>>
>>         /* Grab nest frequency when available */
>>         if (version >= 0x005b) {
>> diff --git a/hdata/spira.h b/hdata/spira.h
>> index eae7ac909d7c..b04a3df33f73 100644
>> --- a/hdata/spira.h
>> +++ b/hdata/spira.h
>> @@ -323,6 +323,17 @@ struct iplparams_sysparams {
>>         uint8_t         hw_page_table_size;     /* >= 0x59 */
>>         __be16          hv_disp_wheel;          /* >= 0x58 */
>>         __be32          nest_freq_mhz;          /* >= 0x5b */
>> +       uint8_t         split_core_mode;        /* >= 0x5c */
>> +       uint8_t         reserved[3];
>> +       uint8_t         sys_vendor[64];         /* >= 0x5f */
>> +       /* >= 0x60 */
>> +       __be16          sys_sec_setting;
>> +       __be16          tpm_config_bit;
>> +       __be16          tpm_drawer;
>> +       __be16          reserved2;
>> +       uint8_t         hw_key_hash[64];
>> +       uint8_t         sys_family_str[64];     /* vendor,name */
>> +       uint8_t         sys_type_str[64];       /* vendor,type */
>>   } __packed;
>>
>>   /* Idata index 1: IPL parameters */
>> @@ -351,7 +362,11 @@ struct iplparams_iplparams {
>>         uint8_t         huge_page_size;
>>   #define IPLPARAMS_HUGE_PG_SIZE_16G    0
>>         uint8_t         num_vlan_switches;
>> -       __be64          reserved2;
>> +       __be32          reserved2;
>> +       __be32          enlarge_io;     /* >= 0x5a */
>> +       uint8_t         core_config;
>> +#define IPLPARAMS_CORE_NORMAL  0x00
>> +#define IPLPARAMS_CORE_FUSE    0x01
>>   };
>>
>>   /* Idata index 4: Platform Dump Descriptor */
>> @@ -461,6 +476,17 @@ struct msvpd_pmover_bsr_synchro {
>>
>>   /* Idata index 4: UE Address Array */
>>
>> +/* Idata index 5: Hostboot reserved memory address range */
>> +#define MSVPD_IDATA_HB_RESERVED_MEM    5
>> +struct msvpd_hb_reserved_mem {
>> +       __be32          node_instance;
>> +       __be64          start_addr;
>> +       __be64          end_addr;
>> +       __be32          label_size;
>> +       uint8_t         label[64];
>> +       __be64          reserved;
>> +};
>> +
>
>
> I think we should move this hunk to next patch as its related to hostboot
> memory. Otherwise I'm fine with this patch.

Looks like I squashed this into the wrong patch. I'll fix it in the respin.
diff mbox

Patch

--- hdata/test/p81-811.spira.dt	2017-01-12 11:23:31.798738346 +0530
+++ -	2017-01-12 11:31:17.888269642 +0530
@@ -59,6 +59,7 @@ 
  CORE[19]: HW_PROC_ID=23 PROC_CHIP_ID=3 EC=0x21 OK
  CORE[19]: PIR=-267911168 RES=-267911168 OK (8 threads)
      Cache: I=32 D=64/512/8192/0
+IPLPARAMS: Legacy platform family: ibm,firenze (sys_type=0x30110000)
  IPLPARAMS: 1 serial ports in array
  IPLPARAMS: Serial 0 rsrc: 2a00 loc: U78CB.001.WZS00AL-P1-C1-T1
  MS VPD: Total MB of RAM: 0x20000