/* SPDX-License-Identifier: GPL-2.0 */1/*2* Copyright (C) 2001, 2002 Jeff Dike ([email protected])3*/45#ifndef __IRQ_KERN_H__6#define __IRQ_KERN_H__78#include <linux/interrupt.h>9#include <linux/time-internal.h>10#include <asm/ptrace.h>11#include "irq_user.h"1213#define UM_IRQ_ALLOC -11415int um_request_irq(int irq, int fd, enum um_irq_type type,16irq_handler_t handler, unsigned long irqflags,17const char *devname, void *dev_id);1819#ifdef CONFIG_UML_TIME_TRAVEL_SUPPORT20/**21* um_request_irq_tt - request an IRQ with timetravel handler22*23* @irq: the IRQ number, or %UM_IRQ_ALLOC24* @fd: The file descriptor to request an IRQ for25* @type: read or write26* @handler: the (generic style) IRQ handler27* @irqflags: Linux IRQ flags28* @devname: name for this to show29* @dev_id: data pointer to pass to the IRQ handler30* @timetravel_handler: the timetravel interrupt handler, invoked with the IRQ31* number, fd, dev_id and time-travel event pointer.32*33* Returns: The interrupt number assigned or a negative error.34*35* Note that the timetravel handler is invoked only if the time_travel_mode is36* %TT_MODE_EXTERNAL, and then it is invoked even while the system is suspended!37* This function must call time_travel_add_irq_event() for the event passed with38* an appropriate delay, before sending an ACK on the socket it was invoked for.39*40* If this was called while the system is suspended, then adding the event will41* cause the system to resume.42*43* Since this function will almost certainly have to handle the FD's condition,44* a read will consume the message, and after that it is up to the code using45* it to pass such a message to the @handler in whichever way it can.46*47* If time_travel_mode is not %TT_MODE_EXTERNAL the @timetravel_handler will48* not be invoked at all and the @handler must handle the FD becoming49* readable (or writable) instead. Use um_irq_timetravel_handler_used() to50* distinguish these cases.51*52* See virtio_uml.c for an example.53*/54int um_request_irq_tt(int irq, int fd, enum um_irq_type type,55irq_handler_t handler, unsigned long irqflags,56const char *devname, void *dev_id,57void (*timetravel_handler)(int, int, void *,58struct time_travel_event *));59#else60static inline61int um_request_irq_tt(int irq, int fd, enum um_irq_type type,62irq_handler_t handler, unsigned long irqflags,63const char *devname, void *dev_id,64void (*timetravel_handler)(int, int, void *,65struct time_travel_event *))66{67return um_request_irq(irq, fd, type, handler, irqflags,68devname, dev_id);69}70#endif7172static inline bool um_irq_timetravel_handler_used(void)73{74return time_travel_mode == TT_MODE_EXTERNAL;75}7677void um_free_irq(int irq, void *dev_id);78void free_irqs(void);79#endif808182