From nobody Mon Oct 21 15:05:17 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 4XXJWy4vmqz5ZNfh; Mon, 21 Oct 2024 15:05:18 +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 4XXJWy1Fr8z4fcL; Mon, 21 Oct 2024 15:05:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1729523118; 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=ZljbcU5JPXKtlyUK5/WUjXqEBVOUgboiulGC2Z3Rvog=; b=ZQ5uklZsJsArJueaDZR4GrJOSJ0XfEgmtNk8VGnz5YQqSXzO0I2UIcerx3WnGbY0mz6abm cmZVw5r3AzvVRl8G1G7CB63nnoUwscYa6i0c1VEBcny4ofpqVKestrJOdURXNxBLYlJX8z T4iG3GnjzAWc+VtUmDHJ47peLscmjajIXxhaB7onSQQjjZhGjEY2tYE1rWq+5DOUnoY0BR y+n8oGFlx75AmI52h5Hl/htOfdFve5PFPmzE6ACwd8MhlYcQD3ZPevDp92N5ofBAGmverC N6yJ1/9RHOj2ZGzrOZdiAbuLJ0RyHZoHV8893bdDa8GerxXT7kM7wsH/PpbUdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1729523118; 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=ZljbcU5JPXKtlyUK5/WUjXqEBVOUgboiulGC2Z3Rvog=; b=jKTwhrSL8KsbXhdGekeN1JpLCaRZkiHo2kmDu4FjDjhFOGZAvwo6v5hxDsPUvsBQlYo9Vk c2zYcQulSuI4VULqzjUcln1GrMcoWM2HPoa7Fz6W3UIXbz8TORKbThNRtrBOFjdrU+5kB2 iiBnsfMmAvqKOYgDzFAiq5GWQOmS+2TpcvRmKZIr62ufWI71UOLwTVBJVEYqz8cOIVO7b7 cAF3r5XgJKe+aYC6XB9TqzOT7h8kBt0T/7iGvtOzMqCWuQfC/IvAq5U4ObDhovaoGTQRA1 qs3xSqOTvgtqsWiOmGypQrtvpkvZ2Gg7zb+cxG9SXcfwHqD0g8CHY20L4r+X/g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1729523118; a=rsa-sha256; cv=none; b=KKAvi7qgbMgPZP66AX9rgMnVbvkYvVnZnQAI8HynchJ2+GW2b/LH5KTTHLgjhlbvO/JvwY qXyDMacXjHupc13ojBObuuTXllFC+tMNzwAJfCjSEVgitNqTZ2poOzU0+QEM2IwNeDdUwp e8jyPOnGKsczEBuRkOgl+tg1U2Ea88YPdDoInYeE8Y9KaeB03viDy1tZ52bAS2UgvI/SLG Xy9/5YEVnDoBRxNaLlNYmeBj+PRaW9y1DfERMi8h6rkhvYcpN+u0Ul/BowBmUd7XUhTVB/ k34zROej0ElJD13ZaekOvDxZQ4gmlxgsM+HDVxw0wd0t0Zv9+i57qX5J/1v46Q== 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 4XXJWy0GPPzbDW; Mon, 21 Oct 2024 15:05:18 +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 49LF5HSY047294; Mon, 21 Oct 2024 15:05:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 49LF5HQq047291; Mon, 21 Oct 2024 15:05:17 GMT (envelope-from git) Date: Mon, 21 Oct 2024 15:05:17 GMT Message-Id: <202410211505.49LF5HQq047291@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: ee7cb98d4cd0 - stable/14 - 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/stable/14 X-Git-Reftype: branch X-Git-Commit: ee7cb98d4cd0b53c3a7a1bd2cda476c1726232fc Auto-Submitted: auto-generated The branch stable/14 has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=ee7cb98d4cd0b53c3a7a1bd2cda476c1726232fc commit ee7cb98d4cd0b53c3a7a1bd2cda476c1726232fc Author: Andrew Turner AuthorDate: 2024-10-14 14:33:44 +0000 Commit: Andrew Turner CommitDate: 2024-10-21 15:03:27 +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 (cherry picked from commit e4c3536138f4a314dc26331b0a1488faae09aaf4) --- 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;