ppc64 iommu rewrite part 2/5
PATCH 1/1 ppc64 iommu rewrite part 2/5
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 [email protected] # 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 [email protected] +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
Review line 78
Quoted 13 lines · Benjamin Herrenschmidt
(quoted diff) +8
-0@@ -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?
Quoted 4 lines
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.