diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/sbi/sbi_hart_protection.h | 49 | ||||
| -rw-r--r-- | include/sbi/sbi_hartmask.h | 4 | ||||
| -rw-r--r-- | include/sbi/sbi_mpxy.h | 4 | ||||
| -rw-r--r-- | include/sbi/sbi_timer.h | 3 | ||||
| -rw-r--r-- | include/sbi/sbi_tlb.h | 31 |
5 files changed, 82 insertions, 9 deletions
diff --git a/include/sbi/sbi_hart_protection.h b/include/sbi/sbi_hart_protection.h index d65f32ca..cafe6ee7 100644 --- a/include/sbi/sbi_hart_protection.h +++ b/include/sbi/sbi_hart_protection.h @@ -11,6 +11,14 @@ #include <sbi/sbi_list.h> struct sbi_scratch; +struct sbi_domain; + +/** Different types of hart protection mechanisms */ +enum sbi_hart_protection_type { + SBI_HART_PROTECTION_TYPE_MEMORY = 0, + SBI_HART_PROTECTION_TYPE_ID, + SBI_HART_PROTECTION_TYPE_MAX +}; /** Representation of hart protection mechanism */ struct sbi_hart_protection { @@ -20,14 +28,17 @@ struct sbi_hart_protection { /** Name of the hart protection mechanism */ char name[32]; + /** Type of the hart protection mechanism */ + enum sbi_hart_protection_type type; + /** Ratings of the hart protection mechanism (higher is better) */ unsigned long rating; /** Configure protection for current HART (Mandatory) */ - int (*configure)(struct sbi_scratch *scratch); + int (*configure)(struct sbi_scratch *scratch, struct sbi_domain *dom); - /** Unconfigure protection for current HART (Mandatory) */ - void (*unconfigure)(struct sbi_scratch *scratch); + /** Unconfigure protection for current HART (Optional) */ + void (*unconfigure)(struct sbi_scratch *scratch, struct sbi_domain *dom); /** Create temporary mapping to access address range on current HART (Optional) */ int (*map_range)(struct sbi_scratch *scratch, @@ -39,11 +50,14 @@ struct sbi_hart_protection { }; /** - * Get the best hart protection mechanism + * Get a string containing names of protection mechanisms * - * @return pointer to best hart protection mechanism + * @param out_str pointer to output string + * @param out_str_size maximum size of output string + * + * @return pointer to best hart memory protection mechanism */ -struct sbi_hart_protection *sbi_hart_protection_best(void); +void sbi_hart_protection_get_str(char *out_str, int out_str_size); /** * Register a hart protection mechanism @@ -65,17 +79,36 @@ void sbi_hart_protection_unregister(struct sbi_hart_protection *hprot); * Configure protection for current HART * * @param scratch pointer to scratch space of current HART + * @param dom pointer to the domain for which HART protection + * is being configured * * @return 0 on success and negative error code on failure */ -int sbi_hart_protection_configure(struct sbi_scratch *scratch); +int sbi_hart_protection_configure(struct sbi_scratch *scratch, + struct sbi_domain *dom); /** * Unconfigure protection for current HART * * @param scratch pointer to scratch space of current HART + * @param dom pointer to the domain for which HART protection + * is being unconfigured + */ +void sbi_hart_protection_unconfigure(struct sbi_scratch *scratch, + struct sbi_domain *dom); + +/** + * Re-configure protection for current HART + * + * @param scratch pointer to scratch space of current HART + * @param current_dom pointer to the current domain for which + * HART protection is being unconfigured + * @param next_dom pointer to the next domain for which HART + * protection is being configured */ -void sbi_hart_protection_unconfigure(struct sbi_scratch *scratch); +int sbi_hart_protection_reconfigure(struct sbi_scratch *scratch, + struct sbi_domain *current_dom, + struct sbi_domain *next_dom); /** * Create temporary mapping to access address range on current HART diff --git a/include/sbi/sbi_hartmask.h b/include/sbi/sbi_hartmask.h index 200ab6e5..da6821ee 100644 --- a/include/sbi/sbi_hartmask.h +++ b/include/sbi/sbi_hartmask.h @@ -20,7 +20,11 @@ * also represents the maximum number of HART ids generic OpenSBI * can handle. */ +#ifdef CONFIG_HARTMASK_MAX_BITS +#define SBI_HARTMASK_MAX_BITS CONFIG_HARTMASK_MAX_BITS +#else #define SBI_HARTMASK_MAX_BITS 128 +#endif /** Representation of hartmask */ struct sbi_hartmask { diff --git a/include/sbi/sbi_mpxy.h b/include/sbi/sbi_mpxy.h index 9da2791e..3eec5266 100644 --- a/include/sbi/sbi_mpxy.h +++ b/include/sbi/sbi_mpxy.h @@ -13,6 +13,7 @@ #include <sbi/sbi_list.h> struct sbi_scratch; +struct sbi_domain; #define SBI_MPXY_MSGPROTO_VERSION(Major, Minor) ((Major << 16) | Minor) @@ -97,6 +98,8 @@ struct sbi_mpxy_channel { /** List head to a set of channels */ struct sbi_dlist head; u32 channel_id; + + struct sbi_domain *owner_domain; struct sbi_mpxy_channel_attrs attrs; /** @@ -181,5 +184,4 @@ int sbi_mpxy_send_message(u32 channel_id, u8 msg_id, /** Get Message proxy notification events */ int sbi_mpxy_get_notification_events(u32 channel_id, unsigned long *events_len); - #endif diff --git a/include/sbi/sbi_timer.h b/include/sbi/sbi_timer.h index 2a040927..17d6c1dc 100644 --- a/include/sbi/sbi_timer.h +++ b/include/sbi/sbi_timer.h @@ -140,6 +140,9 @@ bool sbi_timer_waitms_until(bool (*predicate)(void *), void *arg, /** Get timer value for current HART */ u64 sbi_timer_value(void); +/** Get timer frequency for current HART */ +unsigned long sbi_timer_frequency(void); + /** Compute timer value after specified milliseconds */ static inline u64 sbi_timer_value_after_msecs(ulong msecs) { diff --git a/include/sbi/sbi_tlb.h b/include/sbi/sbi_tlb.h index 3936e857..6db8744d 100644 --- a/include/sbi/sbi_tlb.h +++ b/include/sbi/sbi_tlb.h @@ -54,6 +54,37 @@ do { \ #define SBI_TLB_INFO_SIZE sizeof(struct sbi_tlb_info) +/** Collection of Local TLB operations */ +struct sbi_tlb_local_operations { + /** Local fence.i */ + void (*local_fence_i)(struct sbi_tlb_info *tinfo); + + /** Local supervisor-mode TLB flush */ + void (*local_sfence_vma)(struct sbi_tlb_info *tinfo); + + /** Local supervisor-mode TLB flush with ASID */ + void (*local_sfence_vma_asid)(struct sbi_tlb_info *tinfo); + + /** Local G-stage TLB flush for a specific VMID */ + void (*local_hfence_gvma_vmid)(struct sbi_tlb_info *tinfo); + + /** Local G-stage TLB flush */ + void (*local_hfence_gvma)(struct sbi_tlb_info *tinfo); + + /** Local VS-stage TLB flush with ASID */ + void (*local_hfence_vvma_asid)(struct sbi_tlb_info *tinfo); + + /** Local VS-stage TLB flush */ + void (*local_hfence_vvma)(struct sbi_tlb_info *tinfo); +}; + +/** Get the local TLB operations */ +const struct sbi_tlb_local_operations *sbi_tlb_get_local_operations(void); + +/** Set the local TLB operations */ +void sbi_tlb_set_local_operations( + const struct sbi_tlb_local_operations *ops); + void __sbi_sfence_vma_all(); int sbi_tlb_request(ulong hmask, ulong hbase, struct sbi_tlb_info *tinfo); |
