From nobody Tue Oct 15 17:25:09 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 4XSgw567qDz5Ykn5; Tue, 15 Oct 2024 17:25:09 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XSgw55YcRz4Tpn; Tue, 15 Oct 2024 17:25:09 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1729013109; 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=1imtH5SHZUqkSNPsE9yircsV+auGrr7kwQ1y8O2cATA=; b=wEgGsEvoN008vcYnNA5tR7piOnsTo52DUbkM8vqrxzr+G+F7jY11M9CVcMI1zf3KH7ErkX wcHn0ZwTeRM26q1Ccm71vZlrmHqYruFpsTYTJCoyimmn3AmnMUXrC8hwwdboLuSdu3cArT CcWguZj5hRoWQi04v//YRc8wzSLl05OSSGIBGUywImZCShH+sGxaZ8MF5LUKxjWsXQKZuh 6v7l2X4UHfT5oEk6JIYkFRFQfo9uZ254RyxaQLuJz7U8FVEhd1MZ94QOEdIweoGDLnXW8a c23Lo6/tvEsEQezVTOWToW40ywezVrAa1dF4VjiCuIhrsCHn/eLNe4FAveRHIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1729013109; 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=1imtH5SHZUqkSNPsE9yircsV+auGrr7kwQ1y8O2cATA=; b=DvnTjmoa+6UaBp7Hm1lG0wOQMO0d0ra88ozPbonircnPwxhDns4Xrds7qEh9p8Mqy2FJrD Ra6gznyRFR/Uot7gWNkqN1oeqQjclcApwrhBsMio8WTky9vdXkNd6GEEicaihfPXnj01Nr ZFzmKe3swZUgUXNmXfhP04DXGZSHkjDqq2NJYQTKjm6g0XDl0uoEMU0jIAb796qXbfhJj7 nK4cwjHf3bN7R0UwX/tt9qi3noAxGsXTKW128bvVBfg9Wsanc7kjNZR26LWxqboVaqFKFH B4WdMDBdu8t+GKeBK1JhUf/weSSXRchBg4s/5lFcQ9/Zpua4g5cfahqSjn1GRA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1729013109; a=rsa-sha256; cv=none; b=N0uTywmdy4qJbciEjQNNHl+4JWFXuLeS8e+VVhFtEOqLbfsxdSHcs10Fj/8aDQX+95nKIP TlwT+7SngXpzplJUr2QXBWDlT1KmXV+8HMtDAyfpNIvIZfSYmIvd57S5Nzyh7nRqvcnQpK wfQbsxUql4eP45YVEjs5iUGx8UhkRV17cVkXGWxNu6HyiExIR27E2FJ1XcPP/uUuxfXiVJ t40w+osarCc9sdMwzideEYwYL1AkWbfj4PJ2fzUAoCCAW81pyTJwU4U0NLoOKAvWtXotAT 5x/7ZuXkO6Gffv9iHGYszCr8F4LIiLrp/3oZ1tbupQ4O0U/j83blTSuYUnkg5Q== 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 4XSgw559F1zWR3; Tue, 15 Oct 2024 17:25:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 49FHP9mT027811; Tue, 15 Oct 2024 17:25:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 49FHP95j027808; Tue, 15 Oct 2024 17:25:09 GMT (envelope-from git) Date: Tue, 15 Oct 2024 17:25:09 GMT Message-Id: <202410151725.49FHP95j027808@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Turner Subject: git: e4c3536138f4 - main - dev/psci: Create macros to simplify calling SMCCC 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: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e4c3536138f4a314dc26331b0a1488faae09aaf4 Auto-Submitted: auto-generated The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=e4c3536138f4a314dc26331b0a1488faae09aaf4 commit e4c3536138f4a314dc26331b0a1488faae09aaf4 Author: Andrew Turner AuthorDate: 2024-10-14 14:33:44 +0000 Commit: Andrew Turner CommitDate: 2024-10-15 17:24:41 +0000 dev/psci: Create macros to simplify calling SMCCC When calling into SMCCC functions we often only need a few arguments. As the current function needs all 8 possible arguments to be set the unused values will be zero. Create a macro to pass in the used values, followed by enough zeros, then the result pointer. Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D46986 --- sys/dev/psci/smccc.h | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/sys/dev/psci/smccc.h b/sys/dev/psci/smccc.h index 96527f037d78..dd10fb8018ae 100644 --- a/sys/dev/psci/smccc.h +++ b/sys/dev/psci/smccc.h @@ -91,6 +91,38 @@ int arm_smccc_smc(register_t, register_t, register_t, register_t, register_t, int arm_smccc_hvc(register_t, register_t, register_t, register_t, register_t, register_t, register_t, register_t, struct arm_smccc_res *res); +#define arm_smccc_invoke_1(func, a0, res) \ + func(a0, 0, 0, 0, 0, 0, 0, 0, res) +#define arm_smccc_invoke_2(func, a0, a1, res) \ + func(a0, a1, 0, 0, 0, 0, 0, 0, res) +#define arm_smccc_invoke_3(func, a0, a1, a2, res) \ + func(a0, a1, a2, 0, 0, 0, 0, 0, res) +#define arm_smccc_invoke_4(func, a0, a1, a2, a3, res) \ + func(a0, a1, a2, a3, 0, 0, 0, 0, res) +#define arm_smccc_invoke_5(func, a0, a1, a2, a3, a4, res) \ + func(a0, a1, a2, a3, a4, 0, 0, 0, res) +#define arm_smccc_invoke_6(func, a0, a1, a2, a3, a4, a5, res) \ + func(a0, a1, a2, a3, a4, a5, 0, 0, res) +#define arm_smccc_invoke_7(func, a0, a1, a2, a3, a4, a5, a6, res) \ + func(a0, a1, a2, a3, a4, a5, a6, 0, res) +#define arm_smccc_invoke_8(func, a0, a1, a2, a3, a4, a5, a6, a7, res) \ + func(a0, a1, a2, a3, a4, a5, a6, a7, res) + +#define _arm_smccc_invoke_macro(_1, _2, _3, _4, _5, _6, _7, _8, NAME, ...) \ + NAME +#define _arm_smccc_invoke(func, a0, ...) \ + _arm_smccc_invoke_macro(__VA_ARGS__, arm_smccc_invoke_8, \ + arm_smccc_invoke_7, arm_smccc_invoke_6, arm_smccc_invoke_5, \ + arm_smccc_invoke_4, arm_smccc_invoke_3, arm_smccc_invoke_2, \ + arm_smccc_invoke_1)(func, a0, __VA_ARGS__) + +#define arm_smccc_invoke_hvc(a0, ...) \ + _arm_smccc_invoke(arm_smccc_hvc, a0, __VA_ARGS__) +#define arm_smccc_invoke_smc(a0, ...) \ + _arm_smccc_invoke(arm_smccc_smc, a0, __VA_ARGS__) +#define arm_smccc_invoke(a0, ...) \ + _arm_smccc_invoke(psci_callfn, a0, __VA_ARGS__) + struct arm_smccc_1_2_regs { register_t a0; register_t a1;