HV: hypercall: revisit types in structure parameters

While fixing the MISRA C violations related to integral types, we have unified
the type of the following data:

    uint8_t:
        phys_pin, virt_pin, vpic_pin, ioapic_pin, vioapic_pin

    uint16_t:
        vm_id, pcpu_id, vcpu_id, vpid

    uint32_t:
        vector, irq

This patch revisits the types of the fields in vhm_request as well as the
structures used as parameters in the hypercalls, and make them aligned with the
types the hypervisor uses for such data. Reserved fields are added to keep the
size and layout of the structures. Implicit paddings are also made explicit as
reserved fields.

Signed-off-by: Junjie Mao <junjie.mao@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Junjie Mao
2018-07-18 16:47:25 +08:00
committed by lijinxia
parent f691cab994
commit 3571afc683
3 changed files with 92 additions and 39 deletions

View File

@@ -59,17 +59,17 @@
struct mmio_request {
uint32_t direction;
uint32_t reserved;
int64_t address;
int64_t size;
int64_t value;
uint64_t address;
uint64_t size;
uint64_t value;
} __aligned(8);
struct pio_request {
uint32_t direction;
uint32_t reserved;
int64_t address;
int64_t size;
int32_t value;
uint64_t address;
uint64_t size;
uint32_t value;
} __aligned(8);
struct pci_request {
@@ -123,10 +123,16 @@ union vhm_request_buffer {
*/
struct acrn_create_vm {
/** created vmid return to VHM. Keep it first field */
int16_t vmid;
uint16_t vmid;
/** Reserved */
uint16_t reserved0;
/** VCPU numbers this VM want to create */
uint32_t vcpu_num;
uint16_t vcpu_num;
/** Reserved */
uint16_t reserved1;
/** the GUID of this VM */
uint8_t GUID[16];
@@ -137,7 +143,7 @@ struct acrn_create_vm {
uint64_t vm_flag;
/** Reserved for future use*/
uint8_t reserved[24];
uint8_t reserved2[24];
} __aligned(8);
/**
@@ -183,12 +189,18 @@ struct acrn_irqline {
uint32_t reserved;
/** pic IRQ for ISA type */
uint64_t pic_irq;
uint32_t pic_irq;
/** Reserved */
uint32_t reserved0;
/** ioapic IRQ for IOAPIC & ISA TYPE,
* if ~0UL then this IRQ will not be injected
* if ~0U then this IRQ will not be injected
*/
uint64_t ioapic_irq;
uint32_t ioapic_irq;
/** Reserved */
uint32_t reserved1;
} __aligned(8);
/**
@@ -209,7 +221,13 @@ struct acrn_msi_entry {
*/
struct acrn_nmi_entry {
/** virtual CPU ID to inject */
int64_t vcpu_id;
uint16_t vcpu_id;
/** Reserved */
uint16_t reserved0;
/** Reserved */
uint32_t reserved1;
} __aligned(8);
/**