From patchwork Tue Aug 6 07:33:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 1969362 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org 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=TCK418KN; 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=JvJ/dC+R; dkim-atps=neutral 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=patchwork.ozlabs.org) 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 (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WdQ6k1MZ6z1yYD for ; Tue, 6 Aug 2024 17:34:22 +1000 (AEST) 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:References:In-Reply-To: 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: List-Owner; bh=lmW4bGcP3piOfC1iBbJ2paZiwuTVx7rcELw4Wm7wsPQ=; b=TCK418KNZy8FeD vudZ4P940HtdgWrcRzhH8xCfIavUgKVvoCR/H9fp6TiqvBo8f8CHvDc5jtKrM6nGoeI/kqjA1za1B K9fMOpngFhd3K2CqXvXSNWS1gzJ4a2vL81aFQjWyZf1x++aw7iyHELRU5JR1Z0pb2jwwXrPtC27RI lOA+/OAQ7EzeZExEZ9qzcgFOJfw4l9jlp+cYkR+yDUwHc4xwC0WgCFi9N/ST1qNnduvd3O6VLcDak B6JHVEg4qDRldSszv/eocim/dwFFIDHz1NHIuaBF/ZbDETlOMHcUGi1DALpTSmuSLplJC6wUhoInQ 5V/u6Z15l3OzgSC3M78A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sbEhy-00000000nxN-1pZP; Tue, 06 Aug 2024 07:34:14 +0000 Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sbEhv-00000000nuy-2fl8 for opensbi@lists.infradead.org; Tue, 06 Aug 2024 07:34:13 +0000 Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-70d1c655141so203982b3a.1 for ; Tue, 06 Aug 2024 00:34:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1722929651; x=1723534451; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=s/ZKIgQwhn8FRNR3SSuhI2F5k74pyUvGdi5+UfohX5I=; b=JvJ/dC+RZE5/3xZR/7Khe9BAdEh6uxKyl+Ky2UZvLet5ioKlvDkrOSUqEs/qn1KVQ7 WnfR1vAmHNgDqblLV7SXj3ojyjpRh7VwBeZ7dsPQEVnDh5w1qI10yhvFWkBFJcwXFdPj YbNkX6w+KtVnz4wfcIBgHDF9uhWeoLXITWXQNuRDhc4JBEjfYthcJl0/gfzllReCBKSb V+OGVyMxmrOgcFooMJDWZFLczNYdOXjDpGbcXN/SvwQb04xHZ/dgSJvHVRtA6NgXljMJ trwy4To57TPTkzYe+fICbRdLji5EmFwQFxrUIfrBHTodMyocNBM1uMO6yv7XG6hG+U1I 2P4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722929651; x=1723534451; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=s/ZKIgQwhn8FRNR3SSuhI2F5k74pyUvGdi5+UfohX5I=; b=Xze3YUcdrG0iEF5Zg1PEP5wGEN4mUJ6o1ArIew52HN/YEhyTZwEQwZngcsSjbDlpy4 UTkj7boG6g9lqThMNJT462RE7gfCuOwiPUGi5aPDaFlqJLzOJuFMH9mI8phV39pBo0eh ra0WVbqKPGFmowrbQqxKyIvqFngvHqbQI9wh2YIHRnMZ8L3T167uDmhJTKhoA9isF/+F 1kelZZcdHiUrSVdMHkpKdcCggHilwxBbpR/VjxIzBNsdnuy6uiVUZtgKIE1h99SnD15F Nu3SVgQ2/Fy7B0T3KDtBZ2BZEYndQ1QcXI6w0JKbTPPAgQqLvOam/9iXq+ItaDGDVd/Y Bd/Q== X-Forwarded-Encrypted: i=1; AJvYcCX2w1uXrZRGFH13m/bpkwwxA4yOJfS0oqNJbXnheypLFGuH85LlycKwg0dAqZX+gktrzbw03pWevM9tKMksz4G2DWhFPi2aOlaB7hw= X-Gm-Message-State: AOJu0Yy2ZPyE7ciXXd2LHc3zj/ys6Kv+sQ+ZXwANyUfdZ9oiv6n+7fNv K/q72r6B9CgFKTq9MTIr8ZtgGJ/A1jvAoCYvmTX+HRJu6J1iPgb7UWbWk0AlfaDvQjtNzN+8U/v c X-Google-Smtp-Source: AGHT+IGSZ+n/1FGZM1U2VqQUl4pVgZWZkPV2CClzy2ao30iDxPJdMrDuoEZ7REdPUQmLEuAUPfcRAw== X-Received: by 2002:a05:6a20:7288:b0:1c3:fc60:84f1 with SMTP id adf61e73a8af0-1c6995511c4mr16694737637.7.1722929650353; Tue, 06 Aug 2024 00:34:10 -0700 (PDT) Received: from anup-ubuntu-vm.localdomain ([223.185.134.124]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7106ed2de28sm6455011b3a.191.2024.08.06.00.34.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Aug 2024 00:34:09 -0700 (PDT) From: Anup Patel To: Atish Patra Cc: Andrew Jones , Anup Patel , opensbi@lists.infradead.org, Subrahmanya Lingappa , Anup Patel Subject: [PATCH 09/16] lib: sbi: Add optional resume address to hart suspend Date: Tue, 6 Aug 2024 13:03:31 +0530 Message-Id: <20240806073338.1856901-10-apatel@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240806073338.1856901-1-apatel@ventanamicro.com> References: <20240806073338.1856901-1-apatel@ventanamicro.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240806_003411_904924_127E43D5 X-CRM114-Status: GOOD ( 13.28 ) X-Spam-Score: -2.1 (--) 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: From: Subrahmanya Lingappa Add an optional resume address to the platform specific hart suspend call. Signed-off-by: Subrahmanya Lingappa Signed-off-by: Anup Patel --- include/sbi/sbi_hsm.h | 6 +++++- lib/sbi/sbi_hsm.c | 6 +++--- platform/generic/ [...] Content analysis details: (-2.1 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:42e 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_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 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 From: Subrahmanya Lingappa Add an optional resume address to the platform specific hart suspend call. Signed-off-by: Subrahmanya Lingappa Signed-off-by: Anup Patel --- include/sbi/sbi_hsm.h | 6 +++++- lib/sbi/sbi_hsm.c | 6 +++--- platform/generic/allwinner/sun20i-d1.c | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/include/sbi/sbi_hsm.h b/include/sbi/sbi_hsm.h index 4b5601ba..aa692dfe 100644 --- a/include/sbi/sbi_hsm.h +++ b/include/sbi/sbi_hsm.h @@ -39,8 +39,12 @@ struct sbi_hsm_device { * * For successful non-retentive suspend, the hart will resume from * the warm boot entry point. + * + * NOTE: mmode_resume_addr(resume address) is optional hence it + * may or may not be honored by the platform. If its not honored + * then platform must ensure to resume from the warmboot address. */ - int (*hart_suspend)(u32 suspend_type); + int (*hart_suspend)(u32 suspend_type, ulong mmode_resume_addr); /** * Perform platform-specific actions to resume from a suspended state. diff --git a/lib/sbi/sbi_hsm.c b/lib/sbi/sbi_hsm.c index 3706acfb..2f518d44 100644 --- a/lib/sbi/sbi_hsm.c +++ b/lib/sbi/sbi_hsm.c @@ -228,10 +228,10 @@ static int hsm_device_hart_stop(void) return SBI_ENOTSUPP; } -static int hsm_device_hart_suspend(u32 suspend_type) +static int hsm_device_hart_suspend(u32 suspend_type, ulong mmode_resume_addr) { if (hsm_dev && hsm_dev->hart_suspend) - return hsm_dev->hart_suspend(suspend_type); + return hsm_dev->hart_suspend(suspend_type, mmode_resume_addr); return SBI_ENOTSUPP; } @@ -536,7 +536,7 @@ int sbi_hsm_hart_suspend(struct sbi_scratch *scratch, u32 suspend_type, __sbi_hsm_suspend_non_ret_save(scratch); /* Try platform specific suspend */ - ret = hsm_device_hart_suspend(suspend_type); + ret = hsm_device_hart_suspend(suspend_type, scratch->warmboot_addr); if (ret == SBI_ENOTSUPP) { /* Try generic implementation of default suspend types */ if (suspend_type == SBI_HSM_SUSPEND_RET_DEFAULT || diff --git a/platform/generic/allwinner/sun20i-d1.c b/platform/generic/allwinner/sun20i-d1.c index ab2eee55..33312e0b 100644 --- a/platform/generic/allwinner/sun20i-d1.c +++ b/platform/generic/allwinner/sun20i-d1.c @@ -152,7 +152,7 @@ static void sun20i_d1_riscv_cfg_init(void) writel_relaxed(entry >> 32, SUN20I_D1_RISCV_CFG_BASE + RESET_ENTRY_HI_REG); } -static int sun20i_d1_hart_suspend(u32 suspend_type) +static int sun20i_d1_hart_suspend(u32 suspend_type, ulong mmode_resume_addr) { /* Use the generic code for retentive suspend. */ if (!(suspend_type & SBI_HSM_SUSP_NON_RET_BIT))