[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH RESEND 05/14] libxl/arm: Construct ACPI GTDT table
On Tue, May 31, 2016 at 01:02:57PM +0800, Shannon Zhao wrote: > From: Shannon Zhao <shannon.zhao@xxxxxxxxxx> > > Construct GTDT table with the interrupt information of timers. > > Signed-off-by: Shannon Zhao <shannon.zhao@xxxxxxxxxx> > --- > tools/libxl/libxl_arm.c | 75 > ++++++++++++++++++++++++++++++++++++++++++++++++- > 1 file changed, 74 insertions(+), 1 deletion(-) > > diff --git a/tools/libxl/libxl_arm.c b/tools/libxl/libxl_arm.c > index 9e99159..0fb4f69 100644 > --- a/tools/libxl/libxl_arm.c > +++ b/tools/libxl/libxl_arm.c > @@ -3,6 +3,7 @@ > #include "libxl_libfdt_compat.h" > > #include <xc_dom.h> > +#include <acpi_defs.h> > #include <stdbool.h> > #include <libfdt.h> > #include <assert.h> > @@ -880,13 +881,85 @@ out: > return rc; > } > > +static void make_acpi_header(struct acpi_table_header *h, const char *sig, > + int len, uint8_t rev) > +{ > + memcpy(&h->signature, sig, 4); > + h->length = len; > + h->revision = rev; > + memcpy(h->oem_id, ACPI_BUILD_APPNAME6, 6); > + memcpy(h->oem_table_id, ACPI_BUILD_APPNAME4, 4); > + memcpy(h->oem_table_id + 4, sig, 4); > + h->oem_revision = 1; > + memcpy(h->asl_compiler_id, ACPI_BUILD_APPNAME4, 4); > + h->asl_compiler_revision = 1; > + h->checksum = 0; > +} > + > +static void make_acpi_gtdt(libxl__gc *gc, struct xc_dom_image *dom) > +{ > + struct acpi_gtdt_descriptor *gtdt; > + > + gtdt = libxl__zalloc(gc, sizeof(*gtdt)); > + > + gtdt->secure_el1_interrupt = GUEST_TIMER_PHYS_S_PPI; > + gtdt->secure_el1_flags = (ACPI_LEVEL_SENSITIVE << > ACPI_GTDT_INTERRUPT_MODE) > + |(ACPI_ACTIVE_LOW << > ACPI_GTDT_INTERRUPT_POLARITY); > + gtdt->non_secure_el1_interrupt = GUEST_TIMER_PHYS_NS_PPI; > + gtdt->non_secure_el1_flags = > + (ACPI_LEVEL_SENSITIVE << > ACPI_GTDT_INTERRUPT_MODE) > + |(ACPI_ACTIVE_LOW << > ACPI_GTDT_INTERRUPT_POLARITY); > + gtdt->virtual_timer_interrupt = GUEST_TIMER_VIRT_PPI; > + gtdt->virtual_timer_flags = > + (ACPI_LEVEL_SENSITIVE << > ACPI_GTDT_INTERRUPT_MODE) > + |(ACPI_ACTIVE_LOW << > ACPI_GTDT_INTERRUPT_POLARITY); > + > + make_acpi_header(>dt->header, "GTDT", sizeof(*gtdt), 2); > + > + dom->acpitable_blob->gtdt.table = (void *)gtdt; > + /* Align to 64bit. */ > + dom->acpitable_blob->gtdt.size = sizeof(*gtdt); > + dom->acpitable_size += dom->acpitable_blob->gtdt.size; > +} > + > +static int prepare_acpi(libxl__gc *gc, libxl_domain_build_info *info, > + libxl__domain_build_state *state, > + struct xc_dom_image *dom) libxl__prepare_acpi I would also suggest moving ACPI related functions to a dedicated file (libxl_arm_acpi.c) so that the possible future merger with x86 code can be made easier. Wei. _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |