From patchwork Fri Jan 6 11:21:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Jones X-Patchwork-Id: 1722374 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=2TWK41Ck; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=ventanamicro.com header.i=@ventanamicro.com header.a=rsa-sha256 header.s=google header.b=pe2xi/5O; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4NpLXs0PX8z23fc for ; Fri, 6 Jan 2023 22:22:36 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=PjJRDjg/nZqB3Vk1wFS2uPJy3oc1UFCmKCkp4OE6KiY=; b=2TWK41Ckzn4q1b t4OI6+AQvnutwnkeKljYZX/4eo6Eu7TfNN9S9ltm7frb/2/v/HEfbKzG3T2O9TBSBuTE9bqBvpmFI lNgktNDcu6WA6hoj7Q/ZasGraDxrZxsTpnIFWIc6RAGt9TuMXbeVrgEg6mVKiIpTSbuMDaz3FUwNO G4JkDuKMzxc31OcDuKGwRKsp6egKZix/T+1es6rfTO/s0xlAr/ljJcEbZQ0EzUJ5bCNqrXW++nZpX Xqm6gnK5vnMpa5XLWkZtvCZxW5mPXjsjt/fvFh1fRp4j2uQ9VsjHM9wHM3OWkq9dSBYm6bW+xzWxs J6lxK7BrVisQnh8Bw/2Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pDknj-007i59-Gk; Fri, 06 Jan 2023 11:22:19 +0000 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pDkne-007i1m-Vv for opensbi@lists.infradead.org; Fri, 06 Jan 2023 11:22:17 +0000 Received: by mail-wm1-x32a.google.com with SMTP id l26so838720wme.5 for ; Fri, 06 Jan 2023 03:22:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=MTnuSBys5U6IoBw7wxAjNIf0QtkyaS0o6tklimlSlGM=; b=pe2xi/5OcFuhyHbr9ZkbT7dLgxJP3NI4x0kMrCsAg0lzG8QI7DJ36G76sausn1GkyW srSPMUO29rNIAqr0LxNSvxNPIR/cmjukzBiTndiqfgQe/Qc9EPGteVRdt79bUMajWbUU J9FQSQ4Ib/R18HqA/BlsSsy657dSWbxemuk8k2bkObWnFmc3gtkncCuHSs8q0TmhAlU/ vrO3UseYuZ+aAps/FD937pOYu/GO149h1ADDYSAA2+tWEh+jklkhQJGf2bM5mXrrazsS Pd9eNafB0DS2gaBeHO4pgJj/vn5DYC+WugNiWKccdboA1VxxGm5AP/MUc1HJlzj07+uV alVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=MTnuSBys5U6IoBw7wxAjNIf0QtkyaS0o6tklimlSlGM=; b=oZJ/v0NBFX/SaHI8WfuPOhWHThp+AacutcsARdeMCvtgbnMn1alZPIN9RR7hQiaZBz PMvFmc0XsUTJvTsvFGyXjgCHKTZaXt2d4Xq3cs+KFrzxpmXXB/0sTzz6eL6bDPef/WTY ulN4R/VcP0mJWl5npjO1DkLOdLxr7drLHZeM++q3HDeJVFJdyg5OwTmGyYwxrGXu9EAC PW+rnHsXPrieCCTCj2jFVXFKhNqXlZiPNxZu29NxrwW2sNxAB9KfGqf1IPH7fno6NC3D gJf/n4Iie2vkUdh/OC7NHMMOtss7eUvzcY0idnHJ8uAxSS1rbGgU3MwXgB9/f0vzz9wx qMlA== X-Gm-Message-State: AFqh2koCQHwRk0h479p9pD6bH1qowvsE6m3Q0UdhGMJ+IcrzjudjpO14 o7qKAxNqQR4RZPJ8eN7SZawZM1EMTkRmhsqB X-Google-Smtp-Source: AMrXdXsMALVIkc2kZDdQoD06FzZPDMb8OYSZqrZnLd5abrRMI+cFQ1HjXtQNuYOdYp1zz96P43Qktw== X-Received: by 2002:a05:600c:1d28:b0:3d2:1d51:246e with SMTP id l40-20020a05600c1d2800b003d21d51246emr42440444wms.9.1673004130933; Fri, 06 Jan 2023 03:22:10 -0800 (PST) Received: from localhost (cst2-173-16.cust.vodafone.cz. [31.30.173.16]) by smtp.gmail.com with ESMTPSA id n14-20020a05600c3b8e00b003b49bd61b19sm6603662wms.15.2023.01.06.03.22.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Jan 2023 03:22:10 -0800 (PST) From: Andrew Jones To: opensbi@lists.infradead.org Cc: 'Sia Jee Heng ' , 'Anup Patel ' , 'Ley Foon Tan ' , 'Atish Patra ' Subject: [RFC PATCH 00/11] SBI system suspend (SUSP) extension Date: Fri, 6 Jan 2023 12:21:58 +0100 Message-Id: <20230106112209.441825-1-ajones@ventanamicro.com> X-Mailer: git-send-email 2.39.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230106_032215_056808_7210FA39 X-CRM114-Status: GOOD ( 13.10 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: This series implements the SBI system suspend support in OpenSBI as-per the draft proposal for SBI system suspend which can be found at https://github.com/jones-drew/riscv-sbi-doc/commit/d9e43e9a938fc [...] Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:32a listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: opensbi@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "opensbi" Errors-To: opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org This series implements the SBI system suspend support in OpenSBI as-per the draft proposal for SBI system suspend which can be found at https://github.com/jones-drew/riscv-sbi-doc/commit/d9e43e9a938fc3eb510e023c3f352462876f7785 The first half of the series are a few cleanups and fixes for HSM, as system suspend makes use of some of its code and patterns. The second half implements support for the extension and includes a patch which allows testing to be enabled, even when low-level firmware does not provide support. Regarding the test mode, it's currently enabled by adding a 'system-suspend-test' DT property, but Anup has suggested that FW_OPTION could also be used. I'm all ears for what people think the best way to control test functionality in OpenSBI is and am happy to switch it. To test with Linux the kernel must include the patch at https://github.com/jones-drew/linux/commits/riscv/sbi-susp-rfc and be built with CONFIG_SUSPEND enabled. The patches are based on v1.2 and "treewide: Replace TRUE/FALSE with true/false" and can also be found at https://github.com/jones-drew/opensbi/commits/susp-rfc Andrew Jones (11): lib: sbi_hsm: Factor out invalid state detection lib: sbi_hsm: Don't try to restore state on failed change lib: sbi_hsm: Ensure errors are consistent with spec lib: sbi_hsm: Move misplaced comment lib: sbi_hsm: Remove unnecessary include lib: sbi_hsm: Export some functions lib: sbi: Add system suspend skeleton lib: sbi: Add system_suspend_allowed domain property lib: sbi: Implement system suspend docs: Correct opensbi-domain property name platform: generic: Add system suspend test docs/domain_support.md | 15 +++- include/sbi/sbi_domain.h | 2 + include/sbi/sbi_ecall_interface.h | 8 +++ include/sbi/sbi_hsm.h | 4 ++ include/sbi/sbi_system.h | 18 +++++ lib/sbi/Kconfig | 4 ++ lib/sbi/objects.mk | 3 + lib/sbi/sbi_domain.c | 4 ++ lib/sbi/sbi_ecall_hsm.c | 4 +- lib/sbi/sbi_ecall_susp.c | 48 +++++++++++++ lib/sbi/sbi_hsm.c | 92 +++++++++++-------------- lib/sbi/sbi_system.c | 111 ++++++++++++++++++++++++++++++ lib/utils/fdt/fdt_domain.c | 7 ++ platform/generic/platform.c | 20 +++++- 14 files changed, 283 insertions(+), 57 deletions(-) create mode 100644 lib/sbi/sbi_ecall_susp.c