public inbox for linuxppc-dev@ozlabs.org
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: David Howells <dhowells@redhat.com>
Cc: linuxppc-dev@ozlabs.org
Subject: Re: [PATCH] NOMMU: Rename PowerPC's struct vm_region
Date: Fri, 12 Dec 2008 21:15:12 +1100	[thread overview]
Message-ID: <1229076912.22413.213.camel@pasglop> (raw)
In-Reply-To: <20081211125354.20641.23213.stgit@warthog.procyon.org.uk>

On Thu, 2008-12-11 at 12:53 +0000, David Howells wrote:
> Rename PowerPC's struct vm_region so that I can introduce my own global version
> for NOMMU.  It's feasible that the PowerPC version may wish to use my global
> one instead.
> 
> The NOMMU vm_region struct defines areas of the physical memory map that are
> under mmap.  This may include chunks of RAM or regions of memory mapped
> devices, such as flash.  It is also used to retain copies of file content so
> that shareable private memory mappings of files can be made.  As such, it may
> be compatible with what is described in the banner comment for PowerPC's
> vm_region struct.

Hrm... that whole dma-noncoherent stuff still eludes me as to why it
uses it's own region allocator instead of the vmalloc one .. since you
can use the later with explicit boundaries.

Cheers,
Ben.

> Signed-off-by: David Howells <dhowells@redhat.com>
> ---
> 
>  arch/powerpc/lib/dma-noncoherent.c |   24 ++++++++++++------------
>  1 files changed, 12 insertions(+), 12 deletions(-)
> 
> 
> diff --git a/arch/powerpc/lib/dma-noncoherent.c b/arch/powerpc/lib/dma-noncoherent.c
> index 31734c0..a55c6ca 100644
> --- a/arch/powerpc/lib/dma-noncoherent.c
> +++ b/arch/powerpc/lib/dma-noncoherent.c
> @@ -77,26 +77,26 @@ static DEFINE_SPINLOCK(consistent_lock);
>   * the amount of RAM found at boot time.)  I would imagine that get_vm_area()
>   * would have to initialise this each time prior to calling vm_region_alloc().
>   */
> -struct vm_region {
> +struct ppc_vm_region {
>  	struct list_head	vm_list;
>  	unsigned long		vm_start;
>  	unsigned long		vm_end;
>  };
>  
> -static struct vm_region consistent_head = {
> +static struct ppc_vm_region consistent_head = {
>  	.vm_list	= LIST_HEAD_INIT(consistent_head.vm_list),
>  	.vm_start	= CONSISTENT_BASE,
>  	.vm_end		= CONSISTENT_END,
>  };
>  
> -static struct vm_region *
> -vm_region_alloc(struct vm_region *head, size_t size, gfp_t gfp)
> +static struct ppc_vm_region *
> +ppc_vm_region_alloc(struct ppc_vm_region *head, size_t size, gfp_t gfp)
>  {
>  	unsigned long addr = head->vm_start, end = head->vm_end - size;
>  	unsigned long flags;
> -	struct vm_region *c, *new;
> +	struct ppc_vm_region *c, *new;
>  
> -	new = kmalloc(sizeof(struct vm_region), gfp);
> +	new = kmalloc(sizeof(struct ppc_vm_region), gfp);
>  	if (!new)
>  		goto out;
>  
> @@ -130,9 +130,9 @@ vm_region_alloc(struct vm_region *head, size_t size, gfp_t gfp)
>  	return NULL;
>  }
>  
> -static struct vm_region *vm_region_find(struct vm_region *head, unsigned long addr)
> +static struct ppc_vm_region *ppc_vm_region_find(struct ppc_vm_region *head, unsigned long addr)
>  {
> -	struct vm_region *c;
> +	struct ppc_vm_region *c;
>  
>  	list_for_each_entry(c, &head->vm_list, vm_list) {
>  		if (c->vm_start == addr)
> @@ -151,7 +151,7 @@ void *
>  __dma_alloc_coherent(size_t size, dma_addr_t *handle, gfp_t gfp)
>  {
>  	struct page *page;
> -	struct vm_region *c;
> +	struct ppc_vm_region *c;
>  	unsigned long order;
>  	u64 mask = 0x00ffffff, limit; /* ISA default */
>  
> @@ -191,7 +191,7 @@ __dma_alloc_coherent(size_t size, dma_addr_t *handle, gfp_t gfp)
>  	/*
>  	 * Allocate a virtual address in the consistent mapping region.
>  	 */
> -	c = vm_region_alloc(&consistent_head, size,
> +	c = ppc_vm_region_alloc(&consistent_head, size,
>  			    gfp & ~(__GFP_DMA | __GFP_HIGHMEM));
>  	if (c) {
>  		unsigned long vaddr = c->vm_start;
> @@ -239,7 +239,7 @@ EXPORT_SYMBOL(__dma_alloc_coherent);
>   */
>  void __dma_free_coherent(size_t size, void *vaddr)
>  {
> -	struct vm_region *c;
> +	struct ppc_vm_region *c;
>  	unsigned long flags, addr;
>  	pte_t *ptep;
>  
> @@ -247,7 +247,7 @@ void __dma_free_coherent(size_t size, void *vaddr)
>  
>  	spin_lock_irqsave(&consistent_lock, flags);
>  
> -	c = vm_region_find(&consistent_head, (unsigned long)vaddr);
> +	c = ppc_vm_region_find(&consistent_head, (unsigned long)vaddr);
>  	if (!c)
>  		goto no_area;
>  
> 
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-dev

      parent reply	other threads:[~2008-12-12 10:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-11 12:53 [PATCH] NOMMU: Rename PowerPC's struct vm_region David Howells
2008-12-11 14:37 ` Josh Boyer
2008-12-11 14:54   ` David Howells
2008-12-12 10:15 ` Benjamin Herrenschmidt [this message]

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=1229076912.22413.213.camel@pasglop \
    --to=benh@kernel.crashing.org \
    --cc=dhowells@redhat.com \
    --cc=linuxppc-dev@ozlabs.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox