All of lore.kernel.org
 help / color / mirror / Atom feed
From: Igor Mammedov <imammedo@redhat.com>
To: Auger Eric <eric.auger@redhat.com>
Cc: qemu-devel@nongnu.org, "Michael S. Tsirkin" <mst@redhat.com>,
	Shannon Zhao <zhaoshenglong@huawei.com>,
	qemu-arm@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v2 09/10] virt_arm: acpi: reuse common build_fadt()
Date: Thu, 1 Mar 2018 17:43:55 +0100	[thread overview]
Message-ID: <20180301174355.2d0ef5ae@redhat.com> (raw)
In-Reply-To: <ad05c82f-eb31-694d-4688-ae250287cfd6@redhat.com>

On Thu, 1 Mar 2018 10:38:52 +0100
Auger Eric <eric.auger@redhat.com> wrote:

[...]
> >>>  {
> >>> @@ -1755,7 +1755,14 @@ void build_fadt(GArray *tbl, BIOSLinker *linker, const AcpiFadtData *f,
> >>>  
> >>>      build_append_gas_from_struct(tbl, &f->reset_reg); /* RESET_REG */
> >>>      build_append_int_noprefix(tbl, f->reset_val, 1); /* RESET_VALUE */
> >>> -    build_append_int_noprefix(tbl, 0, 3); /* Reserved, ACPI 3.0 */  
> I meant we could have assert(f->rev < 6) here
> >>> +    /* Since ACPI 5.1 */
> >>> +    if ((f->rev >= 6) || ((f->rev == 5) && f->minor_ver > 0)) {  
> and remove (f->rev >= 6) as in any case rev6 is not supported
> (Hypervisor Vendor Identity field (8 byte) not duly added).
> 
> Or do I miss something?
Nope, you are right.
I've missed 'code above' part and didn't get suggestion the first time.

The reason why I didn't assert here is to keep this part
(in the middle of table) working correctly without need
to touch it when later revisions will add new fields at
the end of table. So all we would have to do is to add
new code at the end and update assert that sets revision limit.

condition here essentially implements specs, i.e. 
from 5.1 onward reserved space should be used for now defined fields.

We might add similar conditions, for other 'Reserved' fields,
in the future if new revisions start to use them.

> Thanks
> 
> Eric
> >>> +        build_append_int_noprefix(tbl, f->arm_boot_arch, 2); /* ARM_BOOT_ARCH */
> >>> +        /* FADT Minor Version */
> >>> +        build_append_int_noprefix(tbl, f->minor_ver, 1);
> >>> +    } else {
> >>> +        build_append_int_noprefix(tbl, 0, 3); /* Reserved upto ACPI 5.0 */
> >>> +    }
> >>>      build_append_int_noprefix(tbl, 0, 8); /* X_FIRMWARE_CTRL */
> >>>  
> >>>      /* XDSDT address to be filled by Guest linker at runtime */
> >>> @@ -1779,6 +1786,18 @@ void build_fadt(GArray *tbl, BIOSLinker *linker, const AcpiFadtData *f,
> >>>      build_append_gas_from_struct(tbl, &f->gpe0_blk); /* X_GPE0_BLK */
> >>>      build_append_gas(tbl, AML_AS_SYSTEM_MEMORY, 0 , 0, 0, 0); /* X_GPE1_BLK */
> >>>  
> >>> +    if (f->rev <= 4) {
> >>> +        goto build_hdr;
> >>> +    }
> >>> +
> >>> +    /* SLEEP_CONTROL_REG */
> >>> +    build_append_gas(tbl, AML_AS_SYSTEM_MEMORY, 0 , 0, 0, 0);
> >>> +    /* SLEEP_STATUS_REG */
> >>> +    build_append_gas(tbl, AML_AS_SYSTEM_MEMORY, 0 , 0, 0, 0);
> >>> +
> >>> +    /* TODO: extra fields need to be added to support revisions above rev5 */
> >>> +    assert(f->rev == 5);    
> >> My previous comment about asserting here if f->rev != 5 and previous
> >> (f->rev >= 6) check was skipped but that's not a big deal.  
> > I've thought that I've replied to comment,
> > maybe I just didn't get meaning behind question?
> > So I'll try to explain again.
> > 
> > If we reach this point rev must be 5, so f->rev >= 6 would be confusing
> > at this point. When v6 support is added this assert should be moved after
> > v6 stuff and condition is amended to f->rev == 6.
> > 
> >    
> >> Reviewed-by: Eric Auger <eric.auger@redhat.com>  
> > Thanks!
> >   
> >>
> >> Thanks
> >>
> >> Eric  
[...]

  reply	other threads:[~2018-03-01 16:44 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-28 14:23 [Qemu-devel] [PATCH v2 00/10] generalize build_fadt() Igor Mammedov
2018-02-28 14:23 ` [Qemu-devel] [PATCH v2 01/10] acpi: remove unused acpi-dsdt.aml Igor Mammedov
2018-02-28 14:23 ` [Qemu-devel] [PATCH v2 02/10] pc: replace pm object initialization with one-liner in acpi_get_pm_info() Igor Mammedov
2018-02-28 14:23 ` [Qemu-devel] [PATCH v2 03/10] acpi: reuse AcpiGenericAddress instead of Acpi20GenericAddress Igor Mammedov
2018-02-28 14:23 ` [Qemu-devel] [PATCH v2 04/10] acpi: add build_append_gas() helper for Generic Address Structure Igor Mammedov
2018-02-28 14:23 ` [Qemu-devel] [PATCH v2 05/10] acpi: move ACPI_PORT_SMI_CMD define to header it belongs to Igor Mammedov
2018-03-01  8:41   ` Auger Eric
2018-02-28 14:23 ` [Qemu-devel] [PATCH v2 06/10] pc: acpi: isolate FADT specific data into AcpiFadtData structure Igor Mammedov
2018-03-01  8:43   ` Auger Eric
2018-03-01  9:39     ` Igor Mammedov
2018-02-28 14:23 ` [Qemu-devel] [PATCH v2 07/10] pc: acpi: use build_append_foo() API to construct FADT Igor Mammedov
2018-02-28 14:23 ` [Qemu-devel] [PATCH v2 08/10] acpi: move build_fadt() from i386 specific to generic ACPI source Igor Mammedov
2018-02-28 14:23 ` [Qemu-devel] [PATCH v2 09/10] virt_arm: acpi: reuse common build_fadt() Igor Mammedov
2018-03-01  8:51   ` Auger Eric
2018-03-01  9:21     ` Igor Mammedov
2018-03-01  9:38       ` Auger Eric
2018-03-01 16:43         ` Igor Mammedov [this message]
2018-02-28 14:23 ` [Qemu-devel] [PATCH v2 10/10] tests: acpi: don't read all fields in test_acpi_fadt_table() Igor Mammedov
2018-03-01  8:59   ` Auger Eric
2018-03-01  8:52 ` [Qemu-devel] [PATCH v2 00/10] generalize build_fadt() Auger Eric

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=20180301174355.2d0ef5ae@redhat.com \
    --to=imammedo@redhat.com \
    --cc=eric.auger@redhat.com \
    --cc=mst@redhat.com \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=zhaoshenglong@huawei.com \
    /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.