qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Kevin O'Connor <kevin@koconnor.net>
Cc: seabios@seabios.org, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [SeaBIOS] [PATCH v2 4/5] acpi: load and link tables from /etc/acpi/
Date: Mon, 15 Jul 2013 12:58:51 +0300	[thread overview]
Message-ID: <20130715095851.GA1277@redhat.com> (raw)
In-Reply-To: <20130715081159.GB31638@redhat.com>

On Mon, Jul 15, 2013 at 11:11:59AM +0300, Michael S. Tsirkin wrote:
> On Sun, Jul 14, 2013 at 02:27:14PM -0400, Kevin O'Connor wrote:
> > On Sun, Jul 07, 2013 at 06:42:43PM +0300, Michael S. Tsirkin wrote:
> > > Load files in /etc/acpi/, link them using
> > > a linker script and use for acpi tables, including the RSDP.
> > > Presense of RSDP in this directory completely disables
> > > generating and loading legacy acpi tables.
> > > 
> > > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> > > ---
> > >  src/acpi.c | 39 +++++++++++++++++++++++++++++++++++++++
> > >  1 file changed, 39 insertions(+)
> > > 
> > > diff --git a/src/acpi.c b/src/acpi.c
> > > index a81f0cb..07d311a 100644
> > > --- a/src/acpi.c
> > > +++ b/src/acpi.c
> > > @@ -27,6 +27,7 @@
> > >  #include "config.h" // CONFIG_*
> > >  #include "paravirt.h" // RamSize
> > >  #include "dev-q35.h"
> > > +#include "linker.h"
> > >  
> > >  #include "acpi-dsdt.hex"
> > >  
> > > @@ -599,6 +600,34 @@ static const struct pci_device_id acpi_find_tbl[] = {
> > >  
> > >  struct rsdp_descriptor *RsdpAddr;
> > >  
> > > +/* Look for RSDP signature in files loaded in FSEG */
> > > +struct rsdp_descriptor *
> > > +acpi_find_rsdp_rom(void)
> > > +{
> > > +    struct romfile_s *file = NULL;
> > > +    struct rsdp_descriptor *rsdp = NULL;
> > > +    for (;;) {
> > > +        file = romfile_findprefix("", file);
> > > +        if (!file)
> > > +            break;
> > > +
> > > +        if (!file->data || !pmm_test_fseg(file->data) ||
> > > +            file->size < sizeof(rsdp->signature))
> > > +            continue;
> > > +
> > > +        void *data;
> > > +
> > > +        for (data = file->data;
> > > +             data + sizeof(*rsdp) <= file->data + file->size;
> > > +             data++) {
> > > +            rsdp = data;
> > > +            if (rsdp->signature == cpu_to_le64(RSDP_SIGNATURE))
> > > +                return rsdp;
> > > +        }
> > > +    }
> > > +    return NULL;
> > > +}
> > > +
> > >  #define MAX_ACPI_TABLES 20
> > >  void
> > >  acpi_setup(void)
> > > @@ -608,6 +637,16 @@ acpi_setup(void)
> > >  
> > >      dprintf(3, "init ACPI tables\n");
> > >  
> > > +    linker_loader_execute("/etc/linker-script");
> > > +
> > > +    RsdpAddr = acpi_find_rsdp_rom();
> > > +
> > > +    if (RsdpAddr) {
> > > +        return;
> > > +    }
> > 
> > I don't understand this.  Why not use the presence of
> > "/etc/linker-script" to determine if ACPI should be produced.
> 
> We can do this but what do we do if linker script is there
> but no rsdp?
> Maybe just add
> 	test -e /etc/linker-script != RsdpAddr
> 	        dprintf(1, "linker script found but no rsdp. Falling back on builtin tables\n");
> 
> Would this address your comment?
> 

And just to clarify, in my eyes it's preferable to use
acpi_find_rsdp_rom which is based on ACPI standard than
look for a specific PV interface.

For example, one can imagine a hypervisor that maps
ACPI tables directly into guest memory. Looking for
rsdp in fseg memory will work, relying on the
linker won't.

> > Also, /etc/linker-script is not very informative - how about something
> > like "/etc/biostables".
> > 
> > -Kevin
> 
> Hmm bios seems redundant, and tables makes one think it's the tables
> themselves.
> 
> "/etc/acpi-linker"
> "/etc/acpi-loader"?
> 
> 
> -- 
> MST

  reply	other threads:[~2013-07-15  9:57 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-07 15:42 [Qemu-devel] [PATCH v2 0/5] seabios: load acpi tables from qemu Michael S. Tsirkin
2013-07-07 15:42 ` [Qemu-devel] [PATCH v2 1/5] linker: utility to patch in-memory ROM files Michael S. Tsirkin
2013-07-14 18:24   ` [Qemu-devel] [SeaBIOS] " Kevin O'Connor
2013-07-15  8:01     ` Michael S. Tsirkin
2013-07-25 12:55       ` Michael S. Tsirkin
2013-07-26  0:06         ` Kevin O'Connor
2013-09-22 10:49           ` Michael S. Tsirkin
2013-09-22 11:18             ` Michael S. Tsirkin
2013-09-22 13:44               ` Michael S. Tsirkin
2013-07-07 15:42 ` [Qemu-devel] [PATCH v2 2/5] pmm: add a way to test whether memory is in FSEG Michael S. Tsirkin
2013-07-07 15:42 ` [Qemu-devel] [PATCH v2 3/5] acpi: pack rsdp Michael S. Tsirkin
2013-07-07 15:42 ` [Qemu-devel] [PATCH v2 4/5] acpi: load and link tables from /etc/acpi/ Michael S. Tsirkin
2013-07-14 18:27   ` [Qemu-devel] [SeaBIOS] " Kevin O'Connor
2013-07-15  8:11     ` Michael S. Tsirkin
2013-07-15  9:58       ` Michael S. Tsirkin [this message]
2013-07-07 15:42 ` [Qemu-devel] [PATCH v2 5/5] acpi: add an option to disable builtin tables 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=20130715095851.GA1277@redhat.com \
    --to=mst@redhat.com \
    --cc=kevin@koconnor.net \
    --cc=qemu-devel@nongnu.org \
    --cc=seabios@seabios.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 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).