[Skiboot] [PATCH] hdata: Fix ibm,pa-features for all CPU types

Balbir Singh bsingharora at gmail.com
Thu Jan 12 23:40:33 AEDT 2017


On Wed, Jan 11, 2017 at 05:33:08PM -0600, Benjamin Herrenschmidt wrote:
> Hopefully the values are all right ;-) A future TODO is to
> use some nice macro to make it clearer who is what.
> 
> Signed-off-by: Benjamin Herrenschmidt <benh at kernel.crashing.org>
> ---
>  hdata/cpu-common.c | 62 +++++++++++++++++++++++++++++++++++++++++++++++++-----
>  1 file changed, 57 insertions(+), 5 deletions(-)
> 
> diff --git a/hdata/cpu-common.c b/hdata/cpu-common.c
> index 528f008..603d8af 100644
> --- a/hdata/cpu-common.c
> +++ b/hdata/cpu-common.c
> @@ -30,8 +30,43 @@ struct dt_node * add_core_common(struct dt_node *cpus,
>  	struct dt_node *cpu;
>  	uint32_t version;
>  	uint64_t freq;
> -	const uint8_t pa_features[] = {
> -		6, 0, 0xf6, 0x3f, 0xc7, 0x00, 0x80, 0xc0 };
> +	const uint8_t pa_features_p7[] = {
> +		6, 0,
> +		0xf6, 0x3f, 0xc7, 0x00, 0x80, 0xc0 };
> +	const uint8_t pa_features_p7p[] = {
> +		6, 0,
> +		0xf6, 0x3f, 0xc7, 0xc0, 0x80, 0xc0 };
> +	const uint8_t pa_features_p8[] = {
> +	       24, 0,
> +	       0xf6, 0x3f, 0xc7, 0xc0, 0x80, 0xd0, 0x80, 0x00,
> +	       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> +	       0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00,
> +	};
> +	const uint8_t pa_features_p9_dd1[] = {
> +	       64, 0,
> +	       0xf6, 0x3f, 0xc7, 0xc0, 0x80, 0xd0, 0x80, 0x00, /*  0 ..  7 */
> +	       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*  8 .. 15 */
> +	       0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x00, 0x00, /* 16 .. 23 */
> +	       0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x00, 0x00, /* 24 .. 31 */
> +	       0x80, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, /* 32 .. 39 */
> +	       0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, /* 40 .. 47 */
> +	       0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, /* 48 .. 55 */
I wonder if it is worth adding some additional documentation like this
	       Decimal Int|SHA Accel   |Atomics    |Rand Number

> +	       0x80, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, /* 56 .. 63 */
> +	};
> +	const uint8_t pa_features_p9_dd2[] = {
> +	       64, 0,
> +	       0xf6, 0x3f, 0xc7, 0xc0, 0x80, 0xd0, 0x80, 0x00, /*  0 ..  7 */
> +	       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*  8 .. 15 */
> +	       0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, /* 16 .. 23 */
> +	       0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x00, 0x00, /* 24 .. 31 */
> +	       0x80, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, /* 32 .. 39 */
> +	       0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, /* 40 .. 47 */
> +	       0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, /* 48 .. 55 */
> +	       0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, /* 56 .. 63 */
> +	};
> +
> +	const uint8_t *pa_features;
> +	uint32_t pa_features_size;

Ideally this should be size_t, IIRC. Just nit-picking

>  
>  	prlog(PR_INFO, "    Cache: I=%u D=%u/%u/%u/%u\n",
>  	      be32_to_cpu(cache->icache_size_kb),
> @@ -47,20 +82,34 @@ struct dt_node * add_core_common(struct dt_node *cpus,
>  	switch(PVR_TYPE(version)) {
>  	case PVR_TYPE_P7:
>  		name = "PowerPC,POWER7";
> +		pa_features = pa_features_p7;
> +		pa_features_size = sizeof(pa_features_p7);
>  		break;
>  	case PVR_TYPE_P7P:
>  		name = "PowerPC,POWER7+";
> +		pa_features = pa_features_p7p;
> +		pa_features_size = sizeof(pa_features_p7p);
>  		break;
>  	case PVR_TYPE_P8E:
>  	case PVR_TYPE_P8:
>  	case PVR_TYPE_P8NVL:
>  		name = "PowerPC,POWER8";
> +		pa_features = pa_features_p8;
> +		pa_features_size = sizeof(pa_features_p8);
>  		break;
>  	case PVR_TYPE_P9:
>  		name = "PowerPC,POWER9";
> +		if (PVR_VERS_MAJ(version) == 1) {
> +			pa_features = pa_features_p9_dd1;
> +			pa_features_size = sizeof(pa_features_p9_dd1);
> +		} else {
> +			pa_features = pa_features_p9_dd2;
> +			pa_features_size = sizeof(pa_features_p9_dd2);
> +		}
>  		break;
>  	default:
>  		name = "PowerPC,Unknown";
> +		pa_features = NULL;
>  	}
>  
>  	cpu = dt_new_addr(cpus, name, int_server);
> @@ -91,9 +140,12 @@ struct dt_node * add_core_common(struct dt_node *cpus,
>  		                0x18, 0x0008,  /* 64K seg 16M pages */
>  		0x18, 0x100, 1,	0x18, 0x0000,  /* 16M seg 16M pages */
>  		0x22, 0x120, 1, 0x22, 0x0003); /* 16G seg 16G pages */
> -			      
> -	dt_add_property(cpu, "ibm,pa-features",
> -			pa_features, sizeof(pa_features));
> +
> +
> +	if (pa_features) {
> +		dt_add_property(cpu, "ibm,pa-features",
> +				pa_features, pa_features_size);
> +	}
>  	dt_add_property_cells(cpu, "ibm,slb-size", 0x20);
>  
>  	dt_add_property_cells(cpu, "ibm,vmx", 0x2);
> 

Balbir Singh.


More information about the Skiboot mailing list