From: Jesse Barnes <jbarnes@sgi.com>
To: linux-ia64@vger.kernel.org
Subject: Re: pgprot_writecombine & shub 1.x
Date: Wed, 19 Jan 2005 22:53:00 +0000 [thread overview]
Message-ID: <200501191453.00489.jbarnes@sgi.com> (raw)
In-Reply-To: <200501111200.02504.jbarnes@sgi.com>
[-- Attachment #1: Type: text/plain, Size: 869 bytes --]
On Wednesday, January 19, 2005 2:39 pm, David Mosberger wrote:
> Jesse> Sounds good, though that could be a long wait. Should we add
> Jesse> this new EFI call anyway? Seems like it'll be useful
> Jesse> regardless...
>
> I agree.
Ok, here you go Tony. This one fixes the loop and also fixes drm_vm.c. All
of the bits aside from the efi.h bit are ia64 specific (either under
arch/ia64 or __ia64__), so your tree is probably the right place for all of
it.
This patch adds efi_range_is_wc() to efi.h. It's used to determine whether an
address range can be mapped with the write coalescing attribute. It also
fixes up some ia64 specific callers to use the new routine instead of
unconditionally calling pgprot_writecombined, which can be dangerous if used
on ranges that don't support it.
Signed-off-by: Jesse Barnes <jbarnes@sgi.com>
Thanks,
Jesse
[-- Attachment #2: efi-check-wc-range-6.patch --]
[-- Type: text/plain, Size: 3070 bytes --]
===== arch/ia64/pci/pci.c 1.65 vs edited =====
--- 1.65/arch/ia64/pci/pci.c 2005-01-12 10:08:48 -08:00
+++ edited/arch/ia64/pci/pci.c 2005-01-19 11:09:32 -08:00
@@ -539,7 +539,8 @@
*/
vma->vm_flags |= (VM_SHM | VM_RESERVED | VM_IO);
- if (write_combine)
+ if (write_combine && efi_range_is_wc(vma->vm_start,
+ vma->vm_end - vma->vm_start))
vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
else
vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
===== drivers/char/drm/drm_vm.c 1.36 vs edited =====
--- 1.36/drivers/char/drm/drm_vm.c 2004-11-04 02:35:43 -08:00
+++ edited/drivers/char/drm/drm_vm.c 2005-01-19 14:31:47 -08:00
@@ -612,8 +612,13 @@
vma->vm_flags |= VM_IO; /* not in core dump */
}
#if defined(__ia64__)
- if (map->type != _DRM_AGP)
- vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
+ if (efi_range_is_wc(vma->vm_start, vma->vm_end -
+ vma->vm_start))
+ vma->vm_page_prot =
+ pgprot_writecombine(vma->vm_page_prot);
+ else
+ vma->vm_page_prot =
+ pgprot_noncached(vma->vm_page_prot);
#endif
offset = dev->driver->get_reg_ofs(dev);
#ifdef __sparc__
===== drivers/video/fbmem.c 1.148 vs edited =====
--- 1.148/drivers/video/fbmem.c 2005-01-05 15:46:41 -08:00
+++ edited/drivers/video/fbmem.c 2005-01-19 14:52:06 -08:00
@@ -35,6 +35,7 @@
#include <linux/err.h>
#include <linux/kernel.h>
#include <linux/device.h>
+#include <linux/efi.h>
#if defined(__mc68000__) || defined(CONFIG_APUS)
#include <asm/setup.h>
@@ -950,9 +951,13 @@
vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
#elif defined(__hppa__)
pgprot_val(vma->vm_page_prot) |= _PAGE_NO_CACHE;
-#elif defined(__ia64__) || defined(__arm__) || defined(__sh__) || \
- defined(__m32r__)
+#elif defined(__arm__) || defined(__sh__) || defined(__m32r__)
vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
+#elif defined(__ia64__)
+ if (efi_range_is_wc(vma->vm_start, vma->vm_end - vma->vm_start))
+ vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
+ else
+ vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
#else
#warning What do we have to do here??
#endif
===== include/linux/efi.h 1.12 vs edited =====
--- 1.12/include/linux/efi.h 2004-11-18 23:03:10 -08:00
+++ edited/include/linux/efi.h 2005-01-19 14:04:14 -08:00
@@ -305,6 +305,27 @@
extern int __init efi_set_rtc_mmss(unsigned long nowtime);
extern struct efi_memory_map memmap;
+/**
+ * efi_range_is_wc - check the WC bit on an address range
+ * @start: starting kvirt address
+ * @len: length of range
+ *
+ * Consult the EFI memory map and make sure it's ok to set this range WC.
+ * Returns true or false.
+ */
+static inline int efi_range_is_wc(unsigned long start, unsigned long len)
+{
+ int i;
+
+ for (i = 0; i < len; i += (1UL << EFI_PAGE_SHIFT)) {
+ unsigned long paddr = __pa(start + i);
+ if (!(efi_mem_attributes(paddr) & EFI_MEMORY_WC))
+ return 0;
+ }
+ /* The range checked out */
+ return 1;
+}
+
#ifdef CONFIG_EFI_PCDP
extern int __init efi_setup_pcdp_console(char *);
#endif
next prev parent reply other threads:[~2005-01-19 22:53 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-01-11 20:00 pgprot_writecombine & shub 1.x Jesse Barnes
2005-01-11 22:12 ` David Mosberger
2005-01-11 22:35 ` Jesse Barnes
2005-01-12 18:51 ` Jim Hull
2005-01-12 19:31 ` Hugo Kohmann
2005-01-12 19:32 ` Jesse Barnes
2005-01-12 21:54 ` David Mosberger
2005-01-19 17:28 ` Jesse Barnes
2005-01-19 17:53 ` David Mosberger
2005-01-19 17:56 ` Jesse Barnes
2005-01-19 18:04 ` David Mosberger
2005-01-19 18:16 ` Luck, Tony
2005-01-19 18:21 ` Jesse Barnes
2005-01-19 18:38 ` Luck, Tony
2005-01-19 19:33 ` Bjorn Helgaas
2005-01-19 21:51 ` Jesse Barnes
2005-01-19 22:00 ` Luck, Tony
2005-01-19 22:03 ` Jesse Barnes
2005-01-19 22:07 ` David Mosberger
2005-01-19 22:16 ` Jesse Barnes
2005-01-19 22:20 ` David Mosberger
2005-01-19 22:22 ` Jesse Barnes
2005-01-19 22:25 ` David Mosberger
2005-01-19 22:36 ` Jesse Barnes
2005-01-19 22:39 ` David Mosberger
2005-01-19 22:53 ` Jesse Barnes [this message]
2005-01-20 9:03 ` Jes Sorensen
2005-01-20 13:43 ` Hugo Kohmann
2005-01-20 16:42 ` Jesse Barnes
2005-01-20 16:45 ` Jesse Barnes
2005-01-20 17:17 ` David Mosberger
2005-01-21 9:00 ` Jes Sorensen
2005-01-21 9:01 ` Jes Sorensen
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=200501191453.00489.jbarnes@sgi.com \
--to=jbarnes@sgi.com \
--cc=linux-ia64@vger.kernel.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