From mboxrd@z Thu Jan 1 00:00:00 1970 From: Julien Grall Subject: Re: [PATCH v4 2/2] xen/arm: support gzip compressed kernels Date: Thu, 3 Sep 2015 19:27:33 +0100 Message-ID: <55E89115.2040800@citrix.com> References: <1441302896-7621-2-git-send-email-stefano.stabellini@eu.citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1441302896-7621-2-git-send-email-stefano.stabellini@eu.citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Stefano Stabellini , xen-devel@lists.xensource.com Cc: ian.campbell@citrix.com List-Id: xen-devel@lists.xenproject.org Hi Stefano, On 03/09/15 18:54, Stefano Stabellini wrote: > Free the memory used for the compressed kernel and update the relative > mod->start and mod->size parameters with the uncompressed ones. > > Signed-off-by: Stefano Stabellini > CC: julien.grall@citrix.com > CC: ian.campbell@citrix.com With the 2 comments coding style changes, see below: Reviewed-by: Julien Grall [...] > +static __init int kernel_decompress(struct kernel_info *info, > + paddr_t *addr, paddr_t *size) > +{ [...] > + end = output + (1 << (kernel_order_out + PAGE_SHIFT)); > + /* Need to free pages after output_size here because they won't be > + * freed by discard_initial_modules */ Multi-line comment on Xen should be: /* * Need ... * freed ... */ > + output += (output_size + PAGE_SIZE - 1) & PAGE_MASK; > + for ( ; output < end; output += PAGE_SIZE ) > + free_domheap_page(virt_to_page(output)); > + > + return 0; > +} > + > #ifdef CONFIG_ARM_64 > /* > * Check if the image is a 64-bit Image. > @@ -463,6 +520,20 @@ int kernel_probe(struct kernel_info *info) > printk("Loading ramdisk from boot module @ %"PRIpaddr"\n", > info->initrd_bootmodule->start); > > + /* if it is a gzip'ed image, 32bit or 64bit, uncompress it */ > + rc = kernel_decompress(info, &start, &size); > + if (rc < 0 && rc != -EINVAL) > + return rc; > + else if (!rc) > + { > + /* Free the original kernel, update the pointers to the > + * decompressed kernel */ Ditto > + dt_unreserved_regions(mod->start, mod->start + mod->size, > + init_domheap_pages, 0); > + mod->start = start; > + mod->size = size; > + } > + > #ifdef CONFIG_ARM_64 > rc = kernel_zimage64_probe(info, start, size); > if (rc < 0) Regards, -- Julien Grall