svn commit: r367496 - head/sys/powerpc/aim

Brandon Bergren bdragon at FreeBSD.org
Sun Nov 8 23:34:07 UTC 2020


Author: bdragon
Date: Sun Nov  8 23:34:06 2020
New Revision: 367496
URL: https://svnweb.freebsd.org/changeset/base/367496

Log:
  [PowerPC] Fix powerpc64le boot after HPT superpages addition
  
  The HPT is always stored in big-endian, as it is accessed directly by the
  hardware as well as the kernel. As such, it is necessary to convert values
  to and from native endian when running on LE.
  
  Some unconverted accesses snuck in accidentally with r367417.
  
  Apply the appropriate conversions to fix boot hanging on powerpc64le.
  
  Sponsored by:	Tag1 Consulting, Inc.

Modified:
  head/sys/powerpc/aim/moea64_native.c

Modified: head/sys/powerpc/aim/moea64_native.c
==============================================================================
--- head/sys/powerpc/aim/moea64_native.c	Sun Nov  8 22:30:13 2020	(r367495)
+++ head/sys/powerpc/aim/moea64_native.c	Sun Nov  8 23:34:06 2020	(r367496)
@@ -384,7 +384,7 @@ moea64_pte_clear_native(struct pvo_entry *pvo, uint64_
 static __always_inline int64_t
 moea64_pte_unset_locked(volatile struct lpte *pt, uint64_t vpn)
 {
-	uint64_t ptelo;
+	uint64_t ptelo, ptehi;
 
 	/*
 	 * Invalidate the pte, briefly locking it to collect RC bits. No
@@ -392,9 +392,10 @@ moea64_pte_unset_locked(volatile struct lpte *pt, uint
 	 */
 	isync();
 	critical_enter();
-	pt->pte_hi = htobe64((be64toh(pt->pte_hi) & ~LPTE_VALID) | LPTE_LOCKED);
+	ptehi = (be64toh(pt->pte_hi) & ~LPTE_VALID) | LPTE_LOCKED;
+	pt->pte_hi = htobe64(ptehi);
 	PTESYNC();
-	TLBIE(vpn, pt->pte_hi);
+	TLBIE(vpn, ptehi);
 	ptelo = be64toh(pt->pte_lo);
 	*((volatile int32_t *)(&pt->pte_hi) + 1) = 0; /* Release lock */
 	critical_exit();
@@ -416,7 +417,7 @@ moea64_pte_unset_native(struct pvo_entry *pvo)
 
 	rw_rlock(&moea64_eviction_lock);
 
-	if ((be64toh(pt->pte_hi & LPTE_AVPN_MASK)) != pvo_ptevpn) {
+	if ((be64toh(pt->pte_hi) & LPTE_AVPN_MASK) != pvo_ptevpn) {
 		/* Evicted */
 		STAT_MOEA64(moea64_pte_overflow--);
 		ret = -1;
@@ -433,7 +434,7 @@ moea64_pte_replace_inval_native(struct pvo_entry *pvo,
     volatile struct lpte *pt)
 {
 	struct lpte properpt;
-	uint64_t ptelo;
+	uint64_t ptelo, ptehi;
 
 	moea64_pte_from_pvo(pvo, &properpt);
 
@@ -452,9 +453,10 @@ moea64_pte_replace_inval_native(struct pvo_entry *pvo,
 	 */
 	isync();
 	critical_enter();
-	pt->pte_hi = htobe64((be64toh(pt->pte_hi) & ~LPTE_VALID) | LPTE_LOCKED);
+	ptehi = (be64toh(pt->pte_hi) & ~LPTE_VALID) | LPTE_LOCKED;
+	pt->pte_hi = htobe64(ptehi);
 	PTESYNC();
-	TLBIE(pvo->pvo_vpn, pt->pte_hi);
+	TLBIE(pvo->pvo_vpn, ptehi);
 	ptelo = be64toh(pt->pte_lo);
 	EIEIO();
 	pt->pte_lo = htobe64(properpt.pte_lo);


More information about the svn-src-all mailing list