From owner-svn-src-head@freebsd.org Wed May 25 01:23:20 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D01BFB49234; Wed, 25 May 2016 01:23:20 +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 mx1.freebsd.org (Postfix) with ESMTPS id 88BD912B7; Wed, 25 May 2016 01:23:20 +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 u4P1NJk1014264; Wed, 25 May 2016 01:23:19 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4P1NJlY014263; Wed, 25 May 2016 01:23:19 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201605250123.u4P1NJlY014263@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Wed, 25 May 2016 01:23:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300637 - head/sys/dev/dpaa X-SVN-Group: head 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.22 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: Wed, 25 May 2016 01:23:20 -0000 Author: jhibbits Date: Wed May 25 01:23:19 2016 New Revision: 300637 URL: https://svnweb.freebsd.org/changeset/base/300637 Log: Set the TLB caching properties for portals at attach time. This was found while reworking the device tree nodes for dtsec to match the Linux device tree. Instead of waiting and expecting later code to call dpaa_portal_map_registers(), do the equivalent immediately upon mapping. Otherwise, it's possible to access the pages before that function is called, and hang the CPU. Modified: head/sys/dev/dpaa/portals_common.c Modified: head/sys/dev/dpaa/portals_common.c ============================================================================== --- head/sys/dev/dpaa/portals_common.c Wed May 25 00:25:38 2016 (r300636) +++ head/sys/dev/dpaa/portals_common.c Wed May 25 01:23:19 2016 (r300637) @@ -76,9 +76,12 @@ dpaa_portal_alloc_res(device_t dev, stru SYS_RES_MEMORY, &sc->sc_rrid[0], rle->start + sc->sc_dp_pa, rle->end + sc->sc_dp_pa, rle->count, RF_ACTIVE); if (sc->sc_rres[0] == NULL) { - device_printf(dev, "Could not allocate memory.\n"); + device_printf(dev, + "Could not allocate cache enabled memory.\n"); return (ENXIO); } + tlb1_set_entry(rman_get_bushandle(sc->sc_rres[0]), + rle->start + sc->sc_dp_pa, rle->count, _TLB_ENTRY_MEM); /* Cache inhibited area */ rle = resource_list_find(res, SYS_RES_MEMORY, 1); sc->sc_rrid[1] = 1; @@ -86,11 +89,15 @@ dpaa_portal_alloc_res(device_t dev, stru SYS_RES_MEMORY, &sc->sc_rrid[1], rle->start + sc->sc_dp_pa, rle->end + sc->sc_dp_pa, rle->count, RF_ACTIVE); if (sc->sc_rres[1] == NULL) { - device_printf(dev, "Could not allocate memory.\n"); + device_printf(dev, + "Could not allocate cache inhibited memory.\n"); bus_release_resource(dev, SYS_RES_MEMORY, sc->sc_rrid[0], sc->sc_rres[0]); return (ENXIO); } + tlb1_set_entry(rman_get_bushandle(sc->sc_rres[1]), + rle->start + sc->sc_dp_pa, rle->count, _TLB_ENTRY_IO); + sc->sc_dp[cpu].dp_regs_mapped = 1; } /* Acquire portal's CE_PA and CI_PA */ rle = resource_list_find(res, SYS_RES_MEMORY, 0);