xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
	xen-devel@lists.xensource.com
Cc: julien.grall@citrix.com, ian.campbell@citrix.com
Subject: Re: [PATCH 2/2] xen/arm: support compressed kernels
Date: Wed, 12 Aug 2015 17:35:42 +0100	[thread overview]
Message-ID: <55CB75DE.1090102@citrix.com> (raw)
In-Reply-To: <1439390875-21256-2-git-send-email-stefano.stabellini@eu.citrix.com>

On 12/08/15 15:47, Stefano Stabellini wrote:
> Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
> CC: julien.grall@citrix.com
> CC: ian.campbell@citrix.com
> ---
>  xen/arch/arm/kernel.c           |   36 ++++++++++++++++++++++++++++++++++++
>  xen/common/Makefile             |    2 +-
>  xen/include/asm-arm/byteorder.h |    2 ++
>  3 files changed, 39 insertions(+), 1 deletion(-)
>
> diff --git a/xen/arch/arm/kernel.c b/xen/arch/arm/kernel.c
> index f641b12..ca50cdd 100644
> --- a/xen/arch/arm/kernel.c
> +++ b/xen/arch/arm/kernel.c
> @@ -13,6 +13,8 @@
>  #include <asm/byteorder.h>
>  #include <asm/setup.h>
>  #include <xen/libfdt/libfdt.h>
> +#include <xen/decompress.h>
> +#include <xen/vmap.h>
>  
>  #include "kernel.h"
>  
> @@ -310,6 +312,38 @@ static int kernel_zimage64_probe(struct kernel_info *info,
>  
>      return 0;
>  }
> +
> +static int kernel_zimage64_compressed_probe(struct kernel_info *info,
> +                                 paddr_t addr, paddr_t size)
> +{
> +    char *output, *input;
> +    unsigned char magic[2];
> +    int rc;
> +    unsigned kernel_order_in;
> +    unsigned kernel_order_out;
> +    paddr_t output_size;
> +    
> +    copy_from_paddr(magic, addr, sizeof(magic));

Need a size check before assuming sufficient length.  (All of the arm
probe functions suffer in a similar way.)

> +
> +    if (!((magic[0] == 0x1f) && ((magic[1] == 0x8b) || (magic[1] == 0x9e))))
> +        return -EINVAL;
> +
> +    kernel_order_in = get_order_from_bytes(size);
> +    input = (char *)ioremap_cache(addr, size);
> +
> +    output_size = output_length(input, size);
> +    kernel_order_out = get_order_from_bytes(output_size);
> +    output = (char *)alloc_xenheap_pages(kernel_order_out, 0);
> +
> +    rc = decompress(input, size, output);
> +    clean_dcache_va_range(output, output_size);
> +    iounmap(input);
> +
> +    if (rc != 0)

Xen style.

~Andrew

  parent reply	other threads:[~2015-08-12 16:35 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-12 14:47 [PATCH 0/2] support compressed kernels on ARM64 Stefano Stabellini
2015-08-12 14:47 ` [PATCH 1/2] xen: move perform_gunzip to common Stefano Stabellini
2015-08-12 15:14   ` Jan Beulich
2015-08-12 16:15     ` Stefano Stabellini
2015-08-13  6:29       ` Jan Beulich
2015-08-13  9:28         ` Stefano Stabellini
2015-08-13  9:57           ` Jan Beulich
2015-08-13 10:17             ` Ian Campbell
2015-08-13 10:27               ` Jan Beulich
2015-08-12 14:47 ` [PATCH 2/2] xen/arm: support compressed kernels Stefano Stabellini
2015-08-12 15:03   ` Ian Campbell
2015-08-12 15:20     ` Julien Grall
2015-08-12 15:22     ` Stefano Stabellini
2015-08-12 15:27       ` Julien Grall
2015-08-12 15:35       ` Jan Beulich
2015-08-12 15:40         ` Stefano Stabellini
2015-08-12 15:43       ` Ian Campbell
2015-08-12 15:09   ` Julien Grall
2015-08-12 16:35   ` Andrew Cooper [this message]
2015-08-12 17:00     ` Julien Grall

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55CB75DE.1090102@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=ian.campbell@citrix.com \
    --cc=julien.grall@citrix.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).