Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1467328

Re: [PATCH v2 2/6] powerpc: kexec_file: Add buffer hand-over support for the next kernel

From Thiago Jung Bauermann <bauerman@linux.vnet.ibm.com>
Newsgroups linux.kernel
Subject Re: [PATCH v2 2/6] powerpc: kexec_file: Add buffer hand-over support for the next kernel
Date 2016-08-22 05:40 +0200
Message-ID <s8OfE-Ow-9@gated-at.bofh.it> (permalink)
References <s5xEm-2xg-7@gated-at.bofh.it> <s5xEm-2xg-5@gated-at.bofh.it> <s8O5X-Lh-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Am Montag, 22 August 2016, 11:21:35 schrieb Dave Young:
> On 08/13/16 at 12:18am, Thiago Jung Bauermann wrote:
> > diff --git a/arch/powerpc/kernel/machine_kexec_64.c
> > b/arch/powerpc/kernel/machine_kexec_64.c index
> > a484a6346146..190c652e49b7 100644
> > --- a/arch/powerpc/kernel/machine_kexec_64.c
> > +++ b/arch/powerpc/kernel/machine_kexec_64.c
> > @@ -490,6 +490,60 @@ int arch_kimage_file_post_load_cleanup(struct
> > kimage *image)> 
> >  	return image->fops->cleanup(image->image_loader_data);
> >  
> >  }
> > 
> > +bool kexec_can_hand_over_buffer(void)
> > +{
> > +	return true;
> > +}
> > +
> > +int arch_kexec_add_handover_buffer(struct kimage *image,
> > +				   unsigned long load_addr, unsigned long 
size)
> > +{
> > +	image->arch.handover_buffer_addr = load_addr;
> > +	image->arch.handover_buffer_size = size;
> > +
> > +	return 0;
> > +}
> > +
> > +int kexec_get_handover_buffer(void **addr, unsigned long *size)
> > +{
> > +	int ret;
> > +	u64 start_addr, end_addr;
> > +
> > +	ret = of_property_read_u64(of_chosen,
> > +				   "linux,kexec-handover-buffer-start",
> > +				   &start_addr);
> > +	if (ret == -EINVAL)
> > +		return -ENOENT;
> > +	else if (ret)
> > +		return -EINVAL;
> > +
> > +	ret = of_property_read_u64(of_chosen,
> > "linux,kexec-handover-buffer-end", +				   
&end_addr);
> > +	if (ret == -EINVAL)
> > +		return -ENOENT;
> > +	else if (ret)
> > +		return -EINVAL;
> > +
> > +	*addr =  __va(start_addr);
> > +	/* -end is the first address after the buffer. */
> > +	*size = end_addr - start_addr;
> > +
> > +	return 0;
> > +}
> 
> This depends on dtb, so if IMA want to extend it to arches like x86 in
> the future you will have to think about other way to pass it.
> 
> How about think about a general way now?

The only general way I can think of is by adding a kernel command line 
parameter which the first kernel would pass to the second kernel, but IMHO 
that is ugly, because such parameter wouldn't be useful to a user, and it 
would also be something that, from the perspective of the user, would 
magically appear in the kernel command line of the second kernel...

-- 
[]'s
Thiago Jung Bauermann
IBM Linux Technology Center

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 2/6] powerpc: kexec_file: Add buffer hand-over support for the next kernel Thiago Jung Bauermann <bauerman@linux.vnet.ibm.com> - 2016-08-13 05:20 +0200
  Re: [PATCH v2 2/6] powerpc: kexec_file: Add buffer hand-over support  for the next kernel Dave Young <dyoung@redhat.com> - 2016-08-22 05:30 +0200
    Re: [PATCH v2 2/6] powerpc: kexec_file: Add buffer hand-over support for the next kernel Thiago Jung Bauermann <bauerman@linux.vnet.ibm.com> - 2016-08-22 05:40 +0200
      Re: [PATCH v2 2/6] powerpc: kexec_file: Add buffer hand-over support  for the next kernel Dave Young <dyoung@redhat.com> - 2016-08-22 09:30 +0200
        Re: [PATCH v2 2/6] powerpc: kexec_file: Add buffer hand-over support for the next kernel Thiago Jung Bauermann <bauerman@linux.vnet.ibm.com> - 2016-08-23 00:30 +0200

csiph-web