On 1/14/22 10:33, Cédric Le Goater wrote:
@@ -1520,14 +1520,19 @@ static PnvPhb4PecStack *pnv_phb4_get_stack(PnvChip
*chip, PnvPHB4 *phb,
for (i = 0; i < chip->num_pecs; i++) {
/*
- * For each PEC, check the amount of stacks it supports
- * and see if the given phb4 index matches a stack.
+ * For each PEC, check the amount of phbs it supports
+ * and see if the given phb4 index matches an index.
*/
PnvPhb4PecState *pec = &chip9->pecs[i];
- for (j = 0; j < pec->num_stacks; j++) {
+ for (j = 0; j < pec->num_phbs; j++) {
if (index == pnv_phb4_pec_get_phb_id(pec, j)) {
- return &pec->stacks[j];
+ pec->phbs[j] = phb;
Why do we need this array ?
Actually we don't. While making these patches I forgot to assign this pointer
back
to the array and everything worked. We don't search the PHB back from the PEC at
any point.
This is being kept because I refrain from doing too much design changes at
once. We
can drop it though - either in this patch or in a follow up.
+
+ /* Set phb-number now since we already have it */
+ object_property_set_int(OBJECT(phb), "phb-number",
+ j, &error_abort);
that's ugly :/
Not my proudest line of code indeed.
Perhaps we're better of trying to get rid of stack->stack_no altogether before
even
converting it to phb->stack_no. I'll see how that goes.
Daniel
C.
+ return pec;
}
}
}