[Skiboot] [PATCH 0/4] OPAL debugfs calls

Cédric Le Goater clg at kaod.org
Tue Nov 24 21:02:37 AEDT 2020


On 11/24/20 10:55 AM, Frederic Barrat wrote:
> 
> 
> On 05/11/2020 17:15, Cédric Le Goater wrote:
>> Hello,
>>
>> These patches add a couple of OPAL read/write calls which let the OPAL
>> drivers expose any kind of low level information : configuration, HW
>> registers, statistics. The write call can perform some reconfiguration.
>>
>> I have been using them for a while on P9 and P10 to query XIVE internals,
>> time statistics on HW procedures and to modify the allocation of XIVE
>> resources for guests. It might be useful to others as debug or bringup
>> extensions.
>>
>> Last is the quickly-coded generic Linux driver.
>>
>> One problem is our snprintf implementation in OPAL which does not
>> return the number of bytes that would have been written if the buffer
>> was large enough. It would help the Linux driver.
>>
>> Thanks,
>>
>> C.
> 
> 
> This is interesting. I've played a bit with it with PHBs.
> I can imagine it could be useful for debug when cronus is not around. I'm less convinced about the "write" feature, the interface feels not precise enough. I guess it's no coincidence that writing ends up being disabled on all the xive and phb data structures.

I didn't send it but I use the write handler to select the chip 
on which are allocated the XIVE structures. See an example below. 
It's not that bad to use for simple tuning knobs. It also means 
that the driver can be reconfigured.


Thanks,

C.




+static int xive_vp_alloc_read(struct opal_debug *d __unused, void *buf,
+			      uint64_t size)
+{
+	int n = 0;
+
+	if (xive_preferred_chip == OPAL_XIVE_ANY_CHIP)
+		n += snprintf(buf + n, size - n, "VP allocator : distributed\n");
+	else
+		n += snprintf(buf + n, size - n, "VP allocator : single chip %d\n",
+			      xive_preferred_chip);
+
+	return n;
+}
+
+static int xive_vp_alloc_write(struct opal_debug *d  __unused, void *buf,
+			       uint64_t size)
+{
+	int chip_id;
+
+	if (!strncmp(buf, "distributed", size)) {
+		chip_id = OPAL_XIVE_ANY_CHIP;
+	} else if (!strncmp(buf, "single", size)) {
+		chip_id = 0;
+	} else {
+		char *p = NULL;
+
+		chip_id = strtol(buf, &p, 10);
+		if (*p || p == buf)
+			return OPAL_PARAMETER;
+		if (!get_chip(chip_id))
+			return OPAL_PARAMETER;
+	}
+
+	if (xive_preferred_chip != chip_id)
+		xive_init_vp_allocator_chip(chip_id);
+	return OPAL_SUCCESS;
+}
+
+static const struct opal_debug_ops xive_vp_alloc_ops = {
+	.read = xive_vp_alloc_read,
+	.write = xive_vp_alloc_write,
+};
+
 static const struct {
 	const char *name;
 	const struct opal_debug_ops *ops;
@@ -5415,6 +5483,7 @@ static const struct {
 	{ "xive-esc",	&xive_esc_ops,  },
 	{ "xive-vpt",	&xive_vpt_ops,  },
 	{ "xive-perf",	&xive_perf_ops, },
+	{ "xive-vp-alloc",	&xive_vp_alloc_ops, },
 };
 
 static void xive_init_debug(struct xive *x)





More information about the Skiboot mailing list