[PATCH v2 05/11] platform: generic: mips: add extra scratch space

Anup Patel anup at brainfault.org
Thu Mar 27 21:56:43 PDT 2025


On Wed, Feb 26, 2025 at 7:38 AM Chao-ying Fu <icebergfu at gmail.com> wrote:
>
> We need extra scratch space used by the custom exception handler.

The custom MIPS specific exception handler itself is unjustified so
this extra custom scratch space makes no sense at the moment.

Imagine, more platforms adding their own custom scratch space.

Regards,
Anup

> ---
>  include/sbi/sbi_scratch.h | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
>
> diff --git a/include/sbi/sbi_scratch.h b/include/sbi/sbi_scratch.h
> index 0d188d1..ff8b75e 100644
> --- a/include/sbi/sbi_scratch.h
> +++ b/include/sbi/sbi_scratch.h
> @@ -44,8 +44,16 @@
>  #define SBI_SCRATCH_OPTIONS_OFFSET             (13 * __SIZEOF_POINTER__)
>  /** Offset of hartindex member in sbi_scratch */
>  #define SBI_SCRATCH_HARTINDEX_OFFSET           (14 * __SIZEOF_POINTER__)
> +#ifdef CONFIG_PLATFORM_MIPS_P8700
> +#define MIPS_P8700_STW_SIZE                    34
> +/** Offset of stw_tmp in sbi_scratch */
> +#define SBI_SCRATCH_STW_TMP_OFFSET             (15 * __SIZEOF_POINTER__)
> +/** Offset of extra space in sbi_scratch */
> +#define SBI_SCRATCH_EXTRA_SPACE_OFFSET         ((15 + MIPS_P8700_STW_SIZE) * __SIZEOF_POINTER__)
> +#else
>  /** Offset of extra space in sbi_scratch */
>  #define SBI_SCRATCH_EXTRA_SPACE_OFFSET         (15 * __SIZEOF_POINTER__)
> +#endif
>  /** Maximum size of sbi_scratch (4KB) */
>  #define SBI_SCRATCH_SIZE                       (0x1000)
>
> @@ -87,6 +95,10 @@ struct sbi_scratch {
>         unsigned long options;
>         /** Index of the hart */
>         unsigned long hartindex;
> +#ifdef CONFIG_PLATFORM_MIPS_P8700
> +       /** for stw */
> +       unsigned long stw_tmp[MIPS_P8700_STW_SIZE];
> +#endif
>  };
>
>  /**
> --
> 2.47.1
>
>
> --
> opensbi mailing list
> opensbi at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/opensbi



More information about the opensbi mailing list