From owner-svn-src-all@freebsd.org Wed Sep 23 00:03:36 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 529CF3E4FD2; Wed, 23 Sep 2020 00:03:36 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Bwz0m1NpFz3fTj; Wed, 23 Sep 2020 00:03:36 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1380827C08; Wed, 23 Sep 2020 00:03:36 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 08N03ZPX016059; Wed, 23 Sep 2020 00:03:35 GMT (envelope-from bdragon@FreeBSD.org) Received: (from bdragon@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 08N03ZH7016057; Wed, 23 Sep 2020 00:03:35 GMT (envelope-from bdragon@FreeBSD.org) Message-Id: <202009230003.08N03ZH7016057@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdragon set sender to bdragon@FreeBSD.org using -f From: Brandon Bergren Date: Wed, 23 Sep 2020 00:03:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366035 - head/sys/powerpc/pseries X-SVN-Group: head X-SVN-Commit-Author: bdragon X-SVN-Commit-Paths: head/sys/powerpc/pseries X-SVN-Commit-Revision: 366035 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Sep 2020 00:03:36 -0000 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();