svn commit: r366035 - head/sys/powerpc/pseries

Brandon Bergren bdragon at FreeBSD.org
Wed Sep 23 00:03:36 UTC 2020


Author: bdragon
Date: Wed Sep 23 00:03:35 2020
New Revision: 366035
URL: https://svnweb.freebsd.org/changeset/base/366035

Log:
  [PowerPC64LE] Tell the hypervisor to switch interrupts to LE at CHRP attach.
  
  Since we will need to be able to take traps relatively early in the process,
  ensure that the hypervisor changes our ILE for us as soon as we are ready.
  
  Sponsored by:	Tag1 Consulting, Inc.

Modified:
  head/sys/powerpc/pseries/phyp-hvcall.h
  head/sys/powerpc/pseries/platform_chrp.c

Modified: head/sys/powerpc/pseries/phyp-hvcall.h
==============================================================================
--- head/sys/powerpc/pseries/phyp-hvcall.h	Tue Sep 22 23:59:02 2020	(r366034)
+++ head/sys/powerpc/pseries/phyp-hvcall.h	Wed Sep 23 00:03:35 2020	(r366035)
@@ -170,6 +170,13 @@
 #define H_PP1 (1UL<<(63-62))
 #define H_PP2 (1UL<<(63-63))
 
+/* H_SET_MODE resource identifiers from 14.5.4.3.5. */
+#define	H_SET_MODE_RSRC_CIABR		0x1	/* All versions */
+#define	H_SET_MODE_RSRC_DAWR0		0x2	/* All versions */
+#define	H_SET_MODE_RSRC_INTR_TRANS_MODE	0x3	/* All versions */
+#define	H_SET_MODE_RSRC_ILE		0x4	/* PAPR 2.8 / ISA 2.07 */
+#define	H_SET_MODE_RSRC_DAWR1		0x5	/* ISA 3.1 Future support */
+
 /* pSeries hypervisor opcodes. */
 #define H_REMOVE		0x04
 #define H_ENTER			0x08

Modified: head/sys/powerpc/pseries/platform_chrp.c
==============================================================================
--- head/sys/powerpc/pseries/platform_chrp.c	Tue Sep 22 23:59:02 2020	(r366034)
+++ head/sys/powerpc/pseries/platform_chrp.c	Wed Sep 23 00:03:35 2020	(r366035)
@@ -136,6 +136,9 @@ chrp_attach(platform_t plat)
 	int quiesce;
 #ifdef __powerpc64__
 	int i;
+#if BYTE_ORDER == LITTLE_ENDIAN
+	int result;
+#endif
 
 	/* XXX: check for /rtas/ibm,hypertas-functions? */
 	if (!(mfmsr() & PSL_HV)) {
@@ -171,6 +174,24 @@ chrp_attach(platform_t plat)
 
 		/* Set up hypervisor CPU stuff */
 		chrp_smp_ap_init(plat);
+
+#if BYTE_ORDER == LITTLE_ENDIAN
+		/*
+		 * Ask the hypervisor to update the LPAR ILE bit.
+		 *
+		 * This involves all processors reentering the hypervisor
+		 * so the change appears simultaneously in all processors.
+		 * This can take a long time.
+		 */
+		for(;;) {
+			result = phyp_hcall(H_SET_MODE, 1UL,
+			    H_SET_MODE_RSRC_ILE, 0, 0);
+			if (result == H_SUCCESS)
+				break;
+			DELAY(1000);
+		}
+#endif
+
 	}
 #endif
 	chrp_cpuref_init();


More information about the svn-src-head mailing list