[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH 2/2] xen/arm: support compressed kernels
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@xxxxxxxxxxxxx> > CC: julien.grall@xxxxxxxxxx > CC: ian.campbell@xxxxxxxxxx > --- > 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 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |