asm-generic/hyperv: update hv_msi_entry
authorWei Liu <wei.liu@kernel.org>
Wed, 3 Feb 2021 15:04:30 +0000 (15:04 +0000)
committerWei Liu <wei.liu@kernel.org>
Thu, 11 Feb 2021 08:47:06 +0000 (08:47 +0000)
We will soon need to access fields inside the MSI address and MSI data
fields. Introduce hv_msi_address_register and hv_msi_data_register.

Fix up one user of hv_msi_entry in mshyperv.h.

No functional change expected.

Signed-off-by: Wei Liu <wei.liu@kernel.org>
Reviewed-by: Michael Kelley <mikelley@microsoft.com>
Link: https://lore.kernel.org/r/20210203150435.27941-12-wei.liu@kernel.org
arch/x86/include/asm/mshyperv.h
include/asm-generic/hyperv-tlfs.h

index f911978..7bd4022 100644 (file)
@@ -259,8 +259,8 @@ static inline void hv_apic_init(void) {}
 static inline void hv_set_msi_entry_from_desc(union hv_msi_entry *msi_entry,
                                              struct msi_desc *msi_desc)
 {
-       msi_entry->address = msi_desc->msg.address_lo;
-       msi_entry->data = msi_desc->msg.data;
+       msi_entry->address.as_uint32 = msi_desc->msg.address_lo;
+       msi_entry->data.as_uint32 = msi_desc->msg.data;
 }
 
 #else /* CONFIG_HYPERV */
index 562a299..8ac797e 100644 (file)
@@ -481,12 +481,36 @@ struct hv_create_vp {
        u64 flags;
 } __packed;
 
+union hv_msi_address_register {
+       u32 as_uint32;
+       struct {
+               u32 reserved1:2;
+               u32 destination_mode:1;
+               u32 redirection_hint:1;
+               u32 reserved2:8;
+               u32 destination_id:8;
+               u32 msi_base:12;
+       };
+} __packed;
+
+union hv_msi_data_register {
+       u32 as_uint32;
+       struct {
+               u32 vector:8;
+               u32 delivery_mode:3;
+               u32 reserved1:3;
+               u32 level_assert:1;
+               u32 trigger_mode:1;
+               u32 reserved2:16;
+       };
+} __packed;
+
 /* HvRetargetDeviceInterrupt hypercall */
 union hv_msi_entry {
        u64 as_uint64;
        struct {
-               u32 address;
-               u32 data;
+               union hv_msi_address_register address;
+               union hv_msi_data_register data;
        } __packed;
 };