linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Dave Airlie <airlied@linux.ie>
To: linux-kernel@vger.kernel.org
Cc: davej@codemonkey.org.uk, linux-mm@kvack.org
Subject: [PATCH] vm/agp: remove private page protection map
Date: Tue, 18 Jul 2006 19:08:12 +0100 (IST)	[thread overview]
Message-ID: <Pine.LNX.4.64.0607181905140.26533@skynet.skynet.ie> (raw)

AGP keeps its own copy of the protection_map, upcoming DRM changes
will also require access to this map from modules.

Signed-off-by: Dave Airlie <airlied@linux.ie>
---
  drivers/char/agp/frontend.c |    8 +-------
  include/linux/mm.h          |    1 +
  mm/mmap.c                   |    6 ++++++
  3 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/char/agp/frontend.c b/drivers/char/agp/frontend.c
index d9c5a91..1842427 100644
--- a/drivers/char/agp/frontend.c
+++ b/drivers/char/agp/frontend.c
@@ -157,12 +157,6 @@ static void agp_add_seg_to_client(struct
   * some routine which does the conversion for you
   */

-static const pgprot_t my_protect_map[16] =
-{
-	__P000, __P001, __P010, __P011, __P100, __P101, __P110, __P111,
-	__S000, __S001, __S010, __S011, __S100, __S101, __S110, __S111
-};
-
  static pgprot_t agp_convert_mmap_flags(int prot)
  {
  #define _trans(x,bit1,bit2) \
@@ -177,7 +171,7 @@ ((bit1==bit2)?(x&bit1):(x&bit1)?bit2:0)

  	prot_bits |= VM_SHARED;

-	temp = my_protect_map[prot_bits & 0x0000000f];
+	temp = vm_get_page_prot(prot_bits & 0x0000000f);

  	return temp;
  }
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 990957e..52d6193 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -1012,6 +1012,7 @@ static inline unsigned long vma_pages(st
  	return (vma->vm_end - vma->vm_start) >> PAGE_SHIFT;
  }

+pgprot_t vm_get_page_prot(u8 vm_flags);
  struct vm_area_struct *find_extend_vma(struct mm_struct *, unsigned long addr);
  struct page *vmalloc_to_page(void *addr);
  unsigned long vmalloc_to_pfn(void *addr);
diff --git a/mm/mmap.c b/mm/mmap.c
index c1868ec..d4c9b2a 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -60,6 +60,12 @@ pgprot_t protection_map[16] = {
  	__S000, __S001, __S010, __S011, __S100, __S101, __S110, __S111
  };

+pgprot_t vm_get_page_prot(u8 vm_flags)
+{
+	return protection_map[vm_flags];
+}
+EXPORT_SYMBOL(vm_get_page_prot);
+
  int sysctl_overcommit_memory = OVERCOMMIT_GUESS;  /* heuristic overcommit */
  int sysctl_overcommit_ratio = 50;	/* default is 50% */
  int sysctl_max_map_count __read_mostly = DEFAULT_MAX_MAP_COUNT;
-- 
1.4.1.ga3e6

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

             reply	other threads:[~2006-07-18 18:08 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-18 18:08 Dave Airlie [this message]
2006-07-18 18:23 ` Dave Jones
2006-07-26 20:39 ` Hugh Dickins
2006-07-26 23:24   ` Dave Airlie
2006-07-26 23:59     ` Dave Jones
2006-07-26 23:59     ` Hugh Dickins
2006-07-27  0:35       ` Dave Jones

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=Pine.LNX.4.64.0607181905140.26533@skynet.skynet.ie \
    --to=airlied@linux.ie \
    --cc=davej@codemonkey.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.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