lkml.org 
[lkml]   [2023]   [Aug]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH RESEND v9 17/36] x86/fred: Define a common function type fred_handler
    Date
    FRED event delivery establishes a full supervisor context by saving
    the essential information about an event to a FRED stack frame, e.g.,
    the faulting linear address of a #PF is saved as event data of a FRED
    stack frame. Thus a struct pt_regs has all the needed data to handle
    an event and it's the only input argument of a FRED event handler.

    Define fred_handler, a common function type used in the FRED event
    dispatch framework, which makes it easier to find the entry points
    (via grep), allows the prototype to change if necessary without
    requiring changing changes everywhere, and makes sure that all the
    entry points have the proper decorations (currently noinstr, but
    could change in the future.)

    Signed-off-by: Xin Li <xin3.li@intel.com>
    ---
    arch/x86/include/asm/fred.h | 15 +++++++++++++++
    1 file changed, 15 insertions(+)

    diff --git a/arch/x86/include/asm/fred.h b/arch/x86/include/asm/fred.h
    index d76e681a806f..b45c1bea5b7f 100644
    --- a/arch/x86/include/asm/fred.h
    +++ b/arch/x86/include/asm/fred.h
    @@ -68,6 +68,19 @@
    #define FRED_SSX_64_BIT_MODE_BIT 57
    #define FRED_SSX_64_BIT_MODE _BITUL(FRED_SSX_64_BIT_MODE_BIT)

    +/*
    + * FRED event delivery establishes a full supervisor context by
    + * saving the essential information about an event to a FRED
    + * stack frame, e.g., the faulting linear address of a #PF is
    + * saved as event data of a FRED #PF stack frame. Thus a struct
    + * pt_regs has all the needed data to handle an event and it's
    + * the only input argument of a FRED event handler.
    + *
    + * FRED handlers need to be placed in the noinstr text section.
    + */
    +#define DECLARE_FRED_HANDLER(f) void f (struct pt_regs *regs)
    +#define DEFINE_FRED_HANDLER(f) noinstr DECLARE_FRED_HANDLER(f)
    +
    #ifdef CONFIG_X86_FRED

    #ifndef __ASSEMBLY__
    @@ -97,6 +110,8 @@ static __always_inline unsigned long fred_event_data(struct pt_regs *regs)
    return fred_info(regs)->edata;
    }

    +typedef DECLARE_FRED_HANDLER((*fred_handler));
    +
    #endif /* __ASSEMBLY__ */

    #endif /* CONFIG_X86_FRED */
    --
    2.34.1
    \
     
     \ /
      Last update: 2023-08-01 11:06    [W:4.206 / U:0.012 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site