Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 6 Nov 2011 19:05:42 +0000 (UTC)
From:      Nathan Whitehorn <nwhitehorn@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r227263 - projects/pseries/powerpc/pseries
Message-ID:  <201111061905.pA6J5g5N037399@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: nwhitehorn
Date: Sun Nov  6 19:05:42 2011
New Revision: 227263
URL: http://svn.freebsd.org/changeset/base/227263

Log:
  Register a per-CPU virtual processor area with the hypervisor telling it
  not to do things behind our back.

Modified:
  projects/pseries/powerpc/pseries/platform_chrp.c

Modified: projects/pseries/powerpc/pseries/platform_chrp.c
==============================================================================
--- projects/pseries/powerpc/pseries/platform_chrp.c	Sun Nov  6 19:03:07 2011	(r227262)
+++ projects/pseries/powerpc/pseries/platform_chrp.c	Sun Nov  6 19:05:42 2011	(r227263)
@@ -57,6 +57,10 @@ __FBSDID("$FreeBSD$");
 extern void *ap_pcpu;
 #endif
 
+#ifdef __powerpc64__
+static uint8_t splpar_vpa[640] __aligned(64);
+#endif
+
 static vm_offset_t realmaxaddr = VM_MAX_ADDRESS;
 
 static int chrp_probe(platform_t);
@@ -131,8 +135,19 @@ chrp_attach(platform_t plat)
 		pmap_mmu_install("mmu_phyp", BUS_PROBE_SPECIFIC);
 		cpu_idle_hook = phyp_cpu_idle;
 
-		/* Set interrupt priority */
-		phyp_hcall(H_CPPR, 0xff);
+		/* Set up important VPA fields */
+		bzero(splpar_vpa, sizeof(splpar_vpa));
+		splpar_vpa[4] = (uint8_t)((sizeof(splpar_vpa) >> 8) & 0xff);
+		splpar_vpa[5] = (uint8_t)(sizeof(splpar_vpa) & 0xff);
+		splpar_vpa[0xba] = 1;			/* Maintain FPRs */
+		splpar_vpa[0xbb] = 1;			/* Maintain PMCs */
+		splpar_vpa[0xfc] = 0xff;		/* Maintain full SLB */
+		splpar_vpa[0xfd] = 0xff;
+		splpar_vpa[0xff] = 1;			/* Maintain Altivec */
+		mb();
+
+		/* Set up hypervisor CPU stuff */
+		chrp_smp_ap_init(plat);
 	}
 #endif
 
@@ -382,6 +397,9 @@ chrp_smp_ap_init(platform_t platform)
 	if (!(mfmsr() & PSL_HV)) {
 		/* Set interrupt priority */
 		phyp_hcall(H_CPPR, 0xff);
+
+		/* Register VPA */
+		phyp_hcall(H_REGISTER_VPA, 1UL, PCPU_GET(cpuid), splpar_vpa);
 	}
 }
 #endif



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