All of lore.kernel.org
 help / color / mirror / Atom feed
From: Julien Grall <julien.grall@citrix.com>
To: Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
	xen-devel@lists.xensource.com
Cc: ian.campbell@citrix.com
Subject: Re: [PATCH 2/2] xen/arm: support compressed kernels
Date: Wed, 12 Aug 2015 16:09:44 +0100	[thread overview]
Message-ID: <55CB61B8.90009@citrix.com> (raw)
In-Reply-To: <1439390875-21256-2-git-send-email-stefano.stabellini@eu.citrix.com>

Hi Stefano,

I'm sure you don't support all kind of compressed kernels. Can you
example in the commit message which one you are supporting?

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));
> +
> +    if (!((magic[0] == 0x1f) && ((magic[1] == 0x8b) || (magic[1] == 0x9e))))

Please add a comment to explain what this magic means.

Maybe you want to use gzip_check?

> +        return -EINVAL;
> +
> +    kernel_order_in = get_order_from_bytes(size);
> +    input = (char *)ioremap_cache(addr, size);

Cast not necessary. And please check that we effectively were able to
map the kernel.

> +
> +    output_size = output_length(input, size);
> +    kernel_order_out = get_order_from_bytes(output_size);
> +    output = (char *)alloc_xenheap_pages(kernel_order_out, 0);

Ditto.

> +
> +    rc = decompress(input, size, output);
> +    clean_dcache_va_range(output, output_size);
> +    iounmap(input);
> +
> +    if (rc != 0)
> +        return rc;
> +
> +    return kernel_zimage64_probe(info, virt_to_maddr(output), output_size);
> +}
>  #endif
>  
>  /*
> @@ -466,6 +500,8 @@ int kernel_probe(struct kernel_info *info)
>  #ifdef CONFIG_ARM_64
>      rc = kernel_zimage64_probe(info, start, size);
>      if (rc < 0)
> +        rc = kernel_zimage64_compressed_probe(info, start, size);
> +    if (rc < 0)
>  #endif
>          rc = kernel_uimage_probe(info, start, size);
>      if (rc < 0)

Regards,


-- 
Julien Grall

  parent reply	other threads:[~2015-08-12 15:09 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 [this message]
2015-08-12 16:35   ` Andrew Cooper
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=55CB61B8.90009@citrix.com \
    --to=julien.grall@citrix.com \
    --cc=ian.campbell@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.