From owner-svn-src-head@freebsd.org Thu May 30 01:24:48 2019 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 6B9D015B30EA; Thu, 30 May 2019 01:24:48 +0000 (UTC) (envelope-from jchandra@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) server-signature RSA-PSS (4096 bits) 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 098DC8FE28; Thu, 30 May 2019 01:24:48 +0000 (UTC) (envelope-from jchandra@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 D50AA9F71; Thu, 30 May 2019 01:24:47 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4U1OleR087036; Thu, 30 May 2019 01:24:47 GMT (envelope-from jchandra@FreeBSD.org) Received: (from jchandra@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4U1OlP4087035; Thu, 30 May 2019 01:24:47 GMT (envelope-from jchandra@FreeBSD.org) Message-Id: <201905300124.x4U1OlP4087035@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jchandra set sender to jchandra@FreeBSD.org using -f From: "Jayachandran C." Date: Thu, 30 May 2019 01:24:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r348378 - head/sys/arm64/arm64 X-SVN-Group: head X-SVN-Commit-Author: jchandra X-SVN-Commit-Paths: head/sys/arm64/arm64 X-SVN-Commit-Revision: 348378 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 098DC8FE28 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.97)[-0.970,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 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: Thu, 30 May 2019 01:24:48 -0000 Author: jchandra Date: Thu May 30 01:24:47 2019 New Revision: 348378 URL: https://svnweb.freebsd.org/changeset/base/348378 Log: gicv3_its: refactor LPI init into a new function Move the per-cpu LPI intialization to a separate function. This is in preparation for a commit that does LPI init only once for a CPU, even when there are multiple ITS blocks associated with the CPU. No functional changes in this commit. Reviewed by: andrew Differential Revision: https://reviews.freebsd.org/D19843 Modified: head/sys/arm64/arm64/gicv3_its.c Modified: head/sys/arm64/arm64/gicv3_its.c ============================================================================== --- head/sys/arm64/arm64/gicv3_its.c Thu May 30 01:21:08 2019 (r348377) +++ head/sys/arm64/arm64/gicv3_its.c Thu May 30 01:24:47 2019 (r348378) @@ -574,26 +574,17 @@ gicv3_its_pendtables_init(struct gicv3_its_softc *sc) } } -static int -its_init_cpu(device_t dev, struct gicv3_its_softc *sc) +static void +its_init_cpu_lpi(device_t dev, struct gicv3_its_softc *sc) { - struct redist_pcpu *rpcpu; device_t gicv3; - vm_paddr_t target; uint64_t xbaser, tmp; uint32_t ctlr; u_int cpuid; gicv3 = device_get_parent(dev); cpuid = PCPU_GET(cpuid); - if (!CPU_ISSET(cpuid, &sc->sc_cpus)) - return (0); - /* Check if the ITS is enabled on this CPU */ - if ((gic_r_read_4(gicv3, GICR_TYPER) & GICR_TYPER_PLPIS) == 0) { - return (ENXIO); - } - /* Disable LPIs */ ctlr = gic_r_read_4(gicv3, GICR_CTLR); ctlr &= ~GICR_CTLR_LPI_ENABLE; @@ -662,6 +653,26 @@ its_init_cpu(device_t dev, struct gicv3_its_softc *sc) /* Make sure the GIC has seen everything */ dsb(sy); +} + +static int +its_init_cpu(device_t dev, struct gicv3_its_softc *sc) +{ + device_t gicv3; + vm_paddr_t target; + u_int cpuid; + struct redist_pcpu *rpcpu; + + gicv3 = device_get_parent(dev); + cpuid = PCPU_GET(cpuid); + if (!CPU_ISSET(cpuid, &sc->sc_cpus)) + return (0); + + /* Check if the ITS is enabled on this CPU */ + if ((gic_r_read_4(gicv3, GICR_TYPER) & GICR_TYPER_PLPIS) == 0) + return (ENXIO); + + its_init_cpu_lpi(dev, sc); if ((gic_its_read_8(sc, GITS_TYPER) & GITS_TYPER_PTA) != 0) { /* This ITS wants the redistributor physical address */