diff options
| author | Rahul Pathak <[email protected]> | 2026-08-20 17:43:09 +0530 |
|---|---|---|
| committer | Anup Patel <[email protected]> | 2026-09-05 12:53:15 +0530 |
| commit | 3593a5facc4c6938b90429a6973ba9ee21fc5899 (patch) | |
| tree | f933b0b6148c2a1e4467435aa2f1eae6af619e8e /include | |
| parent | 35af7c8c7ee00869afc6e9e0aca64086888bd03f (diff) | |
The per-domain sbi_domain_data hold each domain
associated state like hart context in sbi_domain_context,
mpxy state in sbi_mpxy, and others like each domain backed
by the corresponding MPT (SMMPT).
DATA reads as a generic name, while every use stores state.
Rename functions and macros appropriately. There are no
functional changes.
Signed-off-by: Rahul Pathak <[email protected]>
Reviewed-by: Anup Patel <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Anup Patel <[email protected]>
Diffstat (limited to 'include')
| -rw-r--r-- | include/sbi/sbi_domain.h | 6 | ||||
| -rw-r--r-- | include/sbi/sbi_domain_data.h | 93 | ||||
| -rw-r--r-- | include/sbi/sbi_domain_state.h | 93 |
3 files changed, 96 insertions, 96 deletions
diff --git a/include/sbi/sbi_domain.h b/include/sbi/sbi_domain.h index 16edd4ce..38784a0e 100644 --- a/include/sbi/sbi_domain.h +++ b/include/sbi/sbi_domain.h @@ -15,7 +15,7 @@ #include <sbi/sbi_types.h> #include <sbi/sbi_hartmask.h> #include <sbi/sbi_domain_context.h> -#include <sbi/sbi_domain_data.h> +#include <sbi/sbi_domain_state.h> struct sbi_scratch; @@ -189,8 +189,8 @@ static inline bool sbi_domain_memregion_is_subset( struct sbi_domain { /** Node in linked list of domains */ struct sbi_dlist node; - /** Internal state of per-domain data */ - struct sbi_domain_data_priv data_priv; + /** Internal per-domain state areas */ + struct sbi_domain_state_priv state_priv; /** Logical index of this domain */ u32 index; /** HARTs assigned to this domain */ diff --git a/include/sbi/sbi_domain_data.h b/include/sbi/sbi_domain_data.h deleted file mode 100644 index 7eeafdce..00000000 --- a/include/sbi/sbi_domain_data.h +++ /dev/null @@ -1,93 +0,0 @@ -/* - * SPDX-License-Identifier: BSD-2-Clause - * - * Copyright (c) 2024 Ventana Micro Systems Inc. - */ - -#ifndef __SBI_DOMAIN_DATA_H__ -#define __SBI_DOMAIN_DATA_H__ - -#include <sbi/sbi_types.h> -#include <sbi/sbi_list.h> - -struct sbi_domain; - -/** Maximum domain data per-domain */ -#define SBI_DOMAIN_MAX_DATA_PTRS 32 - -/** Representation of per-domain data */ -struct sbi_domain_data_priv { - /** Array of domain data pointers indexed by domain data identifier */ - void *idx_to_data_ptr[SBI_DOMAIN_MAX_DATA_PTRS]; -}; - -/** Representation of a domain data */ -struct sbi_domain_data { - /** - * Head is used for maintaining data list - * - * Note: initialized by domain framework - */ - struct sbi_dlist head; - /** - * Identifier which used to locate per-domain data - * - * Note: initialized by domain framework - */ - unsigned long data_idx; - /** Size of per-domain data */ - unsigned long data_size; - /** Optional callback to setup domain data */ - int (*data_setup)(struct sbi_domain *dom, - struct sbi_domain_data *data, void *data_ptr); - /** Optional callback to cleanup domain data */ - void (*data_cleanup)(struct sbi_domain *dom, - struct sbi_domain_data *data, void *data_ptr); -}; - -/** - * Get per-domain data pointer for a given domain - * @param dom pointer to domain - * @param data pointer to domain data - * - * @return per-domain data pointer - */ -void *sbi_domain_data_ptr(struct sbi_domain *dom, struct sbi_domain_data *data); - -/** - * Setup all domain data for a domain - * @param dom pointer to domain - * - * @return 0 on success and negative error code on failure - * - * Note: This function is used internally within domain framework. - */ -int sbi_domain_setup_data(struct sbi_domain *dom); - -/** - * Cleanup all domain data for a domain - * @param dom pointer to domain - * - * Note: This function is used internally within domain framework. - */ -void sbi_domain_cleanup_data(struct sbi_domain *dom); - -/** - * Register a domain data - * @param hndl pointer to domain data - * - * @return 0 on success and negative error code on failure - * - * Note: This function must be used only in cold boot path. - */ -int sbi_domain_register_data(struct sbi_domain_data *data); - -/** - * Unregister a domain data - * @param hndl pointer to domain data - * - * Note: This function must be used only in cold boot path. - */ -void sbi_domain_unregister_data(struct sbi_domain_data *data); - -#endif diff --git a/include/sbi/sbi_domain_state.h b/include/sbi/sbi_domain_state.h new file mode 100644 index 00000000..72030380 --- /dev/null +++ b/include/sbi/sbi_domain_state.h @@ -0,0 +1,93 @@ +/* + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2024 Ventana Micro Systems Inc. + */ + +#ifndef __SBI_DOMAIN_STATE_H__ +#define __SBI_DOMAIN_STATE_H__ + +#include <sbi/sbi_types.h> +#include <sbi/sbi_list.h> + +struct sbi_domain; + +/** Maximum number of per-domain state areas */ +#define SBI_DOMAIN_MAX_STATE_PTRS 32 + +/** Internal per-domain state areas */ +struct sbi_domain_state_priv { + /** Array of per-domain state pointers indexed by state identifier */ + void *idx_to_state_ptr[SBI_DOMAIN_MAX_STATE_PTRS]; +}; + +/** Representation of a domain state */ +struct sbi_domain_state { + /** + * Head is used for maintaining state list + * + * Note: initialized by domain framework + */ + struct sbi_dlist head; + /** + * Identifier which used to locate per-domain state + * + * Note: initialized by domain framework + */ + unsigned long state_idx; + /** Size of per-domain state */ + unsigned long state_size; + /** Optional callback to setup domain state */ + int (*state_setup)(struct sbi_domain *dom, + struct sbi_domain_state *state, void *state_ptr); + /** Optional callback to cleanup domain state */ + void (*state_cleanup)(struct sbi_domain *dom, + struct sbi_domain_state *state, void *state_ptr); +}; + +/** + * Get per-domain state pointer for a given domain + * @param dom pointer to domain + * @param state pointer to domain state + * + * @return per-domain state pointer + */ +void *sbi_domain_state_ptr(struct sbi_domain *dom, struct sbi_domain_state *state); + +/** + * Setup all domain state for a domain + * @param dom pointer to domain + * + * @return 0 on success and negative error code on failure + * + * Note: This function is used internally within domain framework. + */ +int sbi_domain_setup_state(struct sbi_domain *dom); + +/** + * Cleanup all domain state for a domain + * @param dom pointer to domain + * + * Note: This function is used internally within domain framework. + */ +void sbi_domain_cleanup_state(struct sbi_domain *dom); + +/** + * Register a domain state + * @param hndl pointer to domain state + * + * @return 0 on success and negative error code on failure + * + * Note: This function must be used only in cold boot path. + */ +int sbi_domain_register_state(struct sbi_domain_state *state); + +/** + * Unregister a domain state + * @param hndl pointer to domain state + * + * Note: This function must be used only in cold boot path. + */ +void sbi_domain_unregister_state(struct sbi_domain_state *state); + +#endif |
