[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 05/22] i8259.c: move parent_realize from PICClass to I8259CommonClass


  • To: Peter Maydell <peter.maydell@xxxxxxxxxx>
  • From: Mark Cave-Ayland <mark.caveayland@xxxxxxxxxxx>
  • Date: Wed, 14 Oct 2026 14:57:57 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nutanix.com; dmarc=pass action=none header.from=nutanix.com; dkim=pass header.d=nutanix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=bMjWdRXxtjv4GFn65tABCCzXTinBZVZXyMVJ/CljQ8U=; b=PpAaXgFmIXluqyDOwb+6ons4wGSNxgrXPM1RcBit0KMkSFmFdeNTZFKk/CCarZN8a6M7Zt+tD4c+X/rfUF9kjkcRy/nsuiH4W/coRuFVWD4yfTutY/BxVu26fmbFYQxaKii0whkEbKQ67w6MXz66Cl+gDCzUSGW7O7Tt2Pf2ccH6TgMzbrFm1C8KpCSX3YfcaYaGyJKbiiaUjDQW9AJSn+Au6LNci+wX3TF8yi4NN0chkqt3f9E04hOyPGAPg3ZyiPTVUVC9qExSX/YI2ktvGNu6qUSOpG1Nbgd71cn9poxLPwL4jLhpLmXiQJfevZilHsBVMFPLJxFusRKWLoz3IA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=hYgWnoniDCEscDx4VTpjnlnVamlYOf9HMMxYEXg77J5FcleCSZr1zNRyX3LYxLfsAqfvyI0y8wQzYJcuTfxDLb24RRtUjWxB0au2O2wQ3LKxVZYOSATxO19oz495GbyvcX+Q7B4QsZL7NrzrZyxN6bQaFSduSnYyMfkKGFSwbfRLa5Ark2ERRYZLDdLvFswuHtCYkeN+0ROeOOaK5F7HJzpAaXG8Ub7Ce2KQ+ciIFEMr1Pzg0iSitRGppUeYPQBw3oSUZRw6y9/Sq76r0wmQlxxxDfsNXe8+gHQt5u+1n8RWvqcV3vWb+/z0ZXkF8WJiu7owIDQ3v1ZOy/lLFTUMQQ==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=proofpoint20171006 header.d=nutanix.com header.i="@nutanix.com" header.h="Cc:Content-Transfer-Encoding:Content-Type:Date:From:In-Reply-To:Message-ID:MIME-Version:References:Subject:To"; dkim=pass header.s=selector1 header.d=nutanix.com header.i="@nutanix.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"
  • Authentication-results: mx.microsoft.com 1; dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nutanix.com;
  • Cc: pbonzini@xxxxxxxxxx, richard.henderson@xxxxxxxxxx, mst@xxxxxxxxxx, sstabellini@xxxxxxxxxx, anthony@xxxxxxxxxxxxxx, edgar.iglesias@xxxxxxxxx, qemu-devel@xxxxxxxxxx, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Wed, 14 Oct 2026 13:58:17 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 14/10/2026 12:00, Mark Cave-Ayland wrote:

On 13/10/2026 16:54, Peter Maydell wrote:

On Wed, 16 Sept 2026 at 11:49, Mark Cave-Ayland
<mark.caveayland@xxxxxxxxxxx> wrote:

Both the emulated and KVM i8259 implementations store a reference to the
parent_realize function in their respective classes. Start by moving
parent_realize from PICClass to I8259CommonClass and removing PICClass since
it is no longer required.

Signed-off-by: Mark Cave-Ayland <mark.caveayland@xxxxxxxxxxx>

This is one of those things where I think we're not 100% consistent
about whether we think the parent_realize field should go in the
child class struct or the parent class struct. The name "parent_realize"
implies it ought to be in the child struct, though, and I think we
do that more often than we put it in the parent class. This also
makes some kind of separation-of-concerns sense too: it's the child
that knows (a) that it exists at all and that (b) it wants to have a
realize method that will mean it needs to chain back to the parent.

The docs for device_class_set_parent_realize() claim the parent
realize ptr is stored "usually in the instance structure" which
I think is just completely wrong.

I could be persuaded otherwise. As usual with QOM/qdev, I'm
mostly interested in (a) consistency and (b) documenting what the
"right thing" is. Realize, reset and unrealize are the three
methods where QOM's lack of convenient support for "child
implementation of method will need to chain to parent impl"
is most awkward.
Yeah it's a tricky one. This patch was really just refactoring what was already there, but I'm open to moving it into the instance if you think that is better. I agree with your point about the child instance being the one that knows it needs to chain back to the parent.

I'll have an experiment and if it looks good, I'll move it to the instance in v2.
I did a search over the codebase and checked all references to DeviceRealize, and they are all stored in QOM classes and make use of device_class_set_parent_realize(). So for now I think we can say it is the documentation for device_class_set_parent_realize() that is wrong, and I will leave it this way in v2 of the series.


ATB,

Mark.




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.