mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-28 16:27:01 +00:00
hv: pirq: clean up unnecessary fields of irq_desc
This commit cleans up fiels of struct irq_desc: - remove name, irq_desc_state, irq_cnt and irq_lost_cnt which are not used. - remove irq_ prefix of irq_lock field of struct irq_desc; - change enum irq_state to enum irq_use_state; Signed-off-by: Yan, Like <like.yan@intel.com> Reviewed-by: Li, Fei <fei1.li@intel.com> Acked-by: Anthony Xu <anthony.xu@intel.com>
This commit is contained in:
parent
bdcc3aef22
commit
f77d885d7e
@ -27,7 +27,7 @@ static void init_irq_desc(void)
|
|||||||
for (i = 0U; i < NR_IRQS; i++) {
|
for (i = 0U; i < NR_IRQS; i++) {
|
||||||
irq_desc_array[i].irq = i;
|
irq_desc_array[i].irq = i;
|
||||||
irq_desc_array[i].vector = VECTOR_INVALID;
|
irq_desc_array[i].vector = VECTOR_INVALID;
|
||||||
spinlock_init(&irq_desc_array[i].irq_lock);
|
spinlock_init(&irq_desc_array[i].lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0U; i <= NR_MAX_VECTOR; i++) {
|
for (i = 0U; i <= NR_MAX_VECTOR; i++) {
|
||||||
@ -75,11 +75,11 @@ uint32_t irq_mark_used(uint32_t irq)
|
|||||||
}
|
}
|
||||||
|
|
||||||
desc = &irq_desc_array[irq];
|
desc = &irq_desc_array[irq];
|
||||||
spinlock_irqsave_obtain(&desc->irq_lock, &rflags);
|
spinlock_irqsave_obtain(&desc->lock, &rflags);
|
||||||
if (desc->used == IRQ_NOT_ASSIGNED) {
|
if (desc->used == IRQ_NOT_ASSIGNED) {
|
||||||
desc->used = IRQ_ASSIGNED;
|
desc->used = IRQ_ASSIGNED;
|
||||||
}
|
}
|
||||||
spinlock_irqrestore_release(&desc->irq_lock, rflags);
|
spinlock_irqrestore_release(&desc->lock, rflags);
|
||||||
return irq;
|
return irq;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -96,18 +96,18 @@ static uint32_t alloc_irq(void)
|
|||||||
|
|
||||||
for (i = irq_gsi_num(); i < NR_IRQS; i++) {
|
for (i = irq_gsi_num(); i < NR_IRQS; i++) {
|
||||||
desc = &irq_desc_array[i];
|
desc = &irq_desc_array[i];
|
||||||
spinlock_irqsave_obtain(&desc->irq_lock, &rflags);
|
spinlock_irqsave_obtain(&desc->lock, &rflags);
|
||||||
if (desc->used == IRQ_NOT_ASSIGNED) {
|
if (desc->used == IRQ_NOT_ASSIGNED) {
|
||||||
desc->used = IRQ_ASSIGNED;
|
desc->used = IRQ_ASSIGNED;
|
||||||
spinlock_irqrestore_release(&desc->irq_lock, rflags);
|
spinlock_irqrestore_release(&desc->lock, rflags);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
spinlock_irqrestore_release(&desc->irq_lock, rflags);
|
spinlock_irqrestore_release(&desc->lock, rflags);
|
||||||
}
|
}
|
||||||
return (i == NR_IRQS) ? IRQ_INVALID : i;
|
return (i == NR_IRQS) ? IRQ_INVALID : i;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* need irq_lock protection before use */
|
/* need lock protection before use */
|
||||||
static void local_irq_desc_set_vector(uint32_t irq, uint32_t vr)
|
static void local_irq_desc_set_vector(uint32_t irq, uint32_t vr)
|
||||||
{
|
{
|
||||||
struct irq_desc *desc;
|
struct irq_desc *desc;
|
||||||
@ -124,13 +124,13 @@ static void irq_desc_set_vector(uint32_t irq, uint32_t vr)
|
|||||||
struct irq_desc *desc;
|
struct irq_desc *desc;
|
||||||
|
|
||||||
desc = &irq_desc_array[irq];
|
desc = &irq_desc_array[irq];
|
||||||
spinlock_irqsave_obtain(&desc->irq_lock, &rflags);
|
spinlock_irqsave_obtain(&desc->lock, &rflags);
|
||||||
vector_to_irq[vr] = irq;
|
vector_to_irq[vr] = irq;
|
||||||
desc->vector = vr;
|
desc->vector = vr;
|
||||||
spinlock_irqrestore_release(&desc->irq_lock, rflags);
|
spinlock_irqrestore_release(&desc->lock, rflags);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* used with holding irq_lock outside */
|
/* used with holding lock outside */
|
||||||
static void _irq_desc_free_vector(uint32_t irq)
|
static void _irq_desc_free_vector(uint32_t irq)
|
||||||
{
|
{
|
||||||
struct irq_desc *desc;
|
struct irq_desc *desc;
|
||||||
@ -145,7 +145,6 @@ static void _irq_desc_free_vector(uint32_t irq)
|
|||||||
|
|
||||||
vr = desc->vector;
|
vr = desc->vector;
|
||||||
desc->used = IRQ_NOT_ASSIGNED;
|
desc->used = IRQ_NOT_ASSIGNED;
|
||||||
desc->state = IRQ_DESC_PENDING;
|
|
||||||
desc->vector = VECTOR_INVALID;
|
desc->vector = VECTOR_INVALID;
|
||||||
|
|
||||||
vr &= NR_MAX_VECTOR;
|
vr &= NR_MAX_VECTOR;
|
||||||
@ -166,8 +165,7 @@ static void disable_pic_irq(void)
|
|||||||
|
|
||||||
int32_t request_irq(uint32_t irq_arg,
|
int32_t request_irq(uint32_t irq_arg,
|
||||||
irq_action_t action_fn,
|
irq_action_t action_fn,
|
||||||
void *priv_data,
|
void *priv_data)
|
||||||
const char *name)
|
|
||||||
{
|
{
|
||||||
struct irq_desc *desc;
|
struct irq_desc *desc;
|
||||||
uint32_t irq = irq_arg, vector;
|
uint32_t irq = irq_arg, vector;
|
||||||
@ -235,25 +233,20 @@ int32_t request_irq(uint32_t irq_arg,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (desc->action == NULL) {
|
if (desc->action == NULL) {
|
||||||
spinlock_irqsave_obtain(&desc->irq_lock, &rflags);
|
spinlock_irqsave_obtain(&desc->lock, &rflags);
|
||||||
desc->priv_data = priv_data;
|
desc->priv_data = priv_data;
|
||||||
desc->action = action_fn;
|
desc->action = action_fn;
|
||||||
|
|
||||||
/* we are okay using strcpy_s here even with spinlock
|
spinlock_irqrestore_release(&desc->lock, rflags);
|
||||||
* since no #PG in HV right now
|
|
||||||
*/
|
|
||||||
(void)strcpy_s(desc->name, 32U, name);
|
|
||||||
|
|
||||||
spinlock_irqrestore_release(&desc->irq_lock, rflags);
|
|
||||||
} else {
|
} else {
|
||||||
pr_err("%s: request irq(%u) vr(%u) for %s failed,\
|
pr_err("%s: request irq(%u) vr(%u) failed,\
|
||||||
already requested", __func__,
|
already requested", __func__,
|
||||||
irq, irq_to_vector(irq), name);
|
irq, irq_to_vector(irq));
|
||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
}
|
}
|
||||||
|
|
||||||
dev_dbg(ACRN_DBG_IRQ, "[%s] %s irq%d vr:0x%x",
|
dev_dbg(ACRN_DBG_IRQ, "[%s] irq%d vr:0x%x",
|
||||||
__func__, desc->name, irq, desc->vector);
|
__func__, irq, desc->vector);
|
||||||
|
|
||||||
return (int32_t)irq;
|
return (int32_t)irq;
|
||||||
}
|
}
|
||||||
@ -272,7 +265,7 @@ uint32_t irq_desc_alloc_vector(uint32_t irq)
|
|||||||
}
|
}
|
||||||
|
|
||||||
desc = &irq_desc_array[irq];
|
desc = &irq_desc_array[irq];
|
||||||
spinlock_irqsave_obtain(&desc->irq_lock, &rflags);
|
spinlock_irqsave_obtain(&desc->lock, &rflags);
|
||||||
if (desc->vector != VECTOR_INVALID) {
|
if (desc->vector != VECTOR_INVALID) {
|
||||||
/* already allocated a vector */
|
/* already allocated a vector */
|
||||||
goto OUT;
|
goto OUT;
|
||||||
@ -286,7 +279,7 @@ uint32_t irq_desc_alloc_vector(uint32_t irq)
|
|||||||
}
|
}
|
||||||
local_irq_desc_set_vector(irq, vr);
|
local_irq_desc_set_vector(irq, vr);
|
||||||
OUT:
|
OUT:
|
||||||
spinlock_irqrestore_release(&desc->irq_lock, rflags);
|
spinlock_irqrestore_release(&desc->lock, rflags);
|
||||||
return vr;
|
return vr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -301,12 +294,12 @@ void irq_desc_try_free_vector(uint32_t irq)
|
|||||||
}
|
}
|
||||||
|
|
||||||
desc = &irq_desc_array[irq];
|
desc = &irq_desc_array[irq];
|
||||||
spinlock_irqsave_obtain(&desc->irq_lock, &rflags);
|
spinlock_irqsave_obtain(&desc->lock, &rflags);
|
||||||
if (desc->action == NULL) {
|
if (desc->action == NULL) {
|
||||||
_irq_desc_free_vector(irq);
|
_irq_desc_free_vector(irq);
|
||||||
}
|
}
|
||||||
|
|
||||||
spinlock_irqrestore_release(&desc->irq_lock, rflags);
|
spinlock_irqrestore_release(&desc->lock, rflags);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -421,18 +414,7 @@ int handle_level_interrupt_common(struct irq_desc *desc,
|
|||||||
uint64_t rflags;
|
uint64_t rflags;
|
||||||
irq_action_t action = desc->action;
|
irq_action_t action = desc->action;
|
||||||
|
|
||||||
/*
|
spinlock_irqsave_obtain(&desc->lock, &rflags);
|
||||||
* give other Core a try to return without hold irq_lock
|
|
||||||
* and record irq_lost count here
|
|
||||||
*/
|
|
||||||
if (desc->state != IRQ_DESC_PENDING) {
|
|
||||||
send_lapic_eoi();
|
|
||||||
desc->irq_lost_cnt++;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
spinlock_irqsave_obtain(&desc->irq_lock, &rflags);
|
|
||||||
desc->state = IRQ_DESC_IN_PROCESS;
|
|
||||||
|
|
||||||
/* mask iopaic pin */
|
/* mask iopaic pin */
|
||||||
if (irq_is_gsi(desc->irq)) {
|
if (irq_is_gsi(desc->irq)) {
|
||||||
@ -450,8 +432,7 @@ int handle_level_interrupt_common(struct irq_desc *desc,
|
|||||||
GSI_UNMASK_IRQ(desc->irq);
|
GSI_UNMASK_IRQ(desc->irq);
|
||||||
}
|
}
|
||||||
|
|
||||||
desc->state = IRQ_DESC_PENDING;
|
spinlock_irqrestore_release(&desc->lock, rflags);
|
||||||
spinlock_irqrestore_release(&desc->irq_lock, rflags);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -461,18 +442,7 @@ int common_handler_edge(struct irq_desc *desc, __unused void *handler_data)
|
|||||||
uint64_t rflags;
|
uint64_t rflags;
|
||||||
irq_action_t action = desc->action;
|
irq_action_t action = desc->action;
|
||||||
|
|
||||||
/*
|
spinlock_irqsave_obtain(&desc->lock, &rflags);
|
||||||
* give other Core a try to return without hold irq_lock
|
|
||||||
* and record irq_lost count here
|
|
||||||
*/
|
|
||||||
if (desc->state != IRQ_DESC_PENDING) {
|
|
||||||
send_lapic_eoi();
|
|
||||||
desc->irq_lost_cnt++;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
spinlock_irqsave_obtain(&desc->irq_lock, &rflags);
|
|
||||||
desc->state = IRQ_DESC_IN_PROCESS;
|
|
||||||
|
|
||||||
/* Send EOI to LAPIC/IOAPIC IRR */
|
/* Send EOI to LAPIC/IOAPIC IRR */
|
||||||
send_lapic_eoi();
|
send_lapic_eoi();
|
||||||
@ -481,8 +451,7 @@ int common_handler_edge(struct irq_desc *desc, __unused void *handler_data)
|
|||||||
action(desc->irq, desc->priv_data);
|
action(desc->irq, desc->priv_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
desc->state = IRQ_DESC_PENDING;
|
spinlock_irqrestore_release(&desc->lock, rflags);
|
||||||
spinlock_irqrestore_release(&desc->irq_lock, rflags);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -492,18 +461,7 @@ int common_dev_handler_level(struct irq_desc *desc, __unused void *handler_data)
|
|||||||
uint64_t rflags;
|
uint64_t rflags;
|
||||||
irq_action_t action = desc->action;
|
irq_action_t action = desc->action;
|
||||||
|
|
||||||
/*
|
spinlock_irqsave_obtain(&desc->lock, &rflags);
|
||||||
* give other Core a try to return without hold irq_lock
|
|
||||||
* and record irq_lost count here
|
|
||||||
*/
|
|
||||||
if (desc->state != IRQ_DESC_PENDING) {
|
|
||||||
send_lapic_eoi();
|
|
||||||
desc->irq_lost_cnt++;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
spinlock_irqsave_obtain(&desc->irq_lock, &rflags);
|
|
||||||
desc->state = IRQ_DESC_IN_PROCESS;
|
|
||||||
|
|
||||||
/* mask iopaic pin */
|
/* mask iopaic pin */
|
||||||
if (irq_is_gsi(desc->irq)) {
|
if (irq_is_gsi(desc->irq)) {
|
||||||
@ -517,14 +475,13 @@ int common_dev_handler_level(struct irq_desc *desc, __unused void *handler_data)
|
|||||||
action(desc->irq, desc->priv_data);
|
action(desc->irq, desc->priv_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
desc->state = IRQ_DESC_PENDING;
|
spinlock_irqrestore_release(&desc->lock, rflags);
|
||||||
spinlock_irqrestore_release(&desc->irq_lock, rflags);
|
|
||||||
|
|
||||||
/* we did not unmask irq until guest EOI the vector */
|
/* we did not unmask irq until guest EOI the vector */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* no desc->irq_lock for quick handling local interrupt like lapic timer */
|
/* no desc->lock for quick handling local interrupt like lapic timer */
|
||||||
int quick_handler_nolock(struct irq_desc *desc, __unused void *handler_data)
|
int quick_handler_nolock(struct irq_desc *desc, __unused void *handler_data)
|
||||||
{
|
{
|
||||||
irq_action_t action = desc->action;
|
irq_action_t action = desc->action;
|
||||||
@ -549,9 +506,9 @@ void update_irq_handler(uint32_t irq, irq_handler_t func)
|
|||||||
}
|
}
|
||||||
|
|
||||||
desc = &irq_desc_array[irq];
|
desc = &irq_desc_array[irq];
|
||||||
spinlock_irqsave_obtain(&desc->irq_lock, &rflags);
|
spinlock_irqsave_obtain(&desc->lock, &rflags);
|
||||||
desc->irq_handler = func;
|
desc->irq_handler = func;
|
||||||
spinlock_irqrestore_release(&desc->irq_lock, rflags);
|
spinlock_irqrestore_release(&desc->lock, rflags);
|
||||||
}
|
}
|
||||||
|
|
||||||
void free_irq(uint32_t irq)
|
void free_irq(uint32_t irq)
|
||||||
@ -564,16 +521,15 @@ void free_irq(uint32_t irq)
|
|||||||
}
|
}
|
||||||
|
|
||||||
desc = &irq_desc_array[irq];
|
desc = &irq_desc_array[irq];
|
||||||
dev_dbg(ACRN_DBG_IRQ, "[%s] %s irq%d vr:0x%x",
|
dev_dbg(ACRN_DBG_IRQ, "[%s] irq%d vr:0x%x",
|
||||||
__func__, desc->name, irq, irq_to_vector(irq));
|
__func__, irq, irq_to_vector(irq));
|
||||||
|
|
||||||
spinlock_irqsave_obtain(&desc->irq_lock, &rflags);
|
spinlock_irqsave_obtain(&desc->lock, &rflags);
|
||||||
|
|
||||||
desc->action = NULL;
|
desc->action = NULL;
|
||||||
desc->priv_data = NULL;
|
desc->priv_data = NULL;
|
||||||
memset(desc->name, '\0', 32U);
|
|
||||||
|
|
||||||
spinlock_irqrestore_release(&desc->irq_lock, rflags);
|
spinlock_irqrestore_release(&desc->lock, rflags);
|
||||||
irq_desc_try_free_vector(desc->irq);
|
irq_desc_try_free_vector(desc->irq);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -594,9 +550,6 @@ void get_cpu_interrupt_info(char *str_arg, int str_max)
|
|||||||
size -= len;
|
size -= len;
|
||||||
str += len;
|
str += len;
|
||||||
}
|
}
|
||||||
len = snprintf(str, size, "\tLOST");
|
|
||||||
size -= len;
|
|
||||||
str += len;
|
|
||||||
|
|
||||||
for (irq = 0U; irq < NR_IRQS; irq++) {
|
for (irq = 0U; irq < NR_IRQS; irq++) {
|
||||||
desc = &irq_desc_array[irq];
|
desc = &irq_desc_array[irq];
|
||||||
@ -612,9 +565,6 @@ void get_cpu_interrupt_info(char *str_arg, int str_max)
|
|||||||
size -= len;
|
size -= len;
|
||||||
str += len;
|
str += len;
|
||||||
}
|
}
|
||||||
len = snprintf(str, size, "\t%d", desc->irq_lost_cnt);
|
|
||||||
size -= len;
|
|
||||||
str += len;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
snprintf(str, size, "\r\n");
|
snprintf(str, size, "\r\n");
|
||||||
|
@ -55,8 +55,7 @@ void smp_call_function(uint64_t mask, smp_call_func_t func, void *data)
|
|||||||
wait_sync_change(&smp_call_mask, 0UL);
|
wait_sync_change(&smp_call_mask, 0UL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int request_notification_irq(irq_action_t func, void *data,
|
static int request_notification_irq(irq_action_t func, void *data)
|
||||||
const char *name)
|
|
||||||
{
|
{
|
||||||
int32_t retval;
|
int32_t retval;
|
||||||
|
|
||||||
@ -67,7 +66,7 @@ static int request_notification_irq(irq_action_t func, void *data,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* all cpu register the same notification vector */
|
/* all cpu register the same notification vector */
|
||||||
retval = request_irq(NOTIFY_IRQ, func, data, name);
|
retval = request_irq(NOTIFY_IRQ, func, data);
|
||||||
if (retval < 0) {
|
if (retval < 0) {
|
||||||
pr_err("Failed to add notify isr");
|
pr_err("Failed to add notify isr");
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
@ -80,17 +79,14 @@ static int request_notification_irq(irq_action_t func, void *data,
|
|||||||
|
|
||||||
void setup_notification(void)
|
void setup_notification(void)
|
||||||
{
|
{
|
||||||
uint16_t cpu;
|
uint16_t cpu = get_cpu_id();
|
||||||
char name[32] = {0};
|
|
||||||
|
|
||||||
cpu = get_cpu_id();
|
|
||||||
if (cpu > 0U) {
|
if (cpu > 0U) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* support IPI notification, VM0 will register all CPU */
|
/* support IPI notification, VM0 will register all CPU */
|
||||||
snprintf(name, 32, "NOTIFY_ISR%d", cpu);
|
if (request_notification_irq(kick_notification, NULL) < 0) {
|
||||||
if (request_notification_irq(kick_notification, NULL, name) < 0) {
|
|
||||||
pr_err("Failed to setup notification");
|
pr_err("Failed to setup notification");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -107,11 +107,11 @@ void del_timer(struct hv_timer *timer)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int request_timer_irq(irq_action_t func, const char *name)
|
static int request_timer_irq(irq_action_t func)
|
||||||
{
|
{
|
||||||
int32_t retval;
|
int32_t retval;
|
||||||
|
|
||||||
retval = request_irq(TIMER_IRQ, func, NULL, name);
|
retval = request_irq(TIMER_IRQ, func, NULL);
|
||||||
if (retval >= 0) {
|
if (retval >= 0) {
|
||||||
update_irq_handler(TIMER_IRQ, quick_handler_nolock);
|
update_irq_handler(TIMER_IRQ, quick_handler_nolock);
|
||||||
} else {
|
} else {
|
||||||
@ -185,16 +185,14 @@ static void timer_softirq(uint16_t pcpu_id)
|
|||||||
|
|
||||||
void timer_init(void)
|
void timer_init(void)
|
||||||
{
|
{
|
||||||
char name[32] = {0};
|
|
||||||
uint16_t pcpu_id = get_cpu_id();
|
uint16_t pcpu_id = get_cpu_id();
|
||||||
|
|
||||||
init_percpu_timer(pcpu_id);
|
init_percpu_timer(pcpu_id);
|
||||||
|
|
||||||
snprintf(name, 32, "timer_tick[%hu]", pcpu_id);
|
|
||||||
if (pcpu_id == BOOT_CPU_ID) {
|
if (pcpu_id == BOOT_CPU_ID) {
|
||||||
register_softirq(SOFTIRQ_TIMER, timer_softirq);
|
register_softirq(SOFTIRQ_TIMER, timer_softirq);
|
||||||
|
|
||||||
if (request_timer_irq((irq_action_t)tsc_deadline_handler, name)
|
if (request_timer_irq((irq_action_t)tsc_deadline_handler)
|
||||||
< 0) {
|
< 0) {
|
||||||
pr_err("Timer setup failed");
|
pr_err("Timer setup failed");
|
||||||
return;
|
return;
|
||||||
|
@ -828,8 +828,7 @@ static int dmar_setup_interrupt(struct dmar_drhd_rt *dmar_uint)
|
|||||||
|
|
||||||
retval = request_irq(IRQ_INVALID,
|
retval = request_irq(IRQ_INVALID,
|
||||||
dmar_fault_handler,
|
dmar_fault_handler,
|
||||||
dmar_uint,
|
dmar_uint);
|
||||||
"dmar_fault_event");
|
|
||||||
|
|
||||||
if (retval < 0 ) {
|
if (retval < 0 ) {
|
||||||
pr_err("%s: fail to setup interrupt", __func__);
|
pr_err("%s: fail to setup interrupt", __func__);
|
||||||
|
@ -136,7 +136,7 @@ ptdev_activate_entry(struct ptdev_remapping_info *entry, uint32_t phys_irq)
|
|||||||
|
|
||||||
/* register and allocate host vector/irq */
|
/* register and allocate host vector/irq */
|
||||||
retval = request_irq(phys_irq, ptdev_interrupt_handler,
|
retval = request_irq(phys_irq, ptdev_interrupt_handler,
|
||||||
(void *)entry, "dev assign");
|
(void *)entry);
|
||||||
|
|
||||||
ASSERT(retval >= 0, "dev register failed");
|
ASSERT(retval >= 0, "dev register failed");
|
||||||
entry->allocated_pirq = (uint32_t)retval;
|
entry->allocated_pirq = (uint32_t)retval;
|
||||||
|
@ -13,34 +13,25 @@ enum irq_mode {
|
|||||||
IRQ_DEASSERT,
|
IRQ_DEASSERT,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum irq_state {
|
enum irq_use_state {
|
||||||
IRQ_NOT_ASSIGNED = 0,
|
IRQ_NOT_ASSIGNED = 0,
|
||||||
IRQ_ASSIGNED,
|
IRQ_ASSIGNED,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum irq_desc_state {
|
|
||||||
IRQ_DESC_PENDING,
|
|
||||||
IRQ_DESC_IN_PROCESS,
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef int (*irq_action_t)(uint32_t irq, void *priv_data);
|
typedef int (*irq_action_t)(uint32_t irq, void *priv_data);
|
||||||
|
|
||||||
/* any field change in below required irq_lock protection with irqsave */
|
/* any field change in below required irq_lock protection with irqsave */
|
||||||
struct irq_desc {
|
struct irq_desc {
|
||||||
uint32_t irq; /* index to irq_desc_base */
|
uint32_t irq; /* index to irq_desc_base */
|
||||||
enum irq_state used; /* this irq have assigned to device */
|
enum irq_use_state used; /* this irq have assigned to device */
|
||||||
enum irq_desc_state state; /* irq_desc status */
|
|
||||||
uint32_t vector; /* assigned vector */
|
uint32_t vector; /* assigned vector */
|
||||||
|
|
||||||
int (*irq_handler)(struct irq_desc *irq_desc, void *handler_data);
|
int (*irq_handler)(struct irq_desc *irq_desc, void *handler_data);
|
||||||
/* callback for irq flow handling */
|
/* callback for irq flow handling */
|
||||||
irq_action_t action; /* callback registered from component */
|
irq_action_t action; /* callback registered from component */
|
||||||
void *priv_data; /* irq_action private data */
|
void *priv_data; /* irq_action private data */
|
||||||
char name[32]; /* name of component */
|
|
||||||
|
|
||||||
spinlock_t irq_lock;
|
spinlock_t lock;
|
||||||
uint64_t *irq_cnt; /* this irq cnt happened on CPUs */
|
|
||||||
uint64_t irq_lost_cnt;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
uint32_t irq_mark_used(uint32_t irq);
|
uint32_t irq_mark_used(uint32_t irq);
|
||||||
@ -52,8 +43,7 @@ uint32_t irq_to_vector(uint32_t irq);
|
|||||||
|
|
||||||
int32_t request_irq(uint32_t irq,
|
int32_t request_irq(uint32_t irq,
|
||||||
irq_action_t action_fn,
|
irq_action_t action_fn,
|
||||||
void *priv_data,
|
void *priv_data);
|
||||||
const char *name);
|
|
||||||
|
|
||||||
void free_irq(uint32_t irq);
|
void free_irq(uint32_t irq);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user