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

Re: [PATCH v2 19/27] i8259.c: properly cascade secondary i8259 from primary i8259


  • To: Mark Cave-Ayland <mark.caveayland@xxxxxxxxxxx>
  • From: Peter Maydell <peter.maydell@xxxxxxxxxx>
  • Date: Fri, 16 Oct 2026 17:04:46 +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=oHZaaHBa8nXusX2kfKrl6y8KNB9X+UZvV+PXu8W417Y=; fh=TXQgLy/PlyK1OuK64RfFLmA4AMkVn8VTs4weE3CHUMw=; b=J3dXv7SFpw6PMOaiKxE2qeE4+psDijZ6mIkd2eYihF95bsPRVK5IQain6L/ogaUnNP ViIa0C6YCdHcMZmecpTl8G/23wjTRqkWdanWzfje202NqnOZjEo5I2leiE51cq/Gaap2 s4wMJ42JBxt7u0AiiYgu4dHOz4skJx+bEbEUtJqlFr6UFJftksuWOD+hwy3wjowOTME2 1ENSONdmLHfFmXavE6jXGgCNES4+/8MTyLHY5q3LKS9BneVlrOh+K2YSaLqZemsaNU4Q a15IA7Px/vfO8N0G7VVs+9AVRX9fY4AEJc9C/eT1NYAfERVu1GZsJO4F1a7QYgXtebW2 L0GA==; darn=lists.xenproject.org
  • Arc-seal: i=1; a=rsa-sha256; t=1792166699; cv=none; d=google.com; s=arc-20260327; b=Ta62YgaI115eebM5lX/Qxg1120z8ao6tw4w/UTaNOA9UmiLhsiLnzROnaqLWYKtrIA 5T/7gx6WAfKjGDU+TMWjh7eX1fMueoXrymEeCy6IS0Huiyo4lO94R6OUOKdOezh5XtsH LizHLNvdccxOWkNoDlgfbxSqiBHAW6bDjtS07m2/kr+bUY/NoUIlGYK0XINgwu5Kp8/g SV+ubAQgWI7DhlPx7SLVuGvOEMwjmx7toaMPy7zzWIgp5DJlBYNIR9O7ts6rw5VDWKFP 6MJ+CnKoVCoR4Erecexndiny4kN/ifGFn4pyA+/64/V/2sPboqSbOfDGD7KsVGJgN+aQ cKrw==
  • 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: Fri, 16 Oct 2026 16:05:04 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Fri, 16 Oct 2026 at 15:24, Mark Cave-Ayland
<mark.caveayland@xxxxxxxxxxx> wrote:
>
> Currently the cascaded output from the secondary i8259 is returned directly in
> the pass_irqs[] array, instead of being connected to the relevant input of the
> primary i8259.
>
> This is a bug fix since in a cascaded configuration on real hardware it is
> possible (although unlikely) that the cascaded input from the secondary i8259
> can be masked on the primary i8259.
>
> Signed-off-by: Mark Cave-Ayland <mark.caveayland@xxxxxxxxxxx>
> ---
>  hw/intc/i8259.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/hw/intc/i8259.c b/hw/intc/i8259.c
> index bfe01067b7..5f90edbe60 100644
> --- a/hw/intc/i8259.c
> +++ b/hw/intc/i8259.c
> @@ -519,7 +519,8 @@ static void i8259_pic_realize(DeviceState *dev, Error 
> **errp)
>      }
>
>      /* Wire up secondary cascade */
> -    qdev_connect_gpio_out(sec_dev, 0, s->pass_irqs[2]);
> +    qdev_connect_gpio_out(sec_dev, 0,
> +                          qdev_get_gpio_in(pri_dev, 2));

Looking at this again, I'm not sure how this is a bugfix.
Quoting patch 18, this is the code at this point, just
for context:

+    for (i = 0; i < 8; i++) {
+        s->pass_irqs[i] = qdev_get_gpio_in(pri_dev, i);
+    }
+
+    qdev_connect_gpio_out(pri_dev, 0, &s->i8259_primary_out_irq);
+
+    /* Secondary */
+    sec_dev = DEVICE(&s->i8259[1]);
+    qdev_prop_set_uint32(sec_dev, "iobase", 0xa0);
+    qdev_prop_set_uint32(sec_dev, "elcr_addr", 0x4d1);
+    qdev_prop_set_uint8(sec_dev, "elcr_mask", 0xde);
+    if (!isa_realize_and_unref(ISA_DEVICE(sec_dev), s->isabus, errp)) {
+        return;
+    }
+
+    /* Wire up secondary cascade */
+    qdev_connect_gpio_out(sec_dev, 0, s->pass_irqs[2]);
+
+    for (i = 8; i < ISA_NUM_IRQS; i++) {
+        s->pass_irqs[i] = qdev_get_gpio_in(sec_dev, i - 8);
+    }

So before this patch, we connect sec_dev's gpio output 0 to
s->pass_irqs[2]. The loop earlier in the code set that up:
        s->pass_irqs[i] = qdev_get_gpio_in(pri_dev, i);

Now we have:

> +    qdev_connect_gpio_out(sec_dev, 0,
> +                          qdev_get_gpio_in(pri_dev, 2));

Isn't that exactly the same thing?

I think it is indeed a bit clearer to directly grab the
pri_dev input rather than pulling it back out of
pass_irqs[2], but I don't think there's any behaviour
change here.

thanks
-- PMM



 


Rackspace

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