mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ppc64 iommu rewrite part 2/5
@ 2004-02-27 12:11 Benjamin Herrenschmidt
  2004-02-27 12:28 ` Christoph Hellwig
  0 siblings, 1 reply; 3+ messages in thread
From: Benjamin Herrenschmidt @ 2004-02-27 12:11 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Linus Torvalds, Linux Kernel list

Fix /dev/mem idea of what is memory on ppc64

This add a hack to /dev/mem (along with the other ones
already there) to prevent mapping cacheable of the IO hole.

Without this, XFree blows up on machines with enough memory
to go past the IO hole. It also tries to prevent memory from
beeing mapped uncached. Cache paradoxes are evil and can
kill the CPU. 

The necessary page_is_ram() call was added by the previous
patch doing the proper IO hole accounting.

Ben.

# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
#   2004/02/27 22:24:36+11:00 benh@kernel.crashing.org 
#   Fix /dev/mem mmap'ing choice of cacheable attribute on ppc64
#   (Fixes XFree on machines with an IO hole)
# 
# drivers/char/mem.c
#   2004/02/27 22:24:24+11:00 benh@kernel.crashing.org +8 -0
#   Fix /dev/mem mmap'ing choice of cacheable attribute on ppc64
#   (Fixes XFree on machines with an IO hole)
# 
diff -Nru a/drivers/char/mem.c b/drivers/char/mem.c
--- a/drivers/char/mem.c	Fri Feb 27 22:44:02 2004
+++ b/drivers/char/mem.c	Fri Feb 27 22:44:02 2004
@@ -67,6 +67,14 @@
 	 * On ia64, we ignore O_SYNC because we cannot tolerate memory attribute aliases.
 	 */
 	return !(efi_mem_attributes(addr) & EFI_MEMORY_WB);
+#elif defined(CONFIG_PPC64)
+	/* On PPC64, we always do non-cacheable access to the IO hole and
+	 * cacheable elsewhere. Cache paradox can checkstop the CPU and
+	 * the high_memory heuristic below is wrong on machines with memory
+	 * above the IO hole... Ah, and of course, XFree86 doesn't pass
+	 * O_SYNC when mapping us to tap IO space. Surprised ?
+	 */
+	return !page_is_ram(addr);
 #else
 	/*
 	 * Accessing memory above the top the kernel knows about or through a file pointer



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ppc64 iommu rewrite part 2/5
  2004-02-27 12:28 ` Christoph Hellwig
@ 2004-02-27 12:22   ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 3+ messages in thread
From: Benjamin Herrenschmidt @ 2004-02-27 12:22 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: Andrew Morton, Linus Torvalds, Linux Kernel list



> Umm, can't we plaese define a hook in all pors and use it here instead
> of one hack per port?

I'm adding that to my todo-list ;) I'm too tired to do it tonight
and I'm not sure I want to do anything that productive this
week-end ;)

(That whole iommu stuff ended up beeing more painful to get right
than I expected at first, but I'm happy we have that less crap in
arch/ppc64 now)

Ben.



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ppc64 iommu rewrite part 2/5
  2004-02-27 12:11 [PATCH] ppc64 iommu rewrite part 2/5 Benjamin Herrenschmidt
@ 2004-02-27 12:28 ` Christoph Hellwig
  2004-02-27 12:22   ` Benjamin Herrenschmidt
  0 siblings, 1 reply; 3+ messages in thread
From: Christoph Hellwig @ 2004-02-27 12:28 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: Andrew Morton, Linus Torvalds, Linux Kernel list

On Fri, Feb 27, 2004 at 11:11:02PM +1100, Benjamin Herrenschmidt wrote:
> @@ -67,6 +67,14 @@
>  	 * On ia64, we ignore O_SYNC because we cannot tolerate memory attribute aliases.
>  	 */
>  	return !(efi_mem_attributes(addr) & EFI_MEMORY_WB);
> +#elif defined(CONFIG_PPC64)
> +	/* On PPC64, we always do non-cacheable access to the IO hole and
> +	 * cacheable elsewhere. Cache paradox can checkstop the CPU and
> +	 * the high_memory heuristic below is wrong on machines with memory
> +	 * above the IO hole... Ah, and of course, XFree86 doesn't pass
> +	 * O_SYNC when mapping us to tap IO space. Surprised ?
> +	 */
> +	return !page_is_ram(addr);
>  #else

Umm, can't we plaese define a hook in all pors and use it here instead
of one hack per port?


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-02-27 12:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-02-27 12:11 [PATCH] ppc64 iommu rewrite part 2/5 Benjamin Herrenschmidt
2004-02-27 12:28 ` Christoph Hellwig
2004-02-27 12:22   ` Benjamin Herrenschmidt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®