From nobody Sun Sep 18 06:27:01 2022 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 4MVdBY5bKzz4c32s; Sun, 18 Sep 2022 06:27:01 +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 4MVdBY51Y4z3XnJ; Sun, 18 Sep 2022 06:27:01 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1663482421; 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=dCPiYnefO4OFQO6CefUPsQnt+8KYIUVa6sOkKN7ft70=; b=Uhw8aAjtSIJKVYZaZ1/P7MEBD9mLEQlrRblOyobew6AVCGtamnOOKGMfOaUuZ1yki8PqtM +aqg7L/QeULfEu6Ou4Iknho4vmv8jyjN6okJfn2UtSDDjxAPeG4I1OfDYREtZon0Beu2wW qbCeGmGfN/iDGzbuGJ0aQQxmifslady8HVoC82UVNrYHFyArAdeTCxsvnfv9F5xM5+sh/l THLebGM75hdghZJjfHvGPWppgIRKSKZrteWTN8nMZMNsnRn74gzpsAZIIDKyYSMTPuPSzO mk3aEUUsCOhfrR2DtjaCv69g202jxpwvofo/zxj0AtZT0hFR+ZVtHGWT2d6Oxw== 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 4MVdBY42WczxH6; Sun, 18 Sep 2022 06:27:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 28I6R1Nd067720; Sun, 18 Sep 2022 06:27:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 28I6R1nT067719; Sun, 18 Sep 2022 06:27:01 GMT (envelope-from git) Date: Sun, 18 Sep 2022 06:27:01 GMT Message-Id: <202209180627.28I6R1nT067719@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: d7474d9b3104 - stable/13 - arm64: gic: disable the ITS if it's enabled prior to configuration 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: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: d7474d9b31049aa5bef7b780be2752f6d489ec86 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1663482421; 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=dCPiYnefO4OFQO6CefUPsQnt+8KYIUVa6sOkKN7ft70=; b=heVT2k8HYQ2SEt0EPGLD0UVhGhRakDY7QStReicso/e/S1rQdLsBmsDjkiTuKfyA6dlvsX ZFc4x9uLrjqeEOZ3kZg9B/M9M2BLbkoxYGpyK0rCJA3WzFmlYZESjUxmUD6K+0hAnPn+Kl d7do6whwq+oJzSRqPyhfkAXSq9nqxNJSI8FgF8K2Bkx3msaGrrgD+k3bBzePnMHfBOnW00 e9e4JY7bqIfVue5v8isMmNzBcNaJzl5p2A0W6TEG4i+81jgMN599pXLque8Wzj8XApJy9F uvrFkPFc8X58+vxgHY/rQRwg4n43NRewN0zRDV+r7E1zmne0Nfaa0XKDdL6xDg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1663482421; a=rsa-sha256; cv=none; b=rNhGkmi5inOzBpiyd97/cjKOS/tyQIXqbQLIuI7A1KZvIHjCqr0pSzIHsjUy/E0iwsp95Y kh9UAqYAyvg2Tc5IE02Lkvfl7ezhz2NnOaBC5bCTagnchm8Eh1a6Dj/5K9xHDARTHwdrlR KcqSaLBjYz5GSMONJmQULJbh3VONjVH46N3oY+qvrZJPp5scgTAkosi7vVZ1m2QJReRYes eS8h7sDcX8jQ+W/O+T32/ujh8OrcD6Tc+FnMzPif2p97tvkTRanyGeAv2mDIaLX0Q6zpEX h90K8lLGzVDu3fZ4urBm61aFCNMRSgZrtHytGjPUh4xITpuAt4iBndkF5yeKAA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=d7474d9b31049aa5bef7b780be2752f6d489ec86 commit d7474d9b31049aa5bef7b780be2752f6d489ec86 Author: Kyle Evans AuthorDate: 2022-03-19 03:03:44 +0000 Commit: Kyle Evans CommitDate: 2022-09-18 06:26:38 +0000 arm64: gic: disable the ITS if it's enabled prior to configuration The ITS is defined to be disabled on a warm reset, but we may be coming in via another kernel/hypervisor type setup where the ITS has been previously configured then relinquished to the next kernel in the chain. If it's enabled, the later configuration of GITS_BASER will almost certainly fail -- clear it to prevent that. Reviewed by: andrew Sponsored by: Ampere Computing Submitted by: Klara, Inc. (cherry picked from commit 1236b04bb7045e541b2343543e356273db20ee56) --- sys/arm64/arm64/gicv3_its.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/sys/arm64/arm64/gicv3_its.c b/sys/arm64/arm64/gicv3_its.c index 2af20e5d03fc..82fd57cb42e8 100644 --- a/sys/arm64/arm64/gicv3_its.c +++ b/sys/arm64/arm64/gicv3_its.c @@ -822,7 +822,7 @@ gicv3_its_attach(device_t dev) struct gicv3_its_softc *sc; int domain, err, i, rid; uint64_t phys; - uint32_t iidr; + uint32_t ctlr, iidr; sc = device_get_softc(dev); @@ -855,6 +855,18 @@ gicv3_its_attach(device_t dev) } } + /* + * GIT_CTLR_EN is mandated to reset to 0 on a Warm reset, but we may be + * coming in via, for instance, a kexec/kboot style setup where a + * previous kernel has configured then relinquished control. Clear it + * so that we can reconfigure GITS_BASER*. + */ + ctlr = gic_its_read_4(sc, GITS_CTLR); + if ((ctlr & GITS_CTLR_EN) != 0) { + ctlr &= ~GITS_CTLR_EN; + gic_its_write_4(sc, GITS_CTLR, ctlr); + } + /* Allocate the private tables */ err = gicv3_its_table_init(dev, sc); if (err != 0) @@ -887,8 +899,7 @@ gicv3_its_attach(device_t dev) sc->sc_its_cols[cpu] = NULL; /* Enable the ITS */ - gic_its_write_4(sc, GITS_CTLR, - gic_its_read_4(sc, GITS_CTLR) | GITS_CTLR_EN); + gic_its_write_4(sc, GITS_CTLR, ctlr | GITS_CTLR_EN); /* Create the LPI configuration table */ gicv3_its_conftable_init(sc);