From nobody Mon May 15 15:46:03 2023 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 4QKkHJ264Wz4BlRk; Mon, 15 May 2023 15:46:04 +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 4QKkHJ0KTdz3JpM; Mon, 15 May 2023 15:46:04 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1684165564; 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=cqxCusGpQ9YlYNw+liVx2kdVDruQcKL0FRiTVqkhbxw=; b=gI3/6VWfbnhd6pf7HXtQFe5/XTctgTqVV+kdbrR3ooGozOOlEc/oCcDX5ulCvClWipCb89 omD5p8mROs2F8GdlOEk3eiVtCF89H6QZo5gFGePdRUcVWbdmZM9IlgHyv67c5p9sTVuETc Pmh/JHtUiQ03I0aFjeib3OMNJ9LWVhOEfTpShFkqlfYSpDbhGuTLoUIdbnpqku98Mq1CU9 iIW7953k8Vp34Pxmw6oXHm4QYCIMQ50ofQifhDYxtAqnQE5HIeefxNNflQgfnpmZxbwIEr W7Rbi7QfSakZgeatAUzuKz7g7UkeVPUcYRzc7mEZY/74mMftUwnPFT2oSAP2hw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1684165564; 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=cqxCusGpQ9YlYNw+liVx2kdVDruQcKL0FRiTVqkhbxw=; b=wasBMUKf6ofXBiOnD2+zauMwEW3kprZ5Q5aGW39xgR4p3eObNh+WFH8GqktGni1WBgRgs/ +XzsNfvg9R78GltsHd2u33JDazS1MXGKoXqPQg3rUoFvi4QxCcxuaXvOVKYuNat6WH5pyh y9zPaJO4iq+l0ofXJ/9EnPKtEu9PMU3T/ITjuYBZNXcuPQThRkqj31rLHWUqTKi+hWxart XoHiyyEQeo4BfcU+a5U58r0ZP2r83flGkb3cQy6o4ovW/dLWZIA7038QN1iPavIsislT9K rcW5f7XRJeOIhmqA4IGCd7a0chblphufzoS2TIBkJdvjvJNMpeSYHHuknaHwXA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1684165564; a=rsa-sha256; cv=none; b=Pciv3uUliq4w1P74JrH9VIwnHeJQdFMYiPHAwoIEn7w19GhVUpTk/CZbHH/X5Cbk6DqlKQ Cm+EDLvTy8RV5v9oFUcf0etIcJr756aHJc4hvA2cgTewxnuqd3mWqPs8Rz3UKAjVkDP9If YDpFTrXG9uDuywCMRWUS7qf/Ze1+ybHLpWLFDubodADNnqcq2hMEkaPzO3mjmwLbFmzR1M f6Y7QG1ju/Vj3HxYXHw7u6xn0mVHSMJEl/exB8t4Z1WdOTeTb6ksUmG27ey9JhLQ65Ii6v vjPR4kBRWglXMPyaUWvTwR/VbWLrb7SOCznDyklbriFLIsNcA5HF7MKZhKHFVA== 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 4QKkHH6WK6zmTd; Mon, 15 May 2023 15:46:03 +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 34FFk36J073532; Mon, 15 May 2023 15:46:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 34FFk3Fk073531; Mon, 15 May 2023 15:46:03 GMT (envelope-from git) Date: Mon, 15 May 2023 15:46:03 GMT Message-Id: <202305151546.34FFk3Fk073531@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Andrew Turner Subject: git: d42fa41bc2ed - stable/13 - Make SMCCC usable by device drivers 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: andrew X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: d42fa41bc2edfe0a6ffb49f79fcb2790a743ae4a Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=d42fa41bc2edfe0a6ffb49f79fcb2790a743ae4a commit d42fa41bc2edfe0a6ffb49f79fcb2790a743ae4a Author: Andrew Turner AuthorDate: 2022-06-04 11:13:51 +0000 Commit: Andrew Turner CommitDate: 2023-05-15 10:55:36 +0000 Make SMCCC usable by device drivers To allow device drivers to call into SMCCC we need to initialise it earlier. As it depends on PSCI, and that is detected via ACPI or FDT move the call to smccc_init to the PSCI driver. Add a function for drivers to read the smccc version, or 0 if smccc is not present. (cherry picked from commit 0600af1ff16041f15633b2263a8ad9525eecd2f1) (cherry picked from commit 7ca55fcc541b375c83eaf75f0658b79f250c82fd) --- sys/dev/psci/psci.c | 4 ++++ sys/dev/psci/smccc.c | 11 ++++++++--- sys/dev/psci/smccc.h | 2 ++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/sys/dev/psci/psci.c b/sys/dev/psci/psci.c index d54ee62fb328..228850ac6895 100644 --- a/sys/dev/psci/psci.c +++ b/sys/dev/psci/psci.c @@ -348,6 +348,10 @@ psci_attach(device_t dev, psci_initfn_t psci_init, int default_version) if (psci_init(dev, default_version)) return (ENXIO); +#ifdef __aarch64__ + smccc_init(); +#endif + psci_softc = sc; return (0); diff --git a/sys/dev/psci/smccc.c b/sys/dev/psci/smccc.c index 54673d431d4c..64732d58e2d4 100644 --- a/sys/dev/psci/smccc.c +++ b/sys/dev/psci/smccc.c @@ -47,8 +47,8 @@ __FBSDID("$FreeBSD$"); /* Assume 1.0 until we detect a later version */ static uint32_t smccc_version = SMCCC_VERSION_1_0; -static void -smccc_init(void *dummy) +void +smccc_init(void) { int32_t features; uint32_t ret; @@ -67,7 +67,12 @@ smccc_init(void *dummy) SMCCC_VERSION_MINOR(smccc_version)); } } -SYSINIT(smccc_start, SI_SUB_CONFIGURE, SI_ORDER_ANY, smccc_init, NULL); + +uint32_t +smccc_get_version(void) +{ + return (smccc_version); +} int32_t smccc_arch_features(uint32_t smccc_func_id) diff --git a/sys/dev/psci/smccc.h b/sys/dev/psci/smccc.h index 6bb4dbcf7076..4644ee1cc7b3 100644 --- a/sys/dev/psci/smccc.h +++ b/sys/dev/psci/smccc.h @@ -82,6 +82,8 @@ struct arm_smccc_res { #define SMCCC_RET_NOT_SUPPORTED -1 #define SMCCC_RET_NOT_REQUIRED -2 +void smccc_init(void); +uint32_t smccc_get_version(void); int32_t smccc_arch_features(uint32_t); int smccc_arch_workaround_1(void); int smccc_arch_workaround_2(int);