From: Igor Mammedov <imammedo@redhat.com>
To: Mark Cave-Ayland <mark.caveayland@nutanix.com>
Cc: mst@redhat.com, anisinha@redhat.com, pbonzini@redhat.com,
marcandre.lureau@redhat.com, marcel.apfelbaum@gmail.com,
qemu-devel@nongnu.org
Subject: Re: [PATCH 4/5] hw/char/serial-isa.c: declare IRQ as shared in ACPI IRQ descriptor
Date: Thu, 5 Mar 2026 13:49:13 +0100 [thread overview]
Message-ID: <20260305134913.78e63dd0@imammedo> (raw)
In-Reply-To: <c578ab0a-d8b8-4474-8d5b-538a26a85c85@nutanix.com>
On Wed, 4 Mar 2026 14:36:14 +0000
Mark Cave-Ayland <mark.caveayland@nutanix.com> wrote:
> On 04/03/2026 11:22, Igor Mammedov wrote:
>
> > On Fri, 27 Feb 2026 13:44:58 +0000
> > Mark Cave-Ayland <mark.caveayland@nutanix.com> wrote:
> >
> >> From Windows 8.1 onwards ISA serial IRQs cannot be shared when ACPI Revision
> >> 5.0 is used in the FACP table. The reason for this is that if a 2-byte IRQ
> >> Descriptor is used then the interrupt is considered to be high true, edge
> >> sensitive, non-shareable. Since legacy serial ports COM1/3 and COM2/4 share
> >> an IRQ then if more than 2 serial ports are added, Windows indicates a
> >> conflict in Device Manager and these combinations cannot be used together.
> >>
> >> Add a new 3-byte IRQ Descriptor to the _CRS resource indicating that the
> >> ISA serial IRQ is low true, edge sensitive and shareable, along with a
> >> corresponding _PRS resource so that the legacy serial ports also appear
> >> at a fixed address. This enables all 4 legacy serial ports to be used in
> >> Windows without conflict.
> >
> > What happens if we just replace aml_irq_no_flags() with aml_irq()
> > (without compat knob and _PRS)
> >
> > wrt _PRS could you elaborate some more why it's needed and what happens
> > if it doesn't exists?
>
> Good question. I based the implementation on the technote from Microchip
> at https://ww1.microchip.com/downloads/en/DeviceDoc/00001879A.pdf and
> found that it worked fine here on Windows 11.
>
> My concern from deviating from the document would be that any changes
> would work fine on Windows 11, but then fail on older versions of Windows.
>
> I can try and locate a copy of Windows 8.1 internally if you still think
> that is worth pursuing?
with _CRS present, I don't think we need _PRS especially in absence of _SRS
and means to actually changes used IRQs/IO.
What I'd like to avoid is adding not needed code and compat logic
if it's possible.
The later unfortunately achievable only by tedious testing of
the change with older Windows versions (the older it is,
the more loose spec interperetation).
>
> >> Finally add a new x-acpi-shared-irq property to disable the ACPI IRQ descriptor
> >> changes for older PC machine types, and add it to the pc_compat_10_2[] array.
> >>
> >> Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
> >> ---
> >> hw/char/serial-isa.c | 23 ++++++++++++++++++++++-
> >> hw/i386/pc.c | 4 +++-
> >> 2 files changed, 25 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/hw/char/serial-isa.c b/hw/char/serial-isa.c
> >> index a4be0492c5..1662da86bd 100644
> >> --- a/hw/char/serial-isa.c
> >> +++ b/hw/char/serial-isa.c
> >> @@ -28,6 +28,7 @@
> >> #include "qemu/module.h"
> >> #include "system/system.h"
> >> #include "hw/acpi/acpi_aml_interface.h"
> >> +#include "hw/acpi/aml-build.h"
> >> #include "hw/char/serial.h"
> >> #include "hw/char/serial-isa.h"
> >> #include "hw/isa/isa.h"
> >> @@ -43,6 +44,7 @@ struct ISASerialState {
> >> uint32_t index;
> >> uint32_t iobase;
> >> uint32_t isairq;
> >> + bool acpi_shared_irq;
> >> SerialState state;
> >> };
> >>
> >> @@ -92,7 +94,12 @@ static void serial_isa_build_aml(AcpiDevAmlIf *adev, Aml *scope)
> >>
> >> crs = aml_resource_template();
> >> aml_append(crs, aml_io(AML_DECODE16, isa->iobase, isa->iobase, 0x00, 0x08));
> >> - aml_append(crs, aml_irq_no_flags(isa->isairq));
> >> + if (isa->acpi_shared_irq) {
> >> + aml_append(crs, aml_irq(isa->isairq, AML_EDGE, AML_ACTIVE_LOW,
> >> + AML_SHARED));
> >> + } else {
> >> + aml_append(crs, aml_irq_no_flags(isa->isairq));
> >> + }
> >>
> >> dev = aml_device("COM%d", isa->index + 1);
> >> aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0501")));
> >> @@ -100,6 +107,18 @@ static void serial_isa_build_aml(AcpiDevAmlIf *adev, Aml *scope)
> >> aml_append(dev, aml_name_decl("_STA", aml_int(0xf)));
> >> aml_append(dev, aml_name_decl("_CRS", crs));
> >>
> >> + if (isa->acpi_shared_irq) {
> >> + Aml *prs = aml_resource_template();
> >> +
> >> + aml_append(prs, aml_start_dependent_function(0, 0));
> >> + aml_append(prs, aml_io(AML_DECODE16, isa->iobase, isa->iobase, 0x00,
> >> + 0x08));
> >> + aml_append(prs, aml_irq(isa->isairq, AML_EDGE, AML_ACTIVE_LOW,
> >> + AML_SHARED));
> >> + aml_append(prs, aml_end_dependent_function());
> >> + aml_append(dev, aml_name_decl("_PRS", prs));
> >> + }
> >> +
> >> aml_append(scope, dev);
> >> }
> >>
> >> @@ -117,6 +136,8 @@ static const Property serial_isa_properties[] = {
> >> DEFINE_PROP_UINT32("index", ISASerialState, index, -1),
> >> DEFINE_PROP_UINT32("iobase", ISASerialState, iobase, -1),
> >> DEFINE_PROP_UINT32("irq", ISASerialState, isairq, -1),
> >> + DEFINE_PROP_BOOL("x-acpi-shared-irq", ISASerialState, acpi_shared_irq,
> >> + true),
> >> };
> >>
> >> static void serial_isa_class_initfn(ObjectClass *klass, const void *data)
> >> diff --git a/hw/i386/pc.c b/hw/i386/pc.c
> >> index 0dd3fd01d9..c0335b05ba 100644
> >> --- a/hw/i386/pc.c
> >> +++ b/hw/i386/pc.c
> >> @@ -82,7 +82,9 @@
> >> { "qemu64-" TYPE_X86_CPU, "model-id", "QEMU Virtual CPU version " v, },\
> >> { "athlon-" TYPE_X86_CPU, "model-id", "QEMU Virtual CPU version " v, },
> >>
> >> -GlobalProperty pc_compat_10_2[] = {};
> >> +GlobalProperty pc_compat_10_2[] = {
> >> + { "isa-serial", "x-acpi-shared-irq", "false" },
> >> +};
> >> const size_t pc_compat_10_2_len = G_N_ELEMENTS(pc_compat_10_2);
> >>
> >> GlobalProperty pc_compat_10_1[] = {
>
>
> ATB,
>
> Mark.
>
next prev parent reply other threads:[~2026-03-05 12:49 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-27 13:44 [PATCH 0/5] isa-serial: acpi: declare shared IRQs for COM1/3 and COM2/4 Mark Cave-Ayland
2026-02-27 13:44 ` [PATCH 1/5] hw/acpi/aml-build.c: add aml_irq() representing the 3-byte IRQ descriptor Mark Cave-Ayland
2026-02-27 13:44 ` [PATCH 2/5] hw/acpi/aml-build.c: add AML functions for StartDependentFn/EndDependentFn Mark Cave-Ayland
2026-02-27 13:44 ` [PATCH 3/5] tests/acpi: allow DSDT acpi table changes Mark Cave-Ayland
2026-02-27 13:44 ` [PATCH 4/5] hw/char/serial-isa.c: declare IRQ as shared in ACPI IRQ descriptor Mark Cave-Ayland
2026-03-04 11:22 ` Igor Mammedov
2026-03-04 14:36 ` Mark Cave-Ayland
2026-03-05 12:49 ` Igor Mammedov [this message]
2026-03-09 12:24 ` Mark Cave-Ayland
2026-03-10 12:41 ` Igor Mammedov
2026-02-27 13:44 ` [PATCH 5/5] tests: data: update x86 ACPI tables Mark Cave-Ayland
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260305134913.78e63dd0@imammedo \
--to=imammedo@redhat.com \
--cc=anisinha@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=marcel.apfelbaum@gmail.com \
--cc=mark.caveayland@nutanix.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.