From owner-svn-src-head@freebsd.org Tue Sep 25 02:34:29 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EC316109F2CE; Tue, 25 Sep 2018 02:34:28 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A35857C8D6; Tue, 25 Sep 2018 02:34:28 +0000 (UTC) (envelope-from jhibbits@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 9E26E22193; Tue, 25 Sep 2018 02:34:28 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w8P2YS33002047; Tue, 25 Sep 2018 02:34:28 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w8P2YSDm002046; Tue, 25 Sep 2018 02:34:28 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201809250234.w8P2YSDm002046@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Tue, 25 Sep 2018 02:34:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338922 - head/sys/powerpc/ofw X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/ofw X-SVN-Commit-Revision: 338922 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Sep 2018 02:34:29 -0000 Author: jhibbits Date: Tue Sep 25 02:34:28 2018 New Revision: 338922 URL: https://svnweb.freebsd.org/changeset/base/338922 Log: powerpc: Blacklist the top 64kB range of the lower 4GB PA space The PHB4 host bridge used by the POWER9 uses a 64kB range in 32-bit space at the address 0xffff0000-0xffffffff. Reserve this range so that DMA memory cannot be allocated within this range. This fixes seemingly random crashes on a POWER9 system. Ideally this range will have been reserved by the firmware, but as of now this is not the case. Submitted by: git_bdragon.rtk0.net Reviewed by: nwhitehorn Approved by: re(kib) Differential Revision: https://reviews.freebsd.org/D17183 Modified: head/sys/powerpc/ofw/ofw_machdep.c Modified: head/sys/powerpc/ofw/ofw_machdep.c ============================================================================== --- head/sys/powerpc/ofw/ofw_machdep.c Mon Sep 24 22:15:04 2018 (r338921) +++ head/sys/powerpc/ofw/ofw_machdep.c Tue Sep 25 02:34:28 2018 (r338922) @@ -69,6 +69,10 @@ __FBSDID("$FreeBSD$"); #include +#ifdef POWERNV +#include +#endif + static void *fdt; int ofw_real_mode; @@ -338,7 +342,35 @@ excise_initrd_region(struct mem_region *avail, int asz return (asz); } +#ifdef POWERNV static int +excise_msi_region(struct mem_region *avail, int asz) +{ + uint64_t start, end; + struct mem_region initrdmap[1]; + + /* + * This range of physical addresses is used to implement optimized + * 32 bit MSI interrupts on POWER9. Exclude it to avoid accidentally + * using it for DMA, as this will cause an immediate PHB fence. + * While we could theoretically turn off this behavior in the ETU, + * doing so would break 32-bit MSI, so just reserve the range in + * the physical map instead. + * See section 4.4.2.8 of the PHB4 specification. + */ + start = 0x00000000ffff0000ul; + end = 0x00000000fffffffful; + + initrdmap[0].mr_start = start; + initrdmap[0].mr_size = end - start; + + asz = excise_reserved_regions(avail, asz, initrdmap, 1); + + return (asz); +} +#endif + +static int excise_fdt_reserved(struct mem_region *avail, int asz) { struct mem_region fdtmap[32]; @@ -428,6 +460,11 @@ ofw_mem_regions(struct mem_region *memp, int *memsz, */ if (OF_hasprop(phandle, "linux,initrd-start")) asz = excise_initrd_region(availp, asz); +#endif + +#ifdef POWERNV + if (opal_check() == 0) + asz = excise_msi_region(availp, asz); #endif *memsz = msz;