[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v1 20/20] libxl/acpi: Build ACPI tables for HVMlite guests



On Tue, Jul 05, 2016 at 03:05:19PM -0400, Boris Ostrovsky wrote:
> Signed-off-by: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>
> ---
> 
> Changes in v1:
> * Move to libxl
> * Added populate_acpi_pages()
> * Stash location/size of tables in xc_dom_image (to be used in constructing 
> e820 map)
> * Use libxl allocator
> * Only set XEN_X86_EMU_LAPIC flag if 'apic' option is set.
> * Make acpi_build_tables() return error code
> 
>  .gitignore                   |    4 +
>  tools/libacpi/build.c        |    7 +-
>  tools/libacpi/libacpi.h      |   15 ++-
>  tools/libxl/Makefile         |   17 +++-
>  tools/libxl/libxl_arch.h     |    3 +
>  tools/libxl/libxl_dom.c      |    1 +
>  tools/libxl/libxl_x86.c      |   29 +++--
>  tools/libxl/libxl_x86_acpi.c |  292 
> ++++++++++++++++++++++++++++++++++++++++++
>  tools/libxl/libxl_x86_acpi.h |   21 +++
>  9 files changed, 373 insertions(+), 16 deletions(-)
>  create mode 100644 tools/libxl/libxl_x86_acpi.c
>  create mode 100644 tools/libxl/libxl_x86_acpi.h
> 
> diff --git a/.gitignore b/.gitignore
> index 9dd2086..d4da37f 100644
> --- a/.gitignore
> +++ b/.gitignore
> @@ -179,6 +179,10 @@ tools/libxl/testenum.c
>  tools/libxl/tmp.*
>  tools/libxl/_libxl.api-for-check
>  tools/libxl/*.api-ok
> +tools/libxl/mk_dsdt
> +tools/libxl/dsdt*.c
> +tools/libxl/dsdt_*.asl
> +tools/libxl/ssdt_*.h

Please sort these alphabetically.

>  tools/misc/cpuperf/cpuperf-perfcntr
>  tools/misc/cpuperf/cpuperf-xen
>  tools/misc/xc_shadow
> diff --git a/tools/libacpi/build.c b/tools/libacpi/build.c
> index 290f005..a6ddf53 100644
> --- a/tools/libacpi/build.c
> +++ b/tools/libacpi/build.c
> @@ -23,6 +23,7 @@
>  #include "ssdt_tpm.h"
>  #include "ssdt_pm.h"
>  #include "x86.h"
> +#include <xen/hvm/hvm_info_table.h>
>  #include <xen/hvm/hvm_xs_strings.h>
>  #include <xen/hvm/params.h>
>  
[...]
> +int libxl__dom_load_acpi(libxl__gc *gc,
> +                      libxl_domain_build_info *info,
> +                      struct xc_dom_image *dom);

Indentation.

>  #endif
> diff --git a/tools/libxl/libxl_dom.c b/tools/libxl/libxl_dom.c
> index ba3472e..7e4e289 100644
> --- a/tools/libxl/libxl_dom.c
> +++ b/tools/libxl/libxl_dom.c
> @@ -657,6 +657,7 @@ static int libxl__build_dom(libxl__gc *gc, uint32_t domid,
>          LOGE(ERROR, "xc_dom_build_image failed");
>          goto out;
>      }
> +

Stray blank line.

>      if ( (ret = xc_dom_boot_image(dom)) != 0 ) {
>          LOGE(ERROR, "xc_dom_boot_image failed");
>          goto out;
> diff --git a/tools/libxl/libxl_x86.c b/tools/libxl/libxl_x86.c
> index 32ce1d2..7201dbb 100644
> --- a/tools/libxl/libxl_x86.c
> +++ b/tools/libxl/libxl_x86.c
[...]
> +int libxl__dom_load_acpi(libxl__gc *gc,
> +                      libxl_domain_build_info *info,
> +                      struct xc_dom_image *dom)
> +{
> +    struct acpi_config config = {0};
> +    struct acpi_ctxt ctxt;
> +    uint32_t domid = dom->guest_domid;
> +    xc_interface *xch = dom->xch;
> +    int rc, i, acpi_pages_num;
> +    xen_pfn_t extent, *extents;
> +    void *acpi_pages, *guest_acpi_pages = NULL;
> +    unsigned long page_mask;
> +
> +    if ((info->type != LIBXL_DOMAIN_TYPE_HVM) ||
> +        (info->device_model_version != LIBXL_DEVICE_MODEL_VERSION_NONE))
> +        return 0;
> +
> +    ctxt.page_size = XC_DOM_PAGE_SIZE(dom);
> +    ctxt.page_shift = XC_DOM_PAGE_SHIFT(dom);
> +    page_mask = (1UL << ctxt.page_shift) - 1;
> +
> +    ctxt.mem_ops.alloc = mem_alloc;
> +    ctxt.mem_ops.v2p = virt_to_phys;
> +
> +    rc = init_acpi_config(gc, dom, info, &config);
> +    if (rc) {
> +        LOG(ERROR, "%s: init_acpi_config failed (rc=%d)", __FUNCTION__, rc);
> +        return rc;
> +    }
> +
> +    /* Map page that will hold RSDP */
> +    extent = RSDP_ADDRESS >> ctxt.page_shift;
> +    rc = populate_acpi_pages(dom, &extent, 1, &ctxt);
> +    if (rc) {
> +        LOG(ERROR, "%s: populate_acpi_pages for rsdp failed with %d",
> +            __FUNCTION__, rc);
> +        goto out;
> +    }
> +    config.rsdp = (unsigned long)xc_map_foreign_range(xch, domid,
> +                                                      ctxt.page_size,
> +                                                      PROT_READ | PROT_WRITE,
> +                                                      RSDP_ADDRESS >> 
> ctxt.page_shift);

I think with Anthony's on-going work you should be more flexible for all
you tables.

I haven't really looked into details for this patch. Let's sort out
the linkage issue between GPLv2 cod and LGPL code first.

Wei.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.