Changeset View
Changeset View
Standalone View
Standalone View
sys/xen/arch-intr.h
- This file was added.
/* | |||||
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD | |||||
* | |||||
* Copyright (c) 2015 Julien Grall | |||||
* | |||||
* Redistribution and use in source and binary forms, with or without | |||||
* modification, are permitted provided that the following conditions | |||||
* are met: | |||||
* 1. Redistributions of source code must retain the above copyright | |||||
* notice, this list of conditions and the following disclaimer. | |||||
* 2. Redistributions in binary form must reproduce the above copyright | |||||
* notice, this list of conditions and the following disclaimer in the | |||||
* documentation and/or other materials provided with the distribution. | |||||
* | |||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |||||
* SUCH DAMAGE. | |||||
* | |||||
* $FreeBSD$ | |||||
*/ | |||||
#ifndef _XEN_ARCH_INTR_H_ | |||||
#define _XEN_ARCH_INTR_H_ | |||||
#include <machine/xen/arch-intr.h> | |||||
#include <xen/evtchn/evtchnvar.h> | |||||
struct xenisrc { | |||||
xen_arch_isrc_t xi_arch; /* @TOP -> *xi_arch=*xenisrc */ | |||||
enum evtchn_type xi_type; | |||||
int xi_cpu; /* VCPU for delivery */ | |||||
evtchn_port_t xi_port; | |||||
int xi_virq; | |||||
void *xi_cookie; | |||||
u_int xi_close:1; /* close on unbind? */ | |||||
u_int xi_activehi:1; | |||||
u_int xi_edgetrigger:1; | |||||
u_int xi_masked:1; | |||||
volatile u_int xi_refcount; | |||||
}; | |||||
/***************** Functions called by the architecture code *****************/ | |||||
void xen_intr_suspend(void); | |||||
void xen_intr_resume(bool suspend_cancelled); | |||||
void xen_intr_enable_source(struct xenisrc *isrc); | |||||
void xen_intr_disable_source(struct xenisrc *isrc, bool need_eoi); | |||||
void xen_intr_eoi_source(struct xenisrc *isrc); | |||||
void xen_intr_enable_intr(struct xenisrc *isrc); | |||||
void xen_intr_disable_intr(struct xenisrc *isrc); | |||||
int xen_intr_assign_cpu(struct xenisrc *isrc, u_int to_cpu); | |||||
/******************* Functions implemented by each architecture **************/ | |||||
void xen_arch_intr_init(void); | |||||
bool xen_arch_intr_has_handlers(struct xenisrc *isrc); | |||||
void xen_arch_intr_execute_handlers(struct xenisrc *isrc, | |||||
struct trapframe *frame); | |||||
int xen_arch_intr_add_handler(const char *name, driver_filter_t filter, | |||||
driver_intr_t handler, void *arg, enum intr_type flags, | |||||
struct xenisrc *isrc); | |||||
int xen_arch_intr_describe(struct xenisrc *isrc, const char *descr); | |||||
int xen_arch_intr_remove_handler(struct xenisrc *isrc); | |||||
ehem_freebsd_m5p.com: I'm wondering about this. Neither architecture needs the `struct xenisrc *isrc` here, as both… | |||||
int xen_arch_intr_event_bind(struct xenisrc *isrc, u_int cpu); | |||||
#endif /* _XEN_ARCH_INTR_H_ */ | |||||
Done Inline ActionsTo remove the first argument or not to remove the first argument? No architecture being worked on needs the first as they all end up being calls to intr_event_remove_handler() which only needs the cookie. With xi_cookie being architecture-independent, I'm inclined to remove the first. ehem_freebsd_m5p.com: To remove the first argument or not to remove the first argument? No architecture being worked… | |||||
Done Inline ActionsI'm rather tempted to have these move to machine/xen/arch-intr.h. For both x86 and ARM64 these functions end up being small enough for inline. In particular xen_arch_intr_execute_handlers() is fairly hot (and is only called by one point in xen_intr.c). ehem_freebsd_m5p.com: I'm rather tempted to have these move to `machine/xen/arch-intr.h`. For both x86 and ARM64… |
I'm wondering about this. Neither architecture needs the struct xenisrc *isrc here, as both are ultimately forwarding the cookie to intr_event_remove_handler() which merely needs the cookie.
Likely @julien_xen.org was also confused about which side should own xi_cookie.