Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 4 Jun 2006 20:48:14 GMT
From:      Kip Macy <kmacy@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 98502 for review
Message-ID:  <200606042048.k54KmE53060412@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=98502

Change 98502 by kmacy@kmacy_storage:sun4v_work on 2006/06/04 20:48:09

	force pcpu to be 64-byte aligned

Affected files ...

.. //depot/projects/kmacy_sun4v/src/sys/sun4v/include/pcpu.h#14 edit
.. //depot/projects/kmacy_sun4v/src/sys/sun4v/sun4v/machdep.c#24 edit

Differences ...

==== //depot/projects/kmacy_sun4v/src/sys/sun4v/include/pcpu.h#14 (text+ko) ====

@@ -78,7 +78,8 @@
 	u_int   pc_kwbuf_full;                                          \
 	struct rwindow pc_tsbwbuf[2];                                   \
 	u_int   pc_node;                                                \
-        uint16_t pc_cpulist[MAXCPU]
+        uint16_t pc_cpulist[MAXCPU];                                    \
+        uint64_t pad[6];
 
 	/* XXX SUN4V_FIXME - as we access the *_ra and *_size fields in quick
 	 * succession we _really_ want them to be L1 cache line size aligned

==== //depot/projects/kmacy_sun4v/src/sys/sun4v/sun4v/machdep.c#24 (text+ko) ====

@@ -181,6 +181,7 @@
 CTASSERT(sizeof(struct pcb) <= ((KSTACK_PAGES * PAGE_SIZE) / 8));
 
 CTASSERT(sizeof(struct pcpu) <= ((PCPU_PAGES * PAGE_SIZE) / 2));
+CTASSERT((sizeof(struct pcpu) & ((1<<6)-1)) == 0);
 
 static void
 cpu_startup(void *arg)
@@ -377,7 +378,9 @@
 	proc0.p_md.md_utrap = NULL;
 	frame0.tf_tstate = TSTATE_IE | TSTATE_PEF | TSTATE_PRIV;
 	thread0.td_frame = &frame0;
-
+	if ((u_long)thread0.td_frame & 0x3f) {
+		panic("unaligned frame0");
+	}
 	/*
 	 * Prime our per-cpu data page for use.  Note, we are using it for our
 	 * stack, so don't pass the real size (PAGE_SIZE) to pcpu_init or
@@ -412,6 +415,11 @@
 	thread0.td_pcb = (struct pcb *)TLB_PHYS_TO_DIRECT(vtophys((vm_offset_t)thread0.td_pcb));
 	pc->pc_curpcb = thread0.td_pcb;
 
+	if (((thread0.td_pcb->pcb_kstack + SPOFF) & 0x3f) != 0) {
+		printf("unaligned stack pcb_kstack & 0x3f == 0x%lx\n", 
+		       ((thread0.td_pcb->pcb_kstack + SPOFF) & 0x3f));
+	}
+
 	/*
 	 * Update PCPU_REG to point to direct address
 	 * to support easy phys <-> virt translation in trap handler
@@ -697,10 +705,7 @@
 #ifdef SMP
 	cpu_mp_shutdown();
 #endif
-#ifdef notyet
-/* XXX SUN4V_FIXME */
-	openfirmware_exit(args);
-#endif
+	OF_exit();
 }
 
 /* Get current clock frequency for the given cpu id. */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200606042048.k54KmE53060412>