qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Igor Mammedov <imammedo@redhat.com>
To: Gerd Hoffmann <kraxel@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	Richard Henderson <rth@twiddle.net>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	qemu-devel@nongnu.org, Eduardo Habkost <ehabkost@redhat.com>
Subject: Re: [PATCH 5/6] acpi: serial: don't use _STA method
Date: Tue, 31 Mar 2020 21:53:20 +0200	[thread overview]
Message-ID: <20200331215320.620c52bf@redhat.com> (raw)
In-Reply-To: <20200331152342.vdfhosgpi6popy2x@sirius.home.kraxel.org>

On Tue, 31 Mar 2020 17:23:42 +0200
Gerd Hoffmann <kraxel@redhat.com> wrote:

> > > -static Aml *build_com_device_aml(uint8_t uid)
> > > +static void build_com_device_aml(Aml *scope, uint8_t uid)
> > >  {
> > >      Aml *dev;
> > >      Aml *crs;
> > > -    Aml *method;
> > > -    Aml *if_ctx;
> > > -    Aml *else_ctx;
> > > -    Aml *zero = aml_int(0);
> > > -    Aml *is_present = aml_local(0);
> > > -    const char *enabled_field = "CAEN";
> > >      uint8_t irq = 4;
> > >      uint16_t io_port = 0x03F8;
> > >  
> > >      assert(uid == 1 || uid == 2);
> > >      if (uid == 2) {
> > > -        enabled_field = "CBEN";
> > >          irq = 3;
> > >          io_port = 0x02F8;
> > >      }
> > > +    if (!memory_region_present(get_system_io(), io_port)) {  
> >                                   ^^^^^^
> > even though acpi_setup() is a part of board code, usually it's not recommended to 
> > use get_system_foo() outside of machine_init()
> > 
> > how about fishing out present serial ports from isa device in a helper
> > like acpi_get_misc_info(), and then generalize AML like
> >    build_com_device_aml(Aml *scope, uint8_t uid, io_port, irq)  
> 
> Hmm, I'm wondering whenever it would be useful to have ...
> 
>    ISADeviceClass->build_aml(Aml *scope, ISADevice *dev);

in relation to iqr, you said earlier that device doesn't know to which irq it's mapped.
that might be a problem in this case, likewise for (MM)IO

> ... then just walk all isa devices and call the handler
> (if present).  Maybe the same for sysbus.

There was already such idea (Paolo or Michael), i.e. to move AML code
generation related to specific devices inside of device model (not
only ISA or sysbus), so one would just have to enumerate present
devices in generic way and ask them to provide AML descriptors and be
done with building DSDT.

Not sure if it's doable in generic way though, especially when it comes to
orchestrating _CRS between various devices.
(while linux might still boot with resource conflicts, Windows 
BSODs occasionally instead). Maybe there are other complications
I don't recall.

So it might take awhile to come up with approach which would work nice.

Simplest way to get job done in case of microvm is to make board
fill in assigned resources in some helper data structure and pass that
to acpi code. (another approach - arm/virt uses static 'registry' to distribute
address space/irq and then acpi code just fetches values from there if
device is present + a bunch of shared PCI code to make up dynamic PCI
description)

> cheers,
>   Gerd
> 



  reply	other threads:[~2020-03-31 19:54 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-27 12:11 [PATCH 0/6] acpi: i386 tweaks Gerd Hoffmann
2020-03-27 12:11 ` [PATCH 1/6] acpi: split hw/i386/acpi-build.c Gerd Hoffmann
2020-03-27 14:17   ` Igor Mammedov
2020-03-27 12:11 ` [PATCH 2/6] acpi: make build_madt() more generic Gerd Hoffmann
2020-03-27 12:11 ` [PATCH 3/6] acpi: factor out acpi_dsdt_add_fw_cfg() Gerd Hoffmann
2020-03-27 14:18   ` Igor Mammedov
2020-03-27 12:11 ` [PATCH 4/6] acpi: drop pointless _STA method Gerd Hoffmann
2020-03-27 14:21   ` Igor Mammedov
2020-03-27 12:11 ` [PATCH 5/6] acpi: serial: don't use " Gerd Hoffmann
2020-03-27 14:33   ` Igor Mammedov
2020-03-31 15:23     ` Gerd Hoffmann
2020-03-31 19:53       ` Igor Mammedov [this message]
2020-04-01  5:51         ` Gerd Hoffmann
2020-03-27 12:11 ` [PATCH 6/6] acpi: parallel: " Gerd Hoffmann
2020-03-27 14:35   ` Igor Mammedov
2020-03-27 12:47 ` [PATCH 0/6] acpi: i386 tweaks no-reply
2020-03-27 12:49 ` no-reply
2020-03-29 12:46 ` Michael S. Tsirkin

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=20200331215320.620c52bf@redhat.com \
    --to=imammedo@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).