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

Re: [Xen-devel] [PATCH v5 2/2] xen/arm: support gzip compressed kernels



>>> On 08.09.15 at 15:35, <ian.campbell@xxxxxxxxxx> wrote:
> On Mon, 2015-09-07 at 15:25 +0100, Stefano Stabellini wrote:
>> +static __init int kernel_decompress(struct kernel_info *info,
>> +                             paddr_t *addr, paddr_t *size)
>> +{
>> +    char *output, *input, *end;
>> +    char magic[2];
>> +    int rc;
>> +    unsigned kernel_order_out;
>> +    paddr_t output_size;
>> +    struct page_info *pages;
>> +
>> +    if ( *size < 2 )
>> +        return -EINVAL;
>> +
>> +    copy_from_paddr(magic, *addr, sizeof(magic));
>> +
>> +    /* only gzip is supported */
>> +    if ( !gzip_check(magic, *size) )
>> +        return -EINVAL;
>> +
>> +    input = ioremap_cache(*addr, *size);
>> +    if ( input == NULL )
>> +        return -EFAULT;
>> +
>> +    output_size = output_length(input, *size);
>> +    kernel_order_out = get_order_from_bytes(output_size);
>> +    pages = alloc_domheap_pages(NULL, kernel_order_out, 0);
>> +    if ( pages == NULL )
>> +    {
>> +        iounmap(input);
>> +        return -ENOMEM;
>> +    }
>> +    output = page_to_virt(pages);
>> +
>> +    rc = perform_gunzip(output, input, *size);
>> +    clean_dcache_va_range(output, output_size);
>> +    iounmap(input);
>> +
>> +    *addr = virt_to_maddr(output);
> 
> I don't think virt_to_maddr is strictly speaking valid (at the arch
> interface level, our actual implementation may happen to cope) for domheap
> pages, it's only valid for things which are in the linear 1:1 map (~=
> xenheap).
> 
> I think you need page_to_maddr(pages) instead.

Indeed, but then the page_to_virt() a few lines up isn't valid either.

Jan


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


 


Rackspace

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