Message ID | 1464670986-10256-7-git-send-email-zhaoshenglong@huawei.com |
---|---|
State | New |
Headers | show |
Hello Shannon, It just occurred to me that the way to build the ACPI tables, I am not speaking about the value, is very similar to what QEMU does. Perhaps, we should copy the copyright from QEMU in libxl_arm.c. In this case, moving the ACPI code in a separate file would be the best. On 31/05/16 06:02, Shannon Zhao wrote: > From: Shannon Zhao <shannon.zhao@linaro.org> > > Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org> > --- > tools/libxl/libxl_arm.c | 23 +++++++++++++++++++++++ > 1 file changed, 23 insertions(+) > > diff --git a/tools/libxl/libxl_arm.c b/tools/libxl/libxl_arm.c > index 0fb4f69..c3b8fb4 100644 > --- a/tools/libxl/libxl_arm.c > +++ b/tools/libxl/libxl_arm.c > @@ -922,6 +922,28 @@ static void make_acpi_gtdt(libxl__gc *gc, struct xc_dom_image *dom) > dom->acpitable_size += dom->acpitable_blob->gtdt.size; > } > > +static void make_acpi_fadt(libxl__gc *gc, struct xc_dom_image *dom) > +{ > + struct acpi_fadt_descriptor *fadt; > + > + fadt = libxl__zalloc(gc, sizeof(*fadt)); > + > + /* Hardware Reduced = 1 and use PSCI 0.2+ and with HVC */ > + fadt->flags = 1 << ACPI_FADT_F_HW_REDUCED_ACPI; > + fadt->arm_boot_flags = (1 << ACPI_FADT_ARM_USE_PSCI_G_0_2) | > + (1 << ACPI_FADT_ARM_PSCI_USE_HVC); > + > + /* ACPI v5.1 (fadt->revision.fadt->minor_revision) */ > + fadt->minor_revision = 0x1; > + > + make_acpi_header(&fadt->header, "FACP", sizeof(*fadt), 5); > + > + dom->acpitable_blob->fadt.table = (void *)fadt; pointless cast. > + /* Align to 64bit. */ I am not sure what the comment is for. > + dom->acpitable_blob->fadt.size = sizeof(*fadt); > + dom->acpitable_size += dom->acpitable_blob->fadt.size; > +} > + > static int prepare_acpi(libxl__gc *gc, libxl_domain_build_info *info, > libxl__domain_build_state *state, > struct xc_dom_image *dom) > @@ -943,6 +965,7 @@ static int prepare_acpi(libxl__gc *gc, libxl_domain_build_info *info, > dom->acpitable_size = 0; > > make_acpi_gtdt(gc, dom); > + make_acpi_fadt(gc, dom); > > return 0; > } > Regards,
On 2016年06月07日 21:17, Julien Grall wrote: > Hello Shannon, > > It just occurred to me that the way to build the ACPI tables, I am not > speaking about the value, is very similar to what QEMU does. > Yeah, TBH, I really refer to that in QEMU and there is no special difference between them to build the tables. And it's also similar to what we do to generate the ACPI tables for Dom0.
On 07/06/16 15:13, Shannon Zhao wrote: > On 2016年06月07日 21:17, Julien Grall wrote: >> Hello Shannon, >> >> It just occurred to me that the way to build the ACPI tables, I am not >> speaking about the value, is very similar to what QEMU does. >> > Yeah, TBH, I really refer to that in QEMU and there is no special > difference between them to build the tables. And it's also similar to > what we do to generate the ACPI tables for Dom0. We have to retain the copyright then. Regards,
diff --git a/tools/libxl/libxl_arm.c b/tools/libxl/libxl_arm.c index 0fb4f69..c3b8fb4 100644 --- a/tools/libxl/libxl_arm.c +++ b/tools/libxl/libxl_arm.c @@ -922,6 +922,28 @@ static void make_acpi_gtdt(libxl__gc *gc, struct xc_dom_image *dom) dom->acpitable_size += dom->acpitable_blob->gtdt.size; } +static void make_acpi_fadt(libxl__gc *gc, struct xc_dom_image *dom) +{ + struct acpi_fadt_descriptor *fadt; + + fadt = libxl__zalloc(gc, sizeof(*fadt)); + + /* Hardware Reduced = 1 and use PSCI 0.2+ and with HVC */ + fadt->flags = 1 << ACPI_FADT_F_HW_REDUCED_ACPI; + fadt->arm_boot_flags = (1 << ACPI_FADT_ARM_USE_PSCI_G_0_2) | + (1 << ACPI_FADT_ARM_PSCI_USE_HVC); + + /* ACPI v5.1 (fadt->revision.fadt->minor_revision) */ + fadt->minor_revision = 0x1; + + make_acpi_header(&fadt->header, "FACP", sizeof(*fadt), 5); + + dom->acpitable_blob->fadt.table = (void *)fadt; + /* Align to 64bit. */ + dom->acpitable_blob->fadt.size = sizeof(*fadt); + dom->acpitable_size += dom->acpitable_blob->fadt.size; +} + static int prepare_acpi(libxl__gc *gc, libxl_domain_build_info *info, libxl__domain_build_state *state, struct xc_dom_image *dom) @@ -943,6 +965,7 @@ static int prepare_acpi(libxl__gc *gc, libxl_domain_build_info *info, dom->acpitable_size = 0; make_acpi_gtdt(gc, dom); + make_acpi_fadt(gc, dom); return 0; }