mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-27 15:56:54 +00:00
hv: assign: change ptirq vpin source type from enum to macro
This patch fixes the MISRA-C violations on implicit type conversion. For ptirq vpin source type, there is no need to define a enum. Remove enum ptirq_vpin_source. Define two macro: - PTDEV_VPIN_IOAPIC - PTDEV_VPIN_PIC Tracked-On: #861 Signed-off-by: Binbin Wu <binbin.wu@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
parent
b3ce5928d6
commit
bb98040b51
@ -283,7 +283,7 @@ static struct ptirq_remapping_info *add_intx_remapping(struct acrn_vm *vm, uint8
|
||||
uint8_t phys_pin, bool pic_pin)
|
||||
{
|
||||
struct ptirq_remapping_info *entry = NULL;
|
||||
enum ptirq_vpin_source vpin_src = pic_pin ? PTDEV_VPIN_PIC : PTDEV_VPIN_IOAPIC;
|
||||
uint8_t vpin_src = pic_pin ? PTDEV_VPIN_PIC : PTDEV_VPIN_IOAPIC;
|
||||
DEFINE_IOAPIC_SID(phys_sid, phys_pin, 0);
|
||||
DEFINE_IOAPIC_SID(virt_sid, virt_pin, vpin_src);
|
||||
uint32_t phys_irq = pin_to_irq(phys_pin);
|
||||
@ -482,7 +482,7 @@ void ptirq_softirq(uint16_t pcpu_id)
|
||||
}
|
||||
|
||||
void ptirq_intx_ack(struct acrn_vm *vm, uint8_t virt_pin,
|
||||
enum ptirq_vpin_source vpin_src)
|
||||
uint8_t vpin_src)
|
||||
{
|
||||
uint32_t phys_irq;
|
||||
struct ptirq_remapping_info *entry;
|
||||
@ -610,8 +610,7 @@ static void activate_physical_ioapic(struct acrn_vm *vm,
|
||||
/* Main entry for PCI/Legacy device assignment with INTx, calling from vIOAPIC
|
||||
* or vPIC
|
||||
*/
|
||||
int32_t ptirq_intx_pin_remap(struct acrn_vm *vm, uint8_t virt_pin,
|
||||
enum ptirq_vpin_source vpin_src)
|
||||
int32_t ptirq_intx_pin_remap(struct acrn_vm *vm, uint8_t virt_pin, uint8_t vpin_src)
|
||||
{
|
||||
int32_t status = 0;
|
||||
struct ptirq_remapping_info *entry = NULL;
|
||||
@ -697,8 +696,8 @@ int32_t ptirq_intx_pin_remap(struct acrn_vm *vm, uint8_t virt_pin,
|
||||
"IOAPIC pin=%hhu pirq=%u vpin=%d switch from %s to %s vpin=%d for vm%d",
|
||||
entry->phys_sid.intx_id.pin,
|
||||
entry->allocated_pirq, entry->virt_sid.intx_id.pin,
|
||||
(vpin_src == 0) ? "vPIC" : "vIOAPIC",
|
||||
(vpin_src == 0) ? "vIOPIC" : "vPIC",
|
||||
(vpin_src == 0U) ? "vPIC" : "vIOAPIC",
|
||||
(vpin_src == 0U) ? "vIOPIC" : "vPIC",
|
||||
virt_pin, entry->vm->vm_id);
|
||||
entry->virt_sid.value = virt_sid.value;
|
||||
}
|
||||
|
@ -36,7 +36,7 @@
|
||||
* @pre vm != NULL
|
||||
*
|
||||
*/
|
||||
void ptirq_intx_ack(struct acrn_vm *vm, uint8_t virt_pin, enum ptirq_vpin_source vpin_src);
|
||||
void ptirq_intx_ack(struct acrn_vm *vm, uint8_t virt_pin, uint8_t vpin_src);
|
||||
|
||||
/**
|
||||
* @brief MSI/MSI-x remapping for passthrough device.
|
||||
@ -81,7 +81,7 @@ int32_t ptirq_msix_remap(struct acrn_vm *vm, uint16_t virt_bdf, uint16_t entry_n
|
||||
* @pre vm != NULL
|
||||
*
|
||||
*/
|
||||
int32_t ptirq_intx_pin_remap(struct acrn_vm *vm, uint8_t virt_pin, enum ptirq_vpin_source vpin_src);
|
||||
int32_t ptirq_intx_pin_remap(struct acrn_vm *vm, uint8_t virt_pin, uint8_t vpin_src);
|
||||
|
||||
/**
|
||||
* @brief Add an interrupt remapping entry for INTx as pre-hold mapping.
|
||||
|
@ -14,10 +14,8 @@
|
||||
|
||||
#define INVALID_PTDEV_ENTRY_ID 0xffffU
|
||||
|
||||
enum ptirq_vpin_source {
|
||||
PTDEV_VPIN_IOAPIC,
|
||||
PTDEV_VPIN_PIC,
|
||||
};
|
||||
#define PTDEV_VPIN_IOAPIC 0x0U
|
||||
#define PTDEV_VPIN_PIC 0x1U
|
||||
|
||||
#define DEFINE_MSI_SID(name, a, b) \
|
||||
union source_id (name) = {.msi_id = {.bdf = (a), .entry_nr = (b)} }
|
||||
|
Loading…
Reference in New Issue
Block a user