All of lore.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Feng Tang <feng.tang@intel.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@redhat.com,
	tglx@linutronix.de, feng.tang@intel.com, mingo@elte.hu
Subject: [tip:x86/mrst] x86: Add two helper macros for fixed address mapping
Date: Fri, 8 Oct 2010 10:52:35 GMT	[thread overview]
Message-ID: <tip-5a47c7dae861c3ca3edf178546641909851bf715@git.kernel.org> (raw)
In-Reply-To: <1284361736-23011-3-git-send-email-feng.tang@intel.com>

Commit-ID:  5a47c7dae861c3ca3edf178546641909851bf715
Gitweb:     http://git.kernel.org/tip/5a47c7dae861c3ca3edf178546641909851bf715
Author:     Feng Tang <feng.tang@intel.com>
AuthorDate: Mon, 13 Sep 2010 15:08:54 +0800
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 8 Oct 2010 10:01:46 +0200

x86: Add two helper macros for fixed address mapping

Sometimes fixmap will be used to map an physical address which
is not PAGE align, so to use it we need first map it and then
add the address offset to the mapped fixed address. These 2 new
helpers are suggested by Ingo Molnar to make the process
simpler.

For a physicall address like "phys", a directly usable virtual
address can be get by
	virt = (void *)set_fixmap_offset(fixed_idx, phys);
or
	virt = (void *)set_fixmap_offset_nocache(fixed_idx, phys);
(depends on whether the physical address is cachable or not).

Signed-off-by: Feng Tang <feng.tang@intel.com>
Cc: alan@linux.intel.com
Cc: greg@kroah.com
Cc: x86@kernel.org
LKML-Reference: <1284361736-23011-3-git-send-email-feng.tang@intel.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 arch/x86/include/asm/fixmap.h |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/arch/x86/include/asm/fixmap.h b/arch/x86/include/asm/fixmap.h
index d07b44f..4d293dc 100644
--- a/arch/x86/include/asm/fixmap.h
+++ b/arch/x86/include/asm/fixmap.h
@@ -214,5 +214,20 @@ static inline unsigned long virt_to_fix(const unsigned long vaddr)
 	BUG_ON(vaddr >= FIXADDR_TOP || vaddr < FIXADDR_START);
 	return __virt_to_fix(vaddr);
 }
+
+/* Return an pointer with offset calculated */
+static inline unsigned long __set_fixmap_offset(enum fixed_addresses idx,
+				phys_addr_t phys, pgprot_t flags)
+{
+	__set_fixmap(idx, phys, flags);
+	return fix_to_virt(idx) + (phys & (PAGE_SIZE - 1));
+}
+
+#define set_fixmap_offset(idx, phys)			\
+	__set_fixmap_offset(idx, phys, PAGE_KERNEL)
+
+#define set_fixmap_offset_nocache(idx, phys)			\
+	__set_fixmap_offset(idx, phys, PAGE_KERNEL_NOCACHE)
+
 #endif /* !__ASSEMBLY__ */
 #endif /* _ASM_X86_FIXMAP_H */

  reply	other threads:[~2010-10-08 10:53 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-13  7:08 [PATCH v3 0/4] Enabling patches of 2 early consoles for Intel MID platforms Feng Tang
2010-09-13  7:08 ` [PATCH v3 1/4] x86, mrst: make mrst_identify_cpu() inlne inside mrst.h Feng Tang
2010-09-14 13:43   ` Alan Cox
2010-09-14 17:57     ` Ingo Molnar
2010-09-14 19:50       ` Alan Cox
2010-09-15  8:24         ` Ingo Molnar
2010-09-13  7:08 ` [PATCH v3 2/4] x86: add two helper macros for fixed address mapping Feng Tang
2010-10-08 10:52   ` tip-bot for Feng Tang [this message]
2010-09-13  7:08 ` [PATCH v3 3/4] x86, earlyprintk: add earlyprintk for Intel Moorestown platform Feng Tang
2010-10-08 10:53   ` [tip:x86/mrst] x86, earlyprintk: Add " tip-bot for Feng Tang
2010-09-13  7:08 ` [PATCH v3 4/4] x86, earlyprintk: add hsu early console for Intel Medfield platform Feng Tang
2010-09-21 16:26   ` Konrad Rzeszutek Wilk
2010-09-23 10:08     ` Alan Cox
2010-10-08 10:53   ` [tip:x86/mrst] x86, earlyprintk: Add " tip-bot for Feng Tang
2010-09-13  8:40 ` [PATCH v3 0/4] Enabling patches of 2 early consoles for Intel MID platforms Ingo Molnar
2010-09-13 16:59   ` Greg KH
2010-09-13 18:43     ` Ingo Molnar

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=tip-5a47c7dae861c3ca3edf178546641909851bf715@git.kernel.org \
    --to=feng.tang@intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.