From nobody Sat Mar 19 03:47:20 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 C3FAD1A32662; Sat, 19 Mar 2022 03:47:20 +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 4KL6Jm5C49z4Z3V; Sat, 19 Mar 2022 03:47:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1647661640; 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=IH5/E0FTgMi4s7Ou8130QpmmaP0vndjvs5q777bwIcI=; b=TP4YK4wBrBOLn1j8/2LpSs7edJ4J11OqPLde6A9pPs/EyRfkF2avFmAew1YRxAHTEJf2G3 xba5aUQzR3AkAJXrIrntgYLEfatyw9qkWBl/HZHRMbEyZXZoRb8jN51UD4rbpO93bO4gGu VSu4Oz04H/5lJZkrqswYOd9U0y/5nAZJQsWEox3YdAfS9l+f8zvE/SkPgvkDWadnsxVL8r Zg3rlt1t8u76rjufsU+g/vl92XxLrb/XHei4jcdxlzS9wpFddsgqKcf+tqUbRwEtI2enZ+ vSEtnN5j+dbhPBFMeOJey/2IXZrXmPLRHoGpE+0sXbnvIadcu4fp0yfXflQ10Q== 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 9397534DC; Sat, 19 Mar 2022 03:47:20 +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 22J3lKRW062757; Sat, 19 Mar 2022 03:47:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 22J3lK11062756; Sat, 19 Mar 2022 03:47:20 GMT (envelope-from git) Date: Sat, 19 Mar 2022 03:47:20 GMT Message-Id: <202203190347.22J3lK11062756@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 1236b04bb704 - main - 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/main X-Git-Reftype: branch X-Git-Commit: 1236b04bb7045e541b2343543e356273db20ee56 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1647661640; 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=IH5/E0FTgMi4s7Ou8130QpmmaP0vndjvs5q777bwIcI=; b=IYmXF8ngznITihEqnyYdurZWshKra2v6BtlEX1LVWBFxlE5ySNBMg+PYhv/r4KHqxwmdlM eIlSIunxWmmafBlorMnMaZxIztbbu2rOarhLgELAwBKg21no9JIQxv59Pi+DWK5b+VPtvs wWb/7EZ+1sOISbOm0/jaRaUrr05GcYeCLxHI1zLppa0ySfl2i7L2/xO6uehNbQNrfvt3Xw ztlnzSiR6zGNHmgkiAM8H9FGlvPr2NfT9JUUaZCVAga6yQA4avstnZVBils6RUc9gJZaTf k5DX8yIK8qZLsYW71A3rVsqDJXzfGzeb3+e1wo/QUk3mRmOS0wkRpBufxN4DRA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1647661640; a=rsa-sha256; cv=none; b=cbZx4P0rSaPgu2jhViG+HcORDZVCcd6uZ5SYhvytKDaTTdskhI7WaecJ8P4SSsZX4gDEGC kDYFc9wKx6nzbeMQ8NtWtxyqMrWUZ4D/T2YWo3/QecxvVtveBzNKzvPswiFBg7RcKfVpDL vStSczkysXN8Y0EP7jKnv0sEipjKCen96FWYDyIC/5uUiF6ipcjY+oz4lTRWrCym9cbhBQ weaMJA7b4RpWgGeimBKyzdctaaFv7+m6hFVxZRYJodWNMoxZ2UA9fU4qEnOQWUqibSfVfn QrTonN4YylI6/9n3dmCS+0OO4pPB3ZZ2ZbyEbvgwRM6Adjtc+jAwKMW6gYmwFA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=1236b04bb7045e541b2343543e356273db20ee56 commit 1236b04bb7045e541b2343543e356273db20ee56 Author: Kyle Evans AuthorDate: 2022-03-19 03:03:44 +0000 Commit: Kyle Evans CommitDate: 2022-03-19 03:03:44 +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. Differential Revision: https://reviews.freebsd.org/D34546 --- 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 2388aeb55f8c..7b06a44f35b3 100644 --- a/sys/arm64/arm64/gicv3_its.c +++ b/sys/arm64/arm64/gicv3_its.c @@ -825,7 +825,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); @@ -865,6 +865,18 @@ gicv3_its_attach(device_t dev) sc->sc_ds = DOMAINSET_RR(); } + /* + * 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) @@ -890,8 +902,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);