[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 23/38] arm: use correct attributes for mappings in copy_from_paddr()



On Fri, 1 Jun 2012, Ian Campbell wrote:
> The DTB is in RAM (hence bufferable), kernel is in flash and therefor requires
> a device type mapping (hence dev shared).
> 
> Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
> ---
>  xen/arch/arm/kernel.c       |    8 ++++----
>  xen/arch/arm/setup.c        |    2 +-
>  xen/include/asm-arm/setup.h |    2 +-
>  3 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/xen/arch/arm/kernel.c b/xen/arch/arm/kernel.c
> index 130d488..1a705c9 100644
> --- a/xen/arch/arm/kernel.c
> +++ b/xen/arch/arm/kernel.c
> @@ -39,7 +39,7 @@ struct minimal_dtb_header {
>   * @paddr: source physical address
>   * @len: length to copy
>   */
> -void copy_from_paddr(void *dst, paddr_t paddr, unsigned long len)
> +void copy_from_paddr(void *dst, paddr_t paddr, unsigned long len, int mattr)
>  {
>      void *src = (void *)FIXMAP_ADDR(FIXMAP_MISC);
>  
> @@ -51,7 +51,7 @@ void copy_from_paddr(void *dst, paddr_t paddr, unsigned 
> long len)
>          s = paddr & (PAGE_SIZE-1);
>          l = min(PAGE_SIZE - s, len);
>  
> -        set_fixmap(FIXMAP_MISC, p, DEV_SHARED);
> +        set_fixmap(FIXMAP_MISC, p, mattr);
>          memcpy(dst, src + s, l);
>  
>          paddr += l;
> @@ -111,7 +111,7 @@ static int kernel_try_zimage_prepare(struct kernel_info 
> *info)
>      /*
>       * Check for an appended DTB.
>       */
> -    copy_from_paddr(&dtb_hdr, KERNEL_FLASH_ADDRESS + end - start, 
> sizeof(dtb_hdr));
> +    copy_from_paddr(&dtb_hdr, KERNEL_FLASH_ADDRESS + end - start, 
> sizeof(dtb_hdr), DEV_SHARED);
>      if (be32_to_cpu(dtb_hdr.magic) == DTB_MAGIC) {
>          end += be32_to_cpu(dtb_hdr.total_size);
>      }
> @@ -151,7 +151,7 @@ static int kernel_try_elf_prepare(struct kernel_info 
> *info)
>      if ( info->kernel_img == NULL )
>          panic("Cannot allocate temporary buffer for kernel.\n");
>  
> -    copy_from_paddr(info->kernel_img, KERNEL_FLASH_ADDRESS, 
> KERNEL_FLASH_SIZE);
> +    copy_from_paddr(info->kernel_img, KERNEL_FLASH_ADDRESS, 
> KERNEL_FLASH_SIZE, DEV_SHARED);
>  
>      if ( (rc = elf_init(&info->elf.elf, info->kernel_img, KERNEL_FLASH_SIZE 
> )) != 0 )
>          return rc;
> diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
> index b0cfacc..f5473cd 100644
> --- a/xen/arch/arm/setup.c
> +++ b/xen/arch/arm/setup.c
> @@ -122,7 +122,7 @@ static void __init setup_mm(unsigned long dtb_paddr, 
> size_t dtb_size)
>       * TODO: handle other payloads too.
>       */
>      device_tree_flattened = mfn_to_virt(alloc_boot_pages(dtb_pages, 1));
> -    copy_from_paddr(device_tree_flattened, dtb_paddr, dtb_size);
> +    copy_from_paddr(device_tree_flattened, dtb_paddr, dtb_size, BUFFERABLE);
>  
>      /* Add non-xenheap memory */
>      init_boot_pages(pfn_to_paddr(xenheap_mfn_start + xenheap_pages),
> diff --git a/xen/include/asm-arm/setup.h b/xen/include/asm-arm/setup.h
> index 05ff89e..faadccc 100644
> --- a/xen/include/asm-arm/setup.h
> +++ b/xen/include/asm-arm/setup.h
> @@ -3,7 +3,7 @@
>  
>  #include <public/version.h>
>  
> -void copy_from_paddr(void *dst, paddr_t paddr, unsigned long len);
> +void copy_from_paddr(void *dst, paddr_t paddr, unsigned long len, int mattr);
>  
>  void arch_get_xen_caps(xen_capabilities_info_t *info);
>  

The patch is correct, but it shouldn't call the new parameter mattr
because it can easily be confused with the memattr bits (see
http://marc.info/?l=xen-devel&m=133856578918985).
I would call it "int attrindx" instead.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.