public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Sunil V L" <sunilvl@ventanamicro.com>
To: Daniel Schaefer <daniel.schaefer@hpe.com>
Cc: devel@edk2.groups.io
Subject: Re: [edk2-platforms PATCH v1 1/1] RISC-V/RiscVExceptionLib: Follow new CpuExceptionHandlerLib APIs
Date: Tue, 16 Aug 2022 19:20:42 +0530	[thread overview]
Message-ID: <20220816135042.GA35002@sunil-laptop> (raw)
In-Reply-To: <20220811064057.1833908-1-daniel.schaefer@hpe.com>

On Thu, Aug 11, 2022 at 02:40:57PM +0800, Daniel Schaefer wrote:
> CpuExceptionHandlerLib (in EDK2) has been refactored with following changes
> 1. Removed InitializeCpuInterruptHandlers in 2a09527ebcb459b40
> 2. Removed InitializeCpuExceptionHandlersEx and
>    added InitializeSeparateExceptionStacks in e7abb94d1fb8a0e7
> 
> The patch updates RISC-V version of CpuExceptionHandlerLib to follow
> the API changes, based on the ARM changes in e2ae0bed29ca0900bd35.
> 
> The functionality to RISC-V platforms should be none.
> 
> Signed-off-by: Daniel Schaefer <daniel.schaefer@hpe.com>
> Cc: Sunil V L <sunilvl@ventanamicro.com>
> ---
>  Silicon/RISC-V/ProcessorPkg/Library/RiscVExceptionLib/CpuExceptionHandlerLib.c | 82 ++++++--------------
>  1 file changed, 24 insertions(+), 58 deletions(-)
> 
> diff --git a/Silicon/RISC-V/ProcessorPkg/Library/RiscVExceptionLib/CpuExceptionHandlerLib.c b/Silicon/RISC-V/ProcessorPkg/Library/RiscVExceptionLib/CpuExceptionHandlerLib.c
> index 93fbde619f..c3ced4a4c2 100644
> --- a/Silicon/RISC-V/ProcessorPkg/Library/RiscVExceptionLib/CpuExceptionHandlerLib.c
> +++ b/Silicon/RISC-V/ProcessorPkg/Library/RiscVExceptionLib/CpuExceptionHandlerLib.c
> @@ -44,31 +44,6 @@ InitializeCpuExceptionHandlers (
>    return EFI_SUCCESS;
>  }
>  
> -/**
> -  Initializes all CPU interrupt/exceptions entries and provides the default interrupt/exception handlers.
> -
> -  Caller should try to get an array of interrupt and/or exception vectors that are in use and need to
> -  persist by EFI_VECTOR_HANDOFF_INFO defined in PI 1.3 specification.
> -  If caller cannot get reserved vector list or it does not exists, set VectorInfo to NULL.
> -  If VectorInfo is not NULL, the exception vectors will be initialized per vector attribute accordingly.
> -
> -  @param[in]  VectorInfo    Pointer to reserved vector list.
> -
> -  @retval EFI_SUCCESS           All CPU interrupt/exception entries have been successfully initialized
> -                                with default interrupt/exception handlers.
> -  @retval EFI_INVALID_PARAMETER VectorInfo includes the invalid content if VectorInfo is not NULL.
> -  @retval EFI_UNSUPPORTED       This function is not supported.
> -
> -**/
> -EFI_STATUS
> -EFIAPI
> -InitializeCpuInterruptHandlers (
> -  IN EFI_VECTOR_HANDOFF_INFO  *VectorInfo OPTIONAL
> -  )
> -{
> -  return EFI_SUCCESS;
> -}
> -
>  /**
>    Registers a function to be called from the processor interrupt handler.
>  
> @@ -134,39 +109,6 @@ RiscVSupervisorModeTrapHandler (
>    }
>  }
>  
> -/**
> -  Initializes all CPU exceptions entries with optional extra initializations.
> -
> -  By default, this method should include all functionalities implemented by
> -  InitializeCpuExceptionHandlers(), plus extra initialization works, if any.
> -  This could be done by calling InitializeCpuExceptionHandlers() directly
> -  in this method besides the extra works.
> -
> -  InitData is optional and its use and content are processor arch dependent.
> -  The typical usage of it is to convey resources which have to be reserved
> -  elsewhere and are necessary for the extra initializations of exception.
> -
> -  @param[in]  VectorInfo    Pointer to reserved vector list.
> -  @param[in]  InitData      Pointer to data optional for extra initializations
> -                            of exception.
> -
> -  @retval EFI_SUCCESS             The exceptions have been successfully
> -                                  initialized.
> -  @retval EFI_INVALID_PARAMETER   VectorInfo or InitData contains invalid
> -                                  content.
> -  @retval EFI_UNSUPPORTED         This function is not supported.
> -
> -**/
> -EFI_STATUS
> -EFIAPI
> -InitializeCpuExceptionHandlersEx (
> -  IN EFI_VECTOR_HANDOFF_INFO  *VectorInfo OPTIONAL,
> -  IN CPU_EXCEPTION_INIT_DATA  *InitData OPTIONAL
> -  )
> -{
> -  return InitializeCpuExceptionHandlers (VectorInfo);
> -}
> -
>  /**
>    The constructor function to initial interrupt handlers in
>    RISCV_MACHINE_MODE_CONTEXT.
> @@ -192,3 +134,27 @@ CpuExceptionHandlerLibConstructor (
>  
>    return EFI_SUCCESS;
>  }
> +
> +/**
> +  Setup separate stacks for certain exception handlers.
> +  If the input Buffer and BufferSize are both NULL, use global variable if possible.
> +
> +  @param[in]       Buffer        Point to buffer used to separate exception stack.
> +  @param[in, out]  BufferSize    On input, it indicates the byte size of Buffer.
> +                                 If the size is not enough, the return status will
> +                                 be EFI_BUFFER_TOO_SMALL, and output BufferSize
> +                                 will be the size it needs.
> +
> +  @retval EFI_SUCCESS             The stacks are assigned successfully.
> +  @retval EFI_UNSUPPORTED         This function is not supported.
> +  @retval EFI_BUFFER_TOO_SMALL    This BufferSize is too small.
> +**/
> +EFI_STATUS
> +EFIAPI
> +InitializeSeparateExceptionStacks (
> +  IN     VOID   *Buffer,
> +  IN OUT UINTN  *BufferSize
> +  )
> +{
> +  return EFI_SUCCESS;
> +}

Looks good to me.

Reviewed-by: Sunil V L <sunilvl@ventanamicro.com>

> -- 
> 2.36.0
> 

      reply	other threads:[~2022-08-16 13:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-11  6:40 [edk2-platforms PATCH v1 1/1] RISC-V/RiscVExceptionLib: Follow new CpuExceptionHandlerLib APIs Daniel Schaefer
2022-08-16 13:50 ` Sunil V L [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220816135042.GA35002@sunil-laptop \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox