From nobody Wed Feb 28 14:10:42 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 4TlGTv3Qfjz5BfMc; Wed, 28 Feb 2024 14:10:43 +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 4TlGTv1Hf5z4fSK; Wed, 28 Feb 2024 14:10:43 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1709129443; 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=nwPFf6zD1JR6cjNGBJ7WwP0/OukdLSWvI/DtIzrUzqY=; b=fKFF6A31mEbs5cbYIt81WYxxq5Ldi0cO6IvbSd8tvsf2eUxh/qvp7aSEMD5GUq5G04Pd8g Jd/MgTWjvw5/55r4M2gsahMcy4ipiBiPSXiTv0Fpxm0kG0O8KkpfW0uDCQJeOO4XcVc3Df I52cD3eyClW9o80StO7Divw/RVk/eiF/vi5AIHSh+iL5nOulFwJnUQi4cJvqNNpQwBLtcG Y2iUOWfPb7SS6PpQh4GpstjNzp3e5upHr4ViQOkgeEdVo01jMcx0YCWmVgv7XtxM4ViqVk KwJXdE8+0wBClm0bfQ1TBM9lkPM/g7SS5wfMxGMrxqHVnuYSq9UU5Hdd7PNQcQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1709129443; a=rsa-sha256; cv=none; b=D3UFUBPgPmqeN4Pvh64pe7fuXr/AlKMBKLSYWcFxuMk59oWxd6PXSb1P4BjLKVEVIqjK4+ kIE1Osm2lBwkagzyLVadzQ1+a1NDngdjKY3S8jgmwCvGbhfeltLrXHLCEotj6dEiXAJvyI Kh+hmTPsxAjx60TIiCNuPnw/Dj8wWTPswYvEfNQQIguaG/hpp4fNTFZ6l6GrN7l+e7xasT 0fUOxReZI8cw2ru5jUTmY5gFMD8DUbIbxrtYkEwrnFvkb/eVPAZPt5y540CJaSN1LysG9q aO11Y5T/NpJvRUbRxhq/4/9uWRt6Mo6uEr9rFLxzJmGe1ocKzCPDsyo/itKW9Q== 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=1709129443; 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=nwPFf6zD1JR6cjNGBJ7WwP0/OukdLSWvI/DtIzrUzqY=; b=GgOC05JHOxP1sbGZLYU5NQGaSUH/KI4q+kY3JaHy84l7uzRP2X/z00XkDAb4k0bepOFKpg 7HmZ4YuuCDvg1iIZbDHiG/NENpmwdXY9zI8cHfWEZ7az7RPOjSZs2z77DelbVpEpxVokQa eaRmrP5OzRTNKKpQPdvGhQmtIs3tcTxx5q0FVA5O1rlRKwcttBcR2I38eS7BHPJ8QXh5Mp YSyhdVfe9loZIg++alCV4aLJXL54fUfkvi6juH4zJByv98flFpgBHBG03nOGNTUQFCYaqS RHEbMDftk5/MXJcr/jDJ4ZE4X/kbJTo4DILzxnkabeOGm6HiZi6e2QQTlVtDcw== 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 4TlGTv0P3rz1113; Wed, 28 Feb 2024 14:10:43 +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 41SEAgSO058156; Wed, 28 Feb 2024 14:10:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 41SEAgJg058144; Wed, 28 Feb 2024 14:10:42 GMT (envelope-from git) Date: Wed, 28 Feb 2024 14:10:42 GMT Message-Id: <202402281410.41SEAgJg058144@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: ddd98f5a626d - main - gicv3: Don't allocate pend_base if we're already started 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: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: 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/main X-Git-Reftype: branch X-Git-Commit: ddd98f5a626df5de51fd5c2460592d9b95a49179 Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=ddd98f5a626df5de51fd5c2460592d9b95a49179 commit ddd98f5a626df5de51fd5c2460592d9b95a49179 Author: Warner Losh AuthorDate: 2024-02-28 14:08:32 +0000 Commit: Warner Losh CommitDate: 2024-02-28 14:09:42 +0000 gicv3: Don't allocate pend_base if we're already started If the gicv3 is already started, then don't allocate memory for the pend_base tables. Sponsored by: Netflix Reviewed by: andrew Differential Revision: https://reviews.freebsd.org/D44034 --- sys/arm64/arm64/gicv3_its.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/sys/arm64/arm64/gicv3_its.c b/sys/arm64/arm64/gicv3_its.c index d3df0a571e95..c7e9ef7a3733 100644 --- a/sys/arm64/arm64/gicv3_its.c +++ b/sys/arm64/arm64/gicv3_its.c @@ -286,6 +286,7 @@ struct gicv3_its_softc { #define ITS_FLAGS_CMDQ_FLUSH 0x00000001 #define ITS_FLAGS_LPI_CONF_FLUSH 0x00000002 #define ITS_FLAGS_ERRATA_CAVIUM_22375 0x00000004 +#define ITS_FLAGS_LPI_PREALLOC 0x00000008 u_int sc_its_flags; bool trace_enable; vm_page_t ma; /* fake msi page */ @@ -680,6 +681,7 @@ gicv3_its_conftable_init(struct gicv3_its_softc *sc) { /* note: we assume the ITS children are serialized by the parent */ static void *conf_table; + int extra_flags = 0; device_t gicv3; uint32_t ctlr; @@ -696,6 +698,7 @@ gicv3_its_conftable_init(struct gicv3_its_softc *sc) gicv3 = device_get_parent(sc->dev); ctlr = gic_r_read_4(gicv3, GICR_CTLR); if ((ctlr & GICR_CTLR_LPI_ENABLE) != 0) { + extra_flags = ITS_FLAGS_LPI_PREALLOC; panic("gicv3 already enabled, can't reprogram."); } else { @@ -708,6 +711,7 @@ gicv3_its_conftable_init(struct gicv3_its_softc *sc) LPI_CONFTAB_ALIGN, 0); } sc->sc_conf_base = conf_table; + sc->sc_its_flags |= extra_flags; /* Set the default configuration */ memset(sc->sc_conf_base, GIC_PRIORITY_MAX | LPI_CONF_GROUP1, @@ -720,18 +724,20 @@ gicv3_its_conftable_init(struct gicv3_its_softc *sc) static void gicv3_its_pendtables_init(struct gicv3_its_softc *sc) { - int i; - for (i = 0; i <= mp_maxid; i++) { - if (CPU_ISSET(i, &sc->sc_cpus) == 0) - continue; + if ((sc->sc_its_flags & ITS_FLAGS_LPI_PREALLOC) == 0) { + for (int i = 0; i <= mp_maxid; i++) { + if (CPU_ISSET(i, &sc->sc_cpus) == 0) + continue; - sc->sc_pend_base[i] = (vm_offset_t)contigmalloc( - LPI_PENDTAB_SIZE, M_GICV3_ITS, M_WAITOK | M_ZERO, - 0, LPI_PENDTAB_MAX_ADDR, LPI_PENDTAB_ALIGN, 0); + sc->sc_pend_base[i] = (vm_offset_t)contigmalloc( + LPI_PENDTAB_SIZE, M_GICV3_ITS, M_WAITOK | M_ZERO, + 0, LPI_PENDTAB_MAX_ADDR, LPI_PENDTAB_ALIGN, 0); - /* Flush so the ITS can see the memory */ - cpu_dcache_wb_range(sc->sc_pend_base[i], LPI_PENDTAB_SIZE); + /* Flush so the ITS can see the memory */ + cpu_dcache_wb_range(sc->sc_pend_base[i], + LPI_PENDTAB_SIZE); + } } }