From nobody Tue Apr 16 21:42:46 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 4VJyFM20n7z5H86T; Tue, 16 Apr 2024 21:42:47 +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 4VJyFM0Fjlz4Yfw; Tue, 16 Apr 2024 21:42:47 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1713303767; 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=QE74C3Che1abXNm5lpYvE5a5lxoGhJJRkgcYCzxnEeo=; b=nMLPOihRjU+FnSF+1dJySXDQGCS6fBb86fLK29z8TQvxx+xC0w8VPZ3lGIZIOxCvKdkEi2 bkBKRmlvOc9yAM7/HwUJZsHvikr54bmea2MCSV3lpR+lWAGuoJ8h51mArMCgMude1md/Ai 2Ez3CWF6uiVjb115Au3i+0CE0W78f04Jy0AXLB+pPlPVmhn0IU9PYJ+xGeYLMapOAGWPpL AWhbG4pg2lJ6KwO36221sAoMWvruDl7VNifHqHNSQmAAs0MCusHfLIQ68tGaV0gznhtAe+ FA9yS5resJa1a5eRRFS1RVMUsaqam1jGreP9yGGNVY1RLGSNXw/Q0tK5EPEGQw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1713303767; a=rsa-sha256; cv=none; b=WCKkqavkvcqgJWlwgrhIQMcQmk5pKgSs0Tu2b5eXzd8PIOANvHkl+wD7a/J5odBP9V5/O1 Ebkadxni1OCcQgL3jS3vhGeC2ocGfMqOHAyDd7dqUgBfvI9ZzGbnaOG7A7kMv6pdLEQxeA 9BFD08EyLY0yiJphdUTk5IITQlEmDVeUdiOgPKuwpaxv2mEmiZ6aKJnpLSGFwhKfwTapat lqv7gYQ677FZ7VP7dXIBqqngPDTdc3Zympp2zpklREh9X5o+3QMQjS+Xn3BbftK6G+rUBj bmSAGYDSxcjoGPArbSvsy0x43Ky3dNuw/Pec9CVXNRRtjq5xOIGJ9IkfOzneIQ== 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=1713303767; 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=QE74C3Che1abXNm5lpYvE5a5lxoGhJJRkgcYCzxnEeo=; b=rCkhyDGBhqVlD2X4jk95ScxIToz04x6Ue4PjBny2ZxUrR2z9KpZNKBL1F/brhTQNN3uf81 citsa0QpwYY5z1rwf69GgswDf1HpKSeV+0wPkQFzPBcvX9I5LC0mwsm4flv9BZbN0ozzoM 4krxAfb/AHYALiauQx6eRtfT1cVEsqjW6u4j9nFRcTMnyTaP/WMWy0lwpU6WYElBiUJtze QKcXS0yrKZd74Krtp+M89Fk8DbnXQMkwAaQNU1Pvsnfv6ESgDNUSb6J4kjvbW4bspAFnj+ SWCBth5jGrlSeTfKchaqgC/1YazQroam+c+JwTeNy4fZt2r413g+CS4lY0Ga/w== 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 4VJyFL6xsnz10Lp; Tue, 16 Apr 2024 21:42:46 +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 43GLgkb4094531; Tue, 16 Apr 2024 21:42:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 43GLgk8A094528; Tue, 16 Apr 2024 21:42:46 GMT (envelope-from git) Date: Tue, 16 Apr 2024 21:42:46 GMT Message-Id: <202404162142.43GLgk8A094528@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: 9eea5eb52a0e - stable/14 - 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: 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: 9eea5eb52a0eb61c46da0721176eac2c0d820531 Auto-Submitted: auto-generated The branch stable/14 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=9eea5eb52a0eb61c46da0721176eac2c0d820531 commit 9eea5eb52a0eb61c46da0721176eac2c0d820531 Author: Warner Losh AuthorDate: 2024-02-28 14:08:32 +0000 Commit: Warner Losh CommitDate: 2024-04-16 21:28:37 +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 (cherry picked from commit ddd98f5a626df5de51fd5c2460592d9b95a49179) --- sys/arm64/arm64/gicv3_its.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/sys/arm64/arm64/gicv3_its.c b/sys/arm64/arm64/gicv3_its.c index c9eff1e9f474..de65d130ce91 100644 --- a/sys/arm64/arm64/gicv3_its.c +++ b/sys/arm64/arm64/gicv3_its.c @@ -287,6 +287,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 */ @@ -681,6 +682,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; @@ -697,6 +699,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 { @@ -709,6 +712,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, @@ -721,19 +725,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((vm_offset_t)sc->sc_pend_base[i], - LPI_PENDTAB_SIZE); + /* Flush so the ITS can see the memory */ + cpu_dcache_wb_range((vm_offset_t)sc->sc_pend_base[i], + LPI_PENDTAB_SIZE); + } } }