summaryrefslogtreecommitdiff
path: root/include/sbi/sbi_hsm.h
diff options
context:
space:
mode:
authorAtish Patra <atish.patra@wdc.com>2020-02-12 04:32:37 +0300
committerAnup Patel <anup@brainfault.org>2020-02-24 15:37:55 +0300
commitb677a9b8d641f1c16a4f8f52e00019a9bc747893 (patch)
tree5fa5b11867958b81cbeec0678819b60512fb9386 /include/sbi/sbi_hsm.h
parentf64f4b92e411709227ee830bc1e9f8f87c72423e (diff)
downloadopensbi-b677a9b8d641f1c16a4f8f52e00019a9bc747893.tar.xz
lib: Implement hart hotplug
This patch adds support for hart hotplug in OpenSBI using a generic WFI based approach. Hart hotplug can be achieved via SBI HSM extension which allows supervisor mode software to start or stop any harts anytime. Any platform wishes to implement platform specific hart hotplug must implement both hart_start and hart_stop in addition to enable platform feature SBI_PLATFORM_HAS_HART_HOTPLUG. Signed-off-by: Atish Patra <atish.patra@wdc.com> Reviewed-by: Anup Patel <anup.patel@wdc.com>
Diffstat (limited to 'include/sbi/sbi_hsm.h')
-rw-r--r--include/sbi/sbi_hsm.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/include/sbi/sbi_hsm.h b/include/sbi/sbi_hsm.h
new file mode 100644
index 0000000..2566afb
--- /dev/null
+++ b/include/sbi/sbi_hsm.h
@@ -0,0 +1,30 @@
+/*
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (c) 2020 Western Digital Corporation or its affiliates.
+ *
+ * Authors:
+ * Atish Patra <atish.patra@wdc.com>
+ */
+
+#ifndef __SBI_HSM_H__
+#define __SBI_HSM_H__
+
+#include <sbi/sbi_types.h>
+
+/** Hart state values **/
+#define SBI_HART_STOPPED 0
+#define SBI_HART_STOPPING 1
+#define SBI_HART_STARTING 2
+#define SBI_HART_STARTED 3
+
+int sbi_hsm_init(struct sbi_scratch *scratch, u32 hartid, bool cold_boot);
+void __noreturn sbi_hsm_exit(struct sbi_scratch *scratch);
+
+int sbi_hsm_hart_start(struct sbi_scratch *scratch, u32 hartid,
+ ulong saddr, ulong priv);
+int sbi_hsm_hart_stop(struct sbi_scratch *scratch, bool exitnow);
+int sbi_hsm_hart_get_state(struct sbi_scratch *scratch, u32 hartid);
+bool sbi_hsm_hart_started(struct sbi_scratch *scratch, u32 hartid);
+void sbi_hsm_prepare_next_jump(struct sbi_scratch *scratch, u32 hartid);
+#endif