Files
linux-rockchip/include/linux/arm_sdei.h
Tao Huang b3471d8054 Merge tag 'v6.1.57'
This is the 6.1.57 stable release

* tag 'v6.1.57': (2054 commits)
  Linux 6.1.57
  xen/events: replace evtchn_rwlock with RCU
  ipv6: remove one read_lock()/read_unlock() pair in rt6_check_neigh()
  btrfs: file_remove_privs needs an exclusive lock in direct io write
  netlink: remove the flex array from struct nlmsghdr
  btrfs: fix fscrypt name leak after failure to join log transaction
  btrfs: fix an error handling path in btrfs_rename()
  vrf: Fix lockdep splat in output path
  ipv6: remove nexthop_fib6_nh_bh()
  parisc: Restore __ldcw_align for PA-RISC 2.0 processors
  ksmbd: fix uaf in smb20_oplock_break_ack
  ksmbd: fix race condition between session lookup and expire
  x86/sev: Use the GHCB protocol when available for SNP CPUID requests
  RDMA/mlx5: Fix NULL string error
  RDMA/mlx5: Fix mutex unlocking on error flow for steering anchor creation
  RDMA/siw: Fix connection failure handling
  RDMA/srp: Do not call scsi_done() from srp_abort()
  RDMA/uverbs: Fix typo of sizeof argument
  RDMA/cma: Fix truncation compilation warning in make_cma_ports
  RDMA/cma: Initialize ib_sa_multicast structure to 0 when join
  ...

Change-Id: I79b925ca5822e02e0b9f497b1db93fef0e1dadd3

Conflicts:
	drivers/gpu/drm/rockchip/rockchip_drm_vop.c
	drivers/iommu/rockchip-iommu.c
	drivers/power/supply/rk817_charger.c
	drivers/scsi/sd.c
	include/linux/pci.h
2024-01-02 14:38:47 +08:00

134 lines
3.8 KiB
C

// SPDX-License-Identifier: GPL-2.0
// Copyright (C) 2017 Arm Ltd.
#ifndef __LINUX_ARM_SDEI_H
#define __LINUX_ARM_SDEI_H
#include <uapi/linux/arm_sdei.h>
#include <acpi/ghes.h>
#ifdef CONFIG_ARM_SDE_INTERFACE
#include <asm/sdei.h>
#endif
/* Arch code should override this to set the entry point from firmware... */
#ifndef sdei_arch_get_entry_point
#define sdei_arch_get_entry_point(conduit) (0)
#endif
/*
* When an event occurs sdei_event_handler() will call a user-provided callback
* like this in NMI context on the CPU that received the event.
*/
typedef int (sdei_event_callback)(u32 event, struct pt_regs *regs, void *arg);
/*
* Register your callback to claim an event. The event must be described
* by firmware.
*/
int sdei_event_register(u32 event_num, sdei_event_callback *cb, void *arg);
/*
* Calls to sdei_event_unregister() may return EINPROGRESS. Keep calling
* it until it succeeds.
*/
int sdei_event_unregister(u32 event_num);
int sdei_event_enable(u32 event_num);
int sdei_event_disable(u32 event_num);
#ifdef CONFIG_FIQ_DEBUGGER_TRUST_ZONE
#ifdef CONFIG_ARM_SDE_INTERFACE
int sdei_event_enable_nolock(u32 event_num);
int sdei_event_disable_nolock(u32 event_num);
int sdei_event_routing_set_nolock(u32 event_num, unsigned long flags,
unsigned long affinity);
int sdei_event_routing_set(u32 event_num, unsigned long flags,
unsigned long affinity);
int sdei_interrupt_bind(u32 intr_num, u32 *event_num);
int sdei_interrupt_release(u32 event_num);
#else
static inline int sdei_event_enable_nolock(u32 event_num)
{
return SDEI_NOT_SUPPORTED;
}
static inline int sdei_event_disable_nolock(u32 event_num)
{
return SDEI_NOT_SUPPORTED;
}
static inline int sdei_event_routing_set_nolock(u32 event_num,
unsigned long flags,
unsigned long affinity)
{
return SDEI_NOT_SUPPORTED;
}
static inline int sdei_event_routing_set(u32 event_num,
unsigned long flags,
unsigned long affinity)
{
return SDEI_NOT_SUPPORTED;
}
static inline int sdei_interrupt_bind(u32 intr_num, u32 *event_num)
{
return SDEI_NOT_SUPPORTED;
}
static inline int sdei_interrupt_release(u32 event_num)
{
return SDEI_NOT_SUPPORTED;
}
#endif /* CONFIG_ARM_SDE_INTERFACE */
#endif /* CONFIG_FIQ_DEBUGGER_TRUST_ZONE */
/* GHES register/unregister helpers */
int sdei_register_ghes(struct ghes *ghes, sdei_event_callback *normal_cb,
sdei_event_callback *critical_cb);
int sdei_unregister_ghes(struct ghes *ghes);
#ifdef CONFIG_ARM_SDE_INTERFACE
/* For use by arch code when CPU hotplug notifiers are not appropriate. */
int sdei_mask_local_cpu(void);
int sdei_unmask_local_cpu(void);
void __init sdei_init(void);
void sdei_handler_abort(void);
#else
static inline int sdei_mask_local_cpu(void) { return 0; }
static inline int sdei_unmask_local_cpu(void) { return 0; }
static inline void sdei_init(void) { }
static inline void sdei_handler_abort(void) { }
#endif /* CONFIG_ARM_SDE_INTERFACE */
/*
* This struct represents an event that has been registered. The driver
* maintains a list of all events, and which ones are registered. (Private
* events have one entry in the list, but are registered on each CPU).
* A pointer to this struct is passed to firmware, and back to the event
* handler. The event handler can then use this to invoke the registered
* callback, without having to walk the list.
*
* For CPU private events, this structure is per-cpu.
*/
struct sdei_registered_event {
/* For use by arch code: */
struct pt_regs interrupted_regs;
sdei_event_callback *callback;
void *callback_arg;
u32 event_num;
u8 priority;
};
/* The arch code entry point should then call this when an event arrives. */
int notrace sdei_event_handler(struct pt_regs *regs,
struct sdei_registered_event *arg);
/* arch code may use this to retrieve the extra registers. */
int sdei_api_event_context(u32 query, u64 *result);
#endif /* __LINUX_ARM_SDEI_H */