Skip to contentSkip to conversation

Add ia64_tpa & ia64_imva for 2.4.21

PATCH Jack Steiner 2 participants 3 messages Aug 15, 2003

lore
Share & tools
lore
#0 lore raw

Because of the strange memory map on the SGI SN hardware, we need a portion of the 2.6 patches from Tony Luck backported into 2.4.21.

This patche adds the ia64_imva function & a few additional calls to ia64_tpa.

In 2.6, these patches were part of the change to relocate the kernel to region 5. However, I am NOT proposing making that change!! I just need the macros!!

Patch is attach & is based on the 2.4.21 bitkeeper tree.

arch/ia64/kernel/setup.c +2 -2
diff -Naru linux_base/arch/ia64/kernel/setup.c linux/arch/ia64/kernel/setup.c
@@ -305,8 +305,8 @@
 				+ strlen(__va(ia64_boot_param->command_line)) + 1);
 	n++;
 
-	rsvd_region[n].start = KERNEL_START;
-	rsvd_region[n].end   = KERNEL_END;
+	rsvd_region[n].start = ia64_imva(KERNEL_START);
+	rsvd_region[n].end   = ia64_imva(KERNEL_END);
 	n++;
 
 #ifdef CONFIG_BLK_DEV_INITRD
arch/ia64/kernel/smpboot.c +1 -1
diff -Naru linux_base/arch/ia64/kernel/smpboot.c linux/arch/ia64/kernel/smpboot.c
@@ -577,7 +577,7 @@
 	/* Tell SAL where to drop the AP's.  */
 	ap_startup = (struct fptr *) start_ap;
 	sal_ret = ia64_sal_set_vectors(SAL_VECTOR_OS_BOOT_RENDEZ,
-				       __pa(ap_startup->fp), __pa(ap_startup->gp), 0, 0, 0, 0);
+				      ia64_tpa(ap_startup->fp), ia64_tpa(ap_startup->gp), 0, 0, 0, 0);
 	if (sal_ret < 0) {
 		printk(KERN_ERR "SMP: Can't set SAL AP Boot Rendezvous: %s\n     Forcing UP mode\n",
 		       ia64_sal_strerror(sal_ret));
arch/ia64/mm/init.c +4 -4
diff -Naru linux_base/arch/ia64/mm/init.c linux/arch/ia64/mm/init.c
@@ -114,8 +114,8 @@
 {
 	unsigned long addr, eaddr;
 
-	addr = (unsigned long) &__init_begin;
-	eaddr = (unsigned long) &__init_end;
+	addr = (unsigned long) ia64_imva(&__init_begin);
+	eaddr = (unsigned long) ia64_imva(&__init_end);
 	for (; addr < eaddr; addr += PAGE_SIZE) {
 		clear_bit(PG_reserved, &virt_to_page((void *)addr)->flags);
 		set_page_count(virt_to_page((void *)addr), 1);
@@ -577,7 +577,7 @@
 		}
 	}
 
-	zero_page_memmap_ptr = virt_to_page(empty_zero_page);
+	zero_page_memmap_ptr = virt_to_page(ia64_imva(empty_zero_page));
 }
 
 static int
@@ -646,7 +646,7 @@
 		pgt_cache_water[1] = num_pgt_pages;
 
 	/* install the gate page in the global page table: */
-	put_gate_page(virt_to_page(__start_gate_section), GATE_ADDR);
+	put_gate_page(virt_to_page(ia64_imva(__start_gate_section)), GATE_ADDR);
 
 #ifdef CONFIG_IA32_SUPPORT
 	ia32_gdt_init();
arch/ia64/sn/kernel/bte.c +4 -4
diff -Naru linux_base/arch/ia64/sn/kernel/bte.c linux/arch/ia64/sn/kernel/bte.c
@@ -156,8 +156,8 @@
 
 	/* Set the notification register */
 	BTE_PRINTKV(("IBNA - HUB_S(0x%p, 0x%lx)\n", BTEREG_NOTIF_ADDR,
-		     (TO_PHYS(__tpa(bte->most_rcnt_na)))));
-	HUB_S(BTEREG_NOTIF_ADDR, (TO_PHYS(__tpa(bte->most_rcnt_na))));
+		     (TO_PHYS(ia64_tpa(bte->most_rcnt_na)))));
+	HUB_S(BTEREG_NOTIF_ADDR, (TO_PHYS(ia64_tpa(bte->most_rcnt_na))));
 
 
 	/* Initiate the transfer */
@@ -294,7 +294,7 @@
 				headBteLen += footBteLen;
 			} else if (footBcopyLen > 0) {
 				rv = bte_copy(footBteSource,
-					      __tpa(bteBlock),
+					      ia64_tpa(bteBlock),
 					      footBteLen, mode, NULL);
 				if (rv != BTE_SUCCESS) {
 					return rv;
@@ -344,7 +344,7 @@
 
 	if (headBcopyLen > 0) {
 		rv = bte_copy(headBteSource,
-			      __tpa(bteBlock), headBteLen, mode, NULL);
+			      ia64_tpa(bteBlock), headBteLen, mode, NULL);
 		if (rv != BTE_SUCCESS) {
 			return rv;
 		}
include/asm-ia64/processor.h +14 -0
diff -Naru linux_base/include/asm-ia64/processor.h linux/include/asm-ia64/processor.h
@@ -959,6 +959,20 @@
 	return result;
 }
 
+/*
+ * Take a mapped kernel address and return the equivalent address
+ * in the region 7 identity mapped virtual area.
+ */
+static inline void *
+ia64_imva (void *addr)
+{
+	void *result;
+	asm ("tpa %0=%1" : "=r"(result) : "r"(addr));
+	return __va(result);
+}
+
+#define __imva(x) ((long)__va(ia64_tpa(x)))
+
 #define ARCH_HAS_PREFETCH
 #define ARCH_HAS_PREFETCHW
 #define ARCH_HAS_SPINLOCK_PREFETCH
Signature · 3 lines
Thanks

Jack Steiner    (651-683-5302)   (vnet 233-5302)      [email protected]
#1 lore raw
Quoted 8 lines · Jack Steiner

Because of the strange memory map on the SGI SN hardware, we need a portion of the 2.6 patches from Tony Luck backported into 2.4.21.

This patche adds the ia64_imva function & a few additional calls to ia64_tpa.

In 2.6, these patches were part of the change to relocate the kernel to region 5. However, I am NOT proposing making that change!! I just need the macros!!

I applied this for 2.4, except for this bit:

Quoted 1 line

+#define __imva(x) ((long)__va(ia64_tpa(x)))

because there was no reference to __imva(). If you need it for some SN-specific code, let me know.

Bjorn

#2 lore raw
In reply to Jack Steiner
Quoted 11 lines · Jack Steiner
Quoted 8 lines

Because of the strange memory map on the SGI SN hardware, we need a portion of the 2.6 patches from Tony Luck backported into 2.4.21.

This patche adds the ia64_imva function & a few additional calls to ia64_tpa.

In 2.6, these patches were part of the change to relocate the kernel to region 5. However, I am NOT proposing making that change!! I just need the macros!!

Quoted 9 lines

I applied this for 2.4, except for this bit:

Quoted 1 line

+#define __imva(x) ((long)__va(ia64_tpa(x)))

because there was no reference to __imva(). If you need it for some SN-specific code, let me know.

Bjorn

Not needed. That was an error on my part. I should have deleted that line.

Signature · 3 lines
Thanks

Jack Steiner    (651-683-5302)   (vnet 233-5302)      [email protected]