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

Re: [Xen-devel] [PATCH v2 23/23] libxc/xc_dom_core: Copy ACPI tables to guest space



On 08/11/2016 12:40 PM, Wei Liu wrote:
> On Thu, Aug 04, 2016 at 05:06:51PM -0400, Boris Ostrovsky wrote:
>> Load ACPI modules into guest space
>>
>> Signed-off-by: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>
>> ---
>> v2:
>> * New patch, loosely based on Shannon's ARM patch
>>
>>  tools/libxc/xc_dom_core.c | 92 
>> +++++++++++++++++++++++++++++++++++++++++++++++
>>  1 file changed, 92 insertions(+)
>>
>> diff --git a/tools/libxc/xc_dom_core.c b/tools/libxc/xc_dom_core.c
>> index ebada89..00d870f 100644
>> --- a/tools/libxc/xc_dom_core.c
>> +++ b/tools/libxc/xc_dom_core.c
>> @@ -1040,6 +1040,94 @@ static int xc_dom_build_ramdisk(struct xc_dom_image 
>> *dom)
>>      return -1;
>>  }
>>  
>> +static int populate_acpi_pages(struct xc_dom_image *dom,
>> +                               xen_pfn_t *extents,
>> +                               unsigned int num_pages)
>> +{
>> +    int rc;
>> +    xc_interface *xch = dom->xch;
>> +    uint32_t domid = dom->guest_domid;
>> +    unsigned long idx, first_high_idx = (1ull << (32 - 12));
>> +
> Maybe eliminate these magic numbers?

Well, at least 12 was supposed to be PAGE_SHIFT.

>
>> +    for ( ; num_pages; num_pages--, extents++ )
>> +    {
>> +
>> +        if ( xc_domain_populate_physmap(xch, domid, 1, 0, 0, extents) == 1 )
>> +            continue;
>> +
>> +        if (dom->highmem_end)
>> +        {
>> +            idx = --dom->highmem_end;
>> +            if ( idx == first_high_idx )
>> +                dom->highmem_end = 0;
>> +        }
>> +        else
>> +            idx = --dom->lowmem_end;
>> +
>> +        rc = xc_domain_add_to_physmap(xch, domid,
>> +                                      XENMAPSPACE_gmfn,
>> +                                      idx, *extents);
>> +        if (rc)
>> +            return rc;
>> +    }
>> +
>> +    return 0;
>> +}
>> +
>> +static int xc_dom_load_acpi(struct xc_dom_image *dom)
>> +{
>> +    int j, i = 0;
>> +    unsigned num_pages;
>> +    xen_pfn_t *extents, base;
>> +    void *ptr;
>> +
>> +    while ( (i < MAX_ACPI_MODULES) && dom->acpi_modules[i].length )
>> +    {
>> +        DOMPRINTF("%s: %d bytes at address %lx\n", __FUNCTION__,
>> +                  dom->acpi_modules[i].length,
>> +                  dom->acpi_modules[i].guest_addr_out);
>> +
> AIUI this would spam console. Maybe use DPRINTF here?

I was following (what I thought was) xc_dom_core.c's convention ---
everyone seems to be using DOMPRINTF. I don't think there is any danger
to the console: MAX_ACPI_MODULES is 4. In fact, I can change this to a
'for' loop.

-boris



_______________________________________________
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®.