Skip to content

Commit

Permalink
skiboot: Handle combined units node in the imc dt
Browse files Browse the repository at this point in the history
Add code to detect combined unit nodes
in the imc device tree. Due to HW/OCC restriction
mcs* units are paired and monitored by the nest
microcode. Microcode today does not support monitoring
of individual mcs* unit events, so the patch first
remove these mcs* from the imc device tree if found.

Secondly to enable or disbale combined units nodes like
"mcs01", "mcs23","mcs45" and "mcs67", additional parser
loop is added to disable_unavailable_units().

Signed-off-by: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
  • Loading branch information
Madhavan Srinivasan authored and stewartsmith committed Jun 27, 2017
1 parent 866e11b commit a1e0a04
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 0 deletions.
59 changes: 59 additions & 0 deletions hw/imc.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,37 @@ char const *nest_pmus[] = {
/* reserved bits : 48 - 64 */
};

/*
* Due to Nest HW/OCC restriction, microcode will not support individual unit
* events for these nest units mcs0, mcs1 ... mcs7 in the accumulation mode.
* And events to monitor each mcs units individually will be supported only
* in the debug mode (which will be supported by microcode in the future).
* These will be advertised only when OPAL provides interface for the it.
*/
char const *debug_mode_units[] = {
"mcs0",
"mcs1",
"mcs2",
"mcs3",
"mcs4",
"mcs5",
"mcs6",
"mcs7",
};

/*
* Combined unit node events are counted when any of the individual
* unit is enabled in the availability vector. That is,
* ex, mcs01 unit node should be enabled only when mcs0 or mcs1 enabled.
* mcs23 unit node should be enabled only when mcs2 or mcs3 is enabled
*/
static struct combined_units_node cu_node[] = {
{ .name = "mcs01", .unit1 = PPC_BIT(1), .unit2 = PPC_BIT(2) },
{ .name = "mcs23", .unit1 = PPC_BIT(3), .unit2 = PPC_BIT(4) },
{ .name = "mcs45", .unit1 = PPC_BIT(5), .unit2 = PPC_BIT(6) },
{ .name = "mcs67", .unit1 = PPC_BIT(7), .unit2 = PPC_BIT(8) },
};

static char *compress_buf;
static size_t compress_buf_size;
const char **prop_to_fix(struct dt_node *node);
Expand Down Expand Up @@ -293,6 +324,34 @@ static void disable_unavailable_units(struct dt_node *dev)
}
}

/*
* Loop to detect debug mode units and remove them
* since the microcode does not support debug mode function yet.
*/
for (i = 0; i < ARRAY_SIZE(debug_mode_units); i++) {
target = dt_find_by_name(dev, debug_mode_units[i]);
if (!target)
continue;
/* Remove the device node */
dt_free(target);
}

/*
* Based on availability unit vector from control block,
* check and enable combined unit nodes in the device tree.
*/
for (i = 0; i < MAX_NEST_COMBINED_UNITS ; i++ ) {
if (!(cu_node[i].unit1 & avl_vec) &&
!(cu_node[i].unit2 & avl_vec)) {
target = dt_find_by_name(dev, cu_node[i].name);
if (!target)
continue;

/* Remove the device node */
dt_free(target);
}
}

return;
}

Expand Down
7 changes: 7 additions & 0 deletions include/imc.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,4 +132,11 @@ struct imc_chip_cb

void imc_init(void);
void imc_catalog_preload(void);

#define MAX_NEST_COMBINED_UNITS 4
struct combined_units_node {
const char *name;
u64 unit1;
u64 unit2;
};
#endif /* __IMC_H */

0 comments on commit a1e0a04

Please sign in to comment.