LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: venkatesh.pallipadi@intel.com
To: ak@muc.de, ebiederm@xmission.com, rdreier@cisco.com,
	torvalds@linux-foundation.org, gregkh@suse.de, airlied@skynet.ie,
	davej@redhat.com, mingo@elte.hu, tglx@linutronix.de,
	hpa@zytor.com, akpm@linux-foundation.org, arjan@infradead.org,
	jesse.barnes@intel.com, davem@davemloft.net
Cc: linux-kernel@vger.kernel.org,
	Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>,
	Suresh Siddha <suresh.b.siddha@intel.com>
Subject: [patch 06/11] PAT x86: Refactoring i386 cpa
Date: Thu, 10 Jan 2008 10:48:46 -0800	[thread overview]
Message-ID: <20080110184855.677758000@intel.com> (raw)
In-Reply-To: <20080110184840.927409000@intel.com>

[-- Attachment #1: cpa_i386.patch --]
[-- Type: text/plain, Size: 2388 bytes --]

This makes 32 bit cpa similar to x86_64 and makes it easier for following PAT
patches.

Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>

Index: linux-2.6.git/arch/x86/mm/pageattr_32.c
===================================================================
--- linux-2.6.git.orig/arch/x86/mm/pageattr_32.c	2008-01-08 04:05:24.000000000 -0800
+++ linux-2.6.git/arch/x86/mm/pageattr_32.c	2008-01-08 05:10:44.000000000 -0800
@@ -153,15 +153,12 @@
 		list_add(&kpte_page->lru, &df_list);
 }
 
-static int __change_page_attr(struct page *page, pgprot_t prot)
+static int __change_page_attr(unsigned long address, unsigned long pfn,
+                              pgprot_t prot)
 {
 	struct page *kpte_page;
-	unsigned long address;
 	pte_t *kpte;
 
-	BUG_ON(PageHighMem(page));
-	address = (unsigned long)page_address(page);
-
 	kpte = lookup_address(address);
 	if (!kpte)
 		return -EINVAL;
@@ -172,7 +169,7 @@
 
 	if (pgprot_val(prot) != pgprot_val(PAGE_KERNEL)) {
 		if (!pte_huge(*kpte)) {
-			set_pte_atomic(kpte, mk_pte(page, prot));
+			set_pte_atomic(kpte, pfn_pte(pfn, prot));
 		} else {
 			struct page *split;
 			pgprot_t ref_prot;
@@ -190,7 +187,7 @@
 		page_private(kpte_page)++;
 	} else {
 		if (!pte_huge(*kpte)) {
-			set_pte_atomic(kpte, mk_pte(page, PAGE_KERNEL));
+			set_pte_atomic(kpte, pfn_pte(pfn, PAGE_KERNEL));
 			BUG_ON(page_private(kpte_page) == 0);
 			page_private(kpte_page)--;
 		} else
@@ -231,14 +228,15 @@
  *
  * Caller must call global_flush_tlb() after this.
  */
-int change_page_attr(struct page *page, int numpages, pgprot_t prot)
+int change_page_attr_addr(unsigned long address, int numpages, pgprot_t prot)
 {
 	unsigned long flags;
 	int err = 0, i;
 
 	spin_lock_irqsave(&cpa_lock, flags);
-	for (i = 0; i < numpages; i++, page++) {
-		err = __change_page_attr(page, prot);
+	for (i = 0; i < numpages; i++, address += PAGE_SIZE) {
+		unsigned long pfn = __pa(address) >> PAGE_SHIFT;
+		err = __change_page_attr(address, pfn, prot);
 		if (err)
 			break;
 	}
@@ -248,6 +246,12 @@
 }
 EXPORT_SYMBOL(change_page_attr);
 
+int change_page_attr(struct page *page, int numpages, pgprot_t prot)
+{
+	unsigned long addr = (unsigned long)page_address(page);
+	return change_page_attr_addr(addr, numpages, prot);
+}
+
 void global_flush_tlb(void)
 {
 	struct page *pg, *next;

-- 

  parent reply	other threads:[~2008-01-10 18:56 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-10 18:48 [patch 00/11] PAT x86: PAT support for x86 venkatesh.pallipadi
2008-01-10 18:48 ` [patch 01/11] PAT x86: Make acpi/other drivers map memory instead of assuming identity map venkatesh.pallipadi
2008-01-10 18:48 ` [patch 02/11] PAT x86: Map only usable memory in x86_64 identity map and kernel text venkatesh.pallipadi
2008-01-10 19:06   ` Andi Kleen
2008-01-10 19:17     ` Pallipadi, Venkatesh
2008-01-10 19:28       ` Andi Kleen
2008-01-10 20:50         ` Pallipadi, Venkatesh
2008-01-10 21:16           ` Andi Kleen
2008-01-10 22:25             ` Pallipadi, Venkatesh
2008-01-10 22:35               ` Andi Kleen
2008-01-14 16:43           ` Ingo Molnar
2008-01-14 21:21             ` Siddha, Suresh B
2008-01-14 21:28               ` Andi Kleen
2008-01-15 22:17               ` Ingo Molnar
2008-01-15 23:11                 ` Andi Kleen
2008-01-15 23:21                 ` Siddha, Suresh B
2008-01-18 12:01                   ` Ingo Molnar
2008-01-18 13:12                     ` Andi Kleen
2008-01-18 16:46                       ` Jesse Barnes
2008-01-18 18:12                         ` Andi Kleen
2008-01-18 19:02                           ` Jesse Barnes
2008-01-19  2:42                             ` Andi Kleen
2008-01-10 21:05   ` Linus Torvalds
2008-01-10 21:57     ` Pallipadi, Venkatesh
2008-01-10 22:15       ` Linus Torvalds
2008-01-10 22:27         ` Pallipadi, Venkatesh
2008-01-10 22:50         ` Valdis.Kletnieks
2008-01-18 18:27           ` Dave Jones
2008-01-18 20:54             ` Ingo Molnar
2008-01-10 18:48 ` [patch 03/11] PAT x86: Map only usable memory in i386 identity map venkatesh.pallipadi
2008-01-10 19:10   ` Andi Kleen
2008-01-10 18:48 ` [patch 04/11] PAT x86: Basic PAT implementation venkatesh.pallipadi
2008-01-10 18:48 ` [patch 05/11] PAT x86: drm driver changes for PAT venkatesh.pallipadi
2008-01-10 18:48 ` venkatesh.pallipadi [this message]
2008-01-10 19:00   ` [patch 06/11] PAT x86: Refactoring i386 cpa Andi Kleen
2008-01-14 16:47     ` Ingo Molnar
2008-01-10 18:48 ` [patch 07/11] PAT x86: pat-conflict resolution using linear list venkatesh.pallipadi
2008-01-10 19:13   ` Andi Kleen
2008-01-10 20:08     ` Pallipadi, Venkatesh
2008-01-10 18:48 ` [patch 08/11] PAT x86: pci mmap conlfict patch venkatesh.pallipadi
2008-01-10 18:48 ` [patch 09/11] PAT x86: Add ioremap_wc support venkatesh.pallipadi
2008-01-10 19:08   ` Andi Kleen
2008-01-10 19:25     ` Pallipadi, Venkatesh
2008-01-12  0:18       ` Roland Dreier
2008-01-10 18:48 ` [patch 10/11] PAT x86: Handle /dev/mem mappings venkatesh.pallipadi
2008-01-10 18:48 ` [patch 11/11] PAT x86: Expose uc and wc interfaces in /sysfs vor pci_mmap_resource venkatesh.pallipadi
2008-01-10 19:43   ` Greg KH
2008-01-10 20:54     ` [patch 11/11] PAT x86: Expose uc and wc interfaces in /sysfsvor pci_mmap_resource Pallipadi, Venkatesh

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=20080110184855.677758000@intel.com \
    --to=venkatesh.pallipadi@intel.com \
    --cc=airlied@skynet.ie \
    --cc=ak@muc.de \
    --cc=akpm@linux-foundation.org \
    --cc=arjan@infradead.org \
    --cc=davej@redhat.com \
    --cc=davem@davemloft.net \
    --cc=ebiederm@xmission.com \
    --cc=gregkh@suse.de \
    --cc=hpa@zytor.com \
    --cc=jesse.barnes@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=rdreier@cisco.com \
    --cc=suresh.b.siddha@intel.com \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --subject='Re: [patch 06/11] PAT x86: Refactoring i386 cpa' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).