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

Re: [PATCH 13/22] i8259.c: introduce TYPE_I8259_PIC device


  • To: Mark Cave-Ayland <mark.caveayland@xxxxxxxxxxx>
  • From: Peter Maydell <peter.maydell@xxxxxxxxxx>
  • Date: Tue, 13 Oct 2026 17:17:04 +0100
  • Arc-authentication-results: i=1; mx.google.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=kgoBvoAdxeg9Tf8BY5zhua20aW3N8dGlw1G/CJAK2no=; fh=bSCDREc9/ThEBdDmIG26m9PQ/qB+dVzPJRz0Wak6Nvo=; b=S+hidvdsjVpEFV86ahhM1c4xV4sEFBxtyKLy57bB3Q3DQaTJpYQNDnC3BpD7V9wxB6 BeRKiS6IqWr7MyUSMlsUL8g7K67u66FPCVIi8XgqdqfGkf9O6rYXq3LeGwC1oHJa70yJ cykOXS5VFNU814ufl5XYP0up2O3DIHH9rkRKb0HprAB87lM5PtGXErW6238FWbudQYYt m8se0De3xS89LULzN7RKYmHb6Jv2sQRmISFnJx4ZN/UpeMrFGXfQkzalfR7329d2J/g6 Gv8LJ8KwYMMLLMO14eckC4fckzgkVjARp3SGKxkhV6QuP68vfESLs95/64cStRLro+md DFOQ==; darn=lists.xenproject.org
  • Arc-seal: i=1; a=rsa-sha256; t=1791908237; cv=none; d=google.com; s=arc-20260327; b=jSFskG7/Eidg5xl82PQDmZ15kC/RqgtICMGkc3RkW2+uuvfhatgsU0rZzkiA59MAOf U8y/PGSb0uu6lh+fStidezaEszBywVEQOMPOndJhoVwRlcxi2AnsntKRLb7u6HcqPcPB fC10rdF6/uRv45VXDewfalDWX0QxtDN0Mw+4gDNVHNzGs6wIwq4M8VviyyXT1BWD69lK EgAn1xLGtfS9luOBCwmyDyNNVhropZz/7B6+LSvc5dGkkYSPgirM4TzzCVnbf8zGwcis jZpZXfgj07+jhG65fzT/tjG9HPpcDqQv9kBwY2OPl3hXFvKHB5NBX2khRENZTLS12cKu F1+Q==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=google header.d=linaro.org header.i="@linaro.org" header.h="Content-Type:Cc:To:Subject:Message-ID:Date:From:In-Reply-To:References:MIME-Version"
  • Cc: pbonzini@xxxxxxxxxx, richard.henderson@xxxxxxxxxx, mst@xxxxxxxxxx, sstabellini@xxxxxxxxxx, anthony@xxxxxxxxxxxxxx, edgar.iglesias@xxxxxxxxx, qemu-devel@xxxxxxxxxx, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Tue, 13 Oct 2026 16:17:25 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Wed, 16 Sept 2026 at 11:50, Mark Cave-Ayland
<mark.caveayland@xxxxxxxxxxx> wrote:
>
> This device represents a PIC for an x86 machine consisting of 2 cascaded i8259
> devices wired accordingly.
>
> Signed-off-by: Mark Cave-Ayland <mark.caveayland@xxxxxxxxxxx>
> ---
>  hw/intc/i8259.c | 133 ++++++++++++++++++++++++++++++++++++++++++------
>  1 file changed, 118 insertions(+), 15 deletions(-)
>
> diff --git a/hw/intc/i8259.c b/hw/intc/i8259.c
> index af33b71591..fcc94e12f8 100644
> --- a/hw/intc/i8259.c
> +++ b/hw/intc/i8259.c
> @@ -25,7 +25,9 @@
>  #include "qemu/osdep.h"
>  #include "hw/intc/i8259.h"
>  #include "hw/core/irq.h"
> +#include "hw/core/qdev-properties.h"
>  #include "hw/isa/isa.h"
> +#include "qapi/error.h"
>  #include "qemu/timer.h"
>  #include "qemu/log.h"
>  #include "hw/isa/i8259_internal.h"
> @@ -36,6 +38,22 @@
>
>  #define TYPE_I8259 "isa-i8259"
>
> +#define TYPE_I8259_PIC "isa-i8259-pic"
> +
> +struct I8259PICState {
> +    DeviceState parent_obj;
> +
> +    qemu_irq pic_out_irq;
> +    qemu_irq pass_irqs[ISA_NUM_IRQS];
> +
> +    ISABus *isabus;
> +    IRQState i8259_primary_out_irq;
> +    I8259CommonState i8259[2];

This allocates only enough space for the common base class's
instance struct, but later we do an object_initialize_child()
of the child class. If the child class's state struct is
ever bigger than the common class, this will break.

>  static const TypeInfo i8259_type_infos[] = {
>      {
>          .name       = TYPE_I8259,
>          .parent     = TYPE_I8259_COMMON,
>          .class_init = i8259_class_init,
>      },
> +    {
> +        .name          = TYPE_I8259_PIC,
> +        .parent        = TYPE_DEVICE,

Devices that directly inherit from TYPE_DEVICE are awkward,
because they never get reset. Conviently this device doesn't
currently need a reset method, but still, is this a good idea?

> +        .class_init    = i8259_pic_class_init,
> +        .instance_init = i8259_pic_init,
> +        .instance_size = sizeof(I8259PICState),
> +    },
>  };
>
>  DEFINE_TYPES(i8259_type_infos)

-- PMM



 


Rackspace

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