hv: pirq: remove unnecessary dev_handler_node struct

Since we don't support shared irq, dev_handler_node which works as action node,
is not needed anymore.

This commit removes the dev_handler_node struct and does some relevant changes,
including:
 - moves necessary fields to struct irq_desc: action, priv_data, name; and
   removes unused handler_data;
 - changes return type of pri_/normal_register_handler() from dev_handler_node*
   to int32_t, which is irq num (>= 0) on success, and errno (> 0) on failure.
 - changes unregister_irq_handler() to take argument unint32_t instead of
   dev_handler_node*;
 - changes are made to the places where these APIs are called.

Signed-off-by: Yan, Like <like.yan@intel.com>
Reviewed-by: Eddie Dong  <eddie.dong@intel.com>
This commit is contained in:
Yan, Like
2018-08-07 14:33:02 +08:00
committed by lijinxia
parent d773df9135
commit f6e45c9b13
8 changed files with 135 additions and 170 deletions

View File

@@ -23,14 +23,14 @@ enum irq_desc_state {
IRQ_DESC_IN_PROCESS,
};
typedef int (*dev_handler_t)(int irq, void *dev_data);
typedef int (*irq_action_t)(uint32_t irq, void *dev_data);
struct irq_request_info {
/* vector set to 0xE0 ~ 0xFF for pri_register_handler
* and set to VECTOR_INVALID for normal_register_handler
*/
uint32_t vector;
dev_handler_t func;
void *dev_data;
irq_action_t func;
void *priv_data;
char *name;
};
@@ -40,46 +40,38 @@ struct irq_desc {
enum irq_state used; /* this irq have assigned to device */
enum irq_desc_state state; /* irq_desc status */
uint32_t vector; /* assigned vector */
void *handler_data; /* irq_handler private data */
int (*irq_handler)(struct irq_desc *irq_desc, void *handler_data);
struct dev_handler_node *action;
/* callback for irq flow handling */
irq_action_t action; /* callback registered from component */
void *priv_data; /* irq_action private data */
char name[32]; /* name of component */
spinlock_t irq_lock;
uint64_t *irq_cnt; /* this irq cnt happened on CPUs */
uint64_t irq_lost_cnt;
};
struct dev_handler_node {
char name[32];
void *dev_data;
dev_handler_t dev_handler;
struct dev_handler_node *next;
struct irq_desc *desc;
};
uint32_t irq_mark_used(uint32_t irq);
uint32_t irq_desc_alloc_vector(uint32_t irq);
void irq_desc_try_free_vector(uint32_t irq);
uint32_t irq_to_vector(uint32_t irq);
uint32_t dev_to_irq(struct dev_handler_node *node);
uint32_t dev_to_vector(struct dev_handler_node *node);
struct dev_handler_node*
pri_register_handler(uint32_t irq,
int32_t pri_register_handler(uint32_t irq,
uint32_t vector,
dev_handler_t func,
void *dev_data,
irq_action_t func,
void *priv_data,
const char *name);
struct dev_handler_node*
normal_register_handler(uint32_t irq,
dev_handler_t func,
void *dev_data,
int32_t normal_register_handler(uint32_t irq,
irq_action_t func,
void *priv_data,
const char *name);
void unregister_handler_common(struct dev_handler_node *node);
void unregister_handler_common(uint32_t irq);
typedef int (*irq_handler_t)(struct irq_desc *desc, void *handler_data);
void update_irq_handler(uint32_t irq, irq_handler_t func);
#endif /* COMMON_IRQ_H */

View File

@@ -51,7 +51,7 @@ struct ptdev_remapping_info {
uint16_t phys_bdf; /* PCI bus:slot.func*/
uint32_t active; /* 1=active, 0=inactive and to free*/
enum ptdev_intr_type type;
struct dev_handler_node *node;
uint32_t allocated_pirq;
struct list_head softirq_node;
struct list_head entry_node;