From nobody Tue Apr 16 21:42:48 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VJyFN4ghrz5H8Sq; Tue, 16 Apr 2024 21:42:48 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4VJyFN1JhFz4Yqt; Tue, 16 Apr 2024 21:42:48 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1713303768; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=g6819YOhJhXCfGQHRamGJ+EkLHTdEzwGNuF5R4IWomk=; b=NU1R5b6iiM4shW2ebNkdR6X4i2w6a9WHTkJIDgWWNXHYNug4A2VxHqsmurdbclXunZj7z1 GOFIYV0bumfbcG4onBVGnOBgMolVJqHHiOB+1x/Dbs5yC3w9RPK347dK/xfldQciWKpiPj yG6w/GLS9u72asZZWbG8mjjYG1J0jy8eS30e9eMRR/nG3HVIyeX9f7pcA12zyngYpJj/YY OkoN1WgO2szPNE9P5VaAxoOJJqstVeYkhMmx38Eh+/wt+qVr/1/xc/ZdvNLTXloZ1FccTv kDhl1FmKmZJvtbxf6P+U1dOy0PpabiO3xtLRCv3eLMxge7OXmEJZI63INpqcmA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1713303768; a=rsa-sha256; cv=none; b=Dcb8K9mCHXp29hYLAinI4Vmv4epsmu98LFNghawNF7mPD2dD1E8rXBznepCNYkPBo8YXUH SfwRGnYYePqh/5vQ/Xb5FjrLuwNh/r+4ShAi3HL6wELW5pAAgbUCCHGWXbQq4xl+0vNNKh tRTI0/LvcBTcfnoG/S4oF4mgEFIl1ol+LZFiWSh3BX4kjKC7lXaO2Q6kMKXsO26GDijl1w w+iCNbbcPau5i+8wNNWtrJeUSSjqG8fRdxY8ml1mYsZvA7m3P/78DWztWm0pa+BtvgIM0a AiY9ZxCOQw3femI6IanMQyg8AD+N8m+U8e3ukwnkQCA5KhmaAlz1Yl2uNXbIUA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1713303768; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=g6819YOhJhXCfGQHRamGJ+EkLHTdEzwGNuF5R4IWomk=; b=bT0GSMhSMpChNpp7ifDfcDoLtd2FrYSFZwRQlVabtel9W96o+oPx+twfPk4Nv4iB5V1SXj 02+krMalSnL41IjX+Ua/H8XCLyQLH7M333sIsZxYJpKqciiecuRqCZqgJDZh5I4puC8x4W 7bIafxE14FZVed4kxRkKSXT33Q3802DCyiQvsfl+EgWp6JtgArdE+XTXtxx9q4sBH2gwWZ 4mHqqPo52woR0rcadBQ3QqubEyTusPbBVp/cn9JP0YNTwnHTpkRJc+ngWofb8jgOhSeirU zk8PyphFTC9dgvbPv+0GFght6jggufxwR2/EVjlyI7FFYakv8LztjgpBjkYODg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VJyFN0vVtz10NK; Tue, 16 Apr 2024 21:42:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 43GLgmL4094588; Tue, 16 Apr 2024 21:42:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 43GLgmqv094585; Tue, 16 Apr 2024 21:42:48 GMT (envelope-from git) Date: Tue, 16 Apr 2024 21:42:48 GMT Message-Id: <202404162142.43GLgmqv094585@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: bfb3b0e7065f - stable/14 - gicv3: Only set the redistributor base if we're not prealloced List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: bfb3b0e7065f0cee980037bd9ef7afc78f68d7b2 Auto-Submitted: auto-generated The branch stable/14 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=bfb3b0e7065f0cee980037bd9ef7afc78f68d7b2 commit bfb3b0e7065f0cee980037bd9ef7afc78f68d7b2 Author: Warner Losh AuthorDate: 2024-02-28 14:08:39 +0000 Commit: Warner Losh CommitDate: 2024-04-16 21:28:40 +0000 gicv3: Only set the redistributor base if we're not prealloced Only set the redistributor base if we're not reallocated. If we are preallocated, leave it all alone. Sponsored by: Netflix Reviewed by: andrew Differential Revision: https://reviews.freebsd.org/D44035 (cherry picked from commit ae84491a3594c542f2aedc9340581cbb30386c1e) --- sys/arm64/arm64/gicv3_its.c | 134 +++++++++++++++++++++++--------------------- 1 file changed, 71 insertions(+), 63 deletions(-) diff --git a/sys/arm64/arm64/gicv3_its.c b/sys/arm64/arm64/gicv3_its.c index de65d130ce91..51e7251b9ffd 100644 --- a/sys/arm64/arm64/gicv3_its.c +++ b/sys/arm64/arm64/gicv3_its.c @@ -746,81 +746,89 @@ static void its_init_cpu_lpi(device_t dev, struct gicv3_its_softc *sc) { device_t gicv3; - uint64_t xbaser, tmp; + uint64_t xbaser, tmp, size; uint32_t ctlr; u_int cpuid; gicv3 = device_get_parent(dev); cpuid = PCPU_GET(cpuid); - /* Disable LPIs */ - ctlr = gic_r_read_4(gicv3, GICR_CTLR); - ctlr &= ~GICR_CTLR_LPI_ENABLE; - gic_r_write_4(gicv3, GICR_CTLR, ctlr); - - /* Make sure changes are observable my the GIC */ - dsb(sy); - /* - * Set the redistributor base + * Set the redistributor base. If we're reusing what we found on boot + * since the gic was already running, then don't touch it here. We also + * don't need to disable / enable LPI if we're not changing PROPBASER, + * so only do that if we're not prealloced. */ - xbaser = vtophys(sc->sc_conf_base) | - (GICR_PROPBASER_SHARE_IS << GICR_PROPBASER_SHARE_SHIFT) | - (GICR_PROPBASER_CACHE_NIWAWB << GICR_PROPBASER_CACHE_SHIFT) | - (flsl(LPI_CONFTAB_SIZE | GIC_FIRST_LPI) - 1); - gic_r_write_8(gicv3, GICR_PROPBASER, xbaser); - - /* Check the cache attributes we set */ - tmp = gic_r_read_8(gicv3, GICR_PROPBASER); - - if ((tmp & GICR_PROPBASER_SHARE_MASK) != - (xbaser & GICR_PROPBASER_SHARE_MASK)) { - if ((tmp & GICR_PROPBASER_SHARE_MASK) == - (GICR_PROPBASER_SHARE_NS << GICR_PROPBASER_SHARE_SHIFT)) { - /* We need to mark as non-cacheable */ - xbaser &= ~(GICR_PROPBASER_SHARE_MASK | - GICR_PROPBASER_CACHE_MASK); - /* Non-cacheable */ - xbaser |= GICR_PROPBASER_CACHE_NIN << - GICR_PROPBASER_CACHE_SHIFT; - /* Non-shareable */ - xbaser |= GICR_PROPBASER_SHARE_NS << - GICR_PROPBASER_SHARE_SHIFT; - gic_r_write_8(gicv3, GICR_PROPBASER, xbaser); + if ((sc->sc_its_flags & ITS_FLAGS_LPI_PREALLOC) == 0) { + /* Disable LPIs */ + ctlr = gic_r_read_4(gicv3, GICR_CTLR); + ctlr &= ~GICR_CTLR_LPI_ENABLE; + gic_r_write_4(gicv3, GICR_CTLR, ctlr); + + /* Make sure changes are observable my the GIC */ + dsb(sy); + + size = (flsl(LPI_CONFTAB_SIZE | GIC_FIRST_LPI) - 1); + + xbaser = vtophys(sc->sc_conf_base) | + (GICR_PROPBASER_SHARE_IS << GICR_PROPBASER_SHARE_SHIFT) | + (GICR_PROPBASER_CACHE_NIWAWB << GICR_PROPBASER_CACHE_SHIFT) | + size; + + gic_r_write_8(gicv3, GICR_PROPBASER, xbaser); + + /* Check the cache attributes we set */ + tmp = gic_r_read_8(gicv3, GICR_PROPBASER); + + if ((tmp & GICR_PROPBASER_SHARE_MASK) != + (xbaser & GICR_PROPBASER_SHARE_MASK)) { + if ((tmp & GICR_PROPBASER_SHARE_MASK) == + (GICR_PROPBASER_SHARE_NS << GICR_PROPBASER_SHARE_SHIFT)) { + /* We need to mark as non-cacheable */ + xbaser &= ~(GICR_PROPBASER_SHARE_MASK | + GICR_PROPBASER_CACHE_MASK); + /* Non-cacheable */ + xbaser |= GICR_PROPBASER_CACHE_NIN << + GICR_PROPBASER_CACHE_SHIFT; + /* Non-shareable */ + xbaser |= GICR_PROPBASER_SHARE_NS << + GICR_PROPBASER_SHARE_SHIFT; + gic_r_write_8(gicv3, GICR_PROPBASER, xbaser); + } + sc->sc_its_flags |= ITS_FLAGS_LPI_CONF_FLUSH; } - sc->sc_its_flags |= ITS_FLAGS_LPI_CONF_FLUSH; - } - /* - * Set the LPI pending table base - */ - xbaser = vtophys(sc->sc_pend_base[cpuid]) | - (GICR_PENDBASER_CACHE_NIWAWB << GICR_PENDBASER_CACHE_SHIFT) | - (GICR_PENDBASER_SHARE_IS << GICR_PENDBASER_SHARE_SHIFT); - - gic_r_write_8(gicv3, GICR_PENDBASER, xbaser); - - tmp = gic_r_read_8(gicv3, GICR_PENDBASER); - - if ((tmp & GICR_PENDBASER_SHARE_MASK) == - (GICR_PENDBASER_SHARE_NS << GICR_PENDBASER_SHARE_SHIFT)) { - /* Clear the cahce and shareability bits */ - xbaser &= ~(GICR_PENDBASER_CACHE_MASK | - GICR_PENDBASER_SHARE_MASK); - /* Mark as non-shareable */ - xbaser |= GICR_PENDBASER_SHARE_NS << GICR_PENDBASER_SHARE_SHIFT; - /* And non-cacheable */ - xbaser |= GICR_PENDBASER_CACHE_NIN << - GICR_PENDBASER_CACHE_SHIFT; - } + /* + * Set the LPI pending table base + */ + xbaser = vtophys(sc->sc_pend_base[cpuid]) | + (GICR_PENDBASER_CACHE_NIWAWB << GICR_PENDBASER_CACHE_SHIFT) | + (GICR_PENDBASER_SHARE_IS << GICR_PENDBASER_SHARE_SHIFT); + + gic_r_write_8(gicv3, GICR_PENDBASER, xbaser); + + tmp = gic_r_read_8(gicv3, GICR_PENDBASER); + + if ((tmp & GICR_PENDBASER_SHARE_MASK) == + (GICR_PENDBASER_SHARE_NS << GICR_PENDBASER_SHARE_SHIFT)) { + /* Clear the cahce and shareability bits */ + xbaser &= ~(GICR_PENDBASER_CACHE_MASK | + GICR_PENDBASER_SHARE_MASK); + /* Mark as non-shareable */ + xbaser |= GICR_PENDBASER_SHARE_NS << GICR_PENDBASER_SHARE_SHIFT; + /* And non-cacheable */ + xbaser |= GICR_PENDBASER_CACHE_NIN << + GICR_PENDBASER_CACHE_SHIFT; + } - /* Enable LPIs */ - ctlr = gic_r_read_4(gicv3, GICR_CTLR); - ctlr |= GICR_CTLR_LPI_ENABLE; - gic_r_write_4(gicv3, GICR_CTLR, ctlr); + /* Enable LPIs */ + ctlr = gic_r_read_4(gicv3, GICR_CTLR); + ctlr |= GICR_CTLR_LPI_ENABLE; + gic_r_write_4(gicv3, GICR_CTLR, ctlr); - /* Make sure the GIC has seen everything */ - dsb(sy); + /* Make sure the GIC has seen everything */ + dsb(sy); + } } static int