Misc Hyper-V TLFS fixes
cover Misc Hyper-V TLFS fixes
Fix two issues discovered by Jan.
Wei Liu (2):
x86/hyperv: drop usage of GENMASK_ULL from hyperv-tlfs.h x86/hyperv: drop all __packed from hyperv-tlfs.h
xen/include/asm-x86/guest/hyperv-tlfs.h | 60 ++++++++++++------------- 1 file changed, 30 insertions(+), 30 deletions(-)
Signature · 7 lines
2.20.1 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH 1/2 x86/hyperv: drop usage of GENMASK_ULL from hyperv-tlfs.h
I'm told that GENMASK_ULL shouldn't be used outside of Arm code in its current form.
--- xen/include/asm-x86/guest/hyperv-tlfs.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
xen/include/asm-x86/guest/hyperv-tlfs.h +3 -3
@@ -415,13 +415,13 @@ enum HV_GENERIC_SET_FORMAT { HV_GENERIC_SET_ALL, }; -#define HV_HYPERCALL_RESULT_MASK GENMASK_ULL(15, 0) +#define HV_HYPERCALL_RESULT_MASK 0xffff/* GENMASK_ULL(15, 0) */ #define HV_HYPERCALL_FAST_BIT BIT(16, UL)#define HV_HYPERCALL_VARHEAD_OFFSET 17#define HV_HYPERCALL_REP_COMP_OFFSET 32 -#define HV_HYPERCALL_REP_COMP_MASK GENMASK_ULL(43, 32) +#define HV_HYPERCALL_REP_COMP_MASK 0xfff00000000/* GENMASK_ULL(43, 32) */ #define HV_HYPERCALL_REP_START_OFFSET 48 -#define HV_HYPERCALL_REP_START_MASK GENMASK_ULL(59, 48) +#define HV_HYPERCALL_REP_START_MASK 0xfff000000000000/* GENMASK_ULL(59, 48) */ /* hypercall status code */ #define HV_STATUS_SUCCESS 0
Signature · 7 lines
2.20.1 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH 1/2] x86/hyperv: drop usage of GENMASK_ULL from hyperv-tlfs.h
Quoted 6 lines · Wei Liu
xen/include/asm-x86/guest/hyperv-tlfs.h +0
-0@@ -415,13 +415,13 @@ enum HV_GENERIC_SET_FORMAT { HV_GENERIC_SET_ALL, };
xen/include/asm-x86/guest/hyperv-tlfs.h enum HV_GENERIC_SET_FORMAT { · line 424
Quoted 10 lines
xen/include/asm-x86/guest/hyperv-tlfs.h +3
-3-#define HV_HYPERCALL_RESULT_MASK GENMASK_ULL(15, 0) +#define HV_HYPERCALL_RESULT_MASK 0xffff/* GENMASK_ULL(15, 0) */ #define HV_HYPERCALL_FAST_BIT BIT(16, UL)#define HV_HYPERCALL_VARHEAD_OFFSET 17#define HV_HYPERCALL_REP_COMP_OFFSET 32 -#define HV_HYPERCALL_REP_COMP_MASK GENMASK_ULL(43, 32) +#define HV_HYPERCALL_REP_COMP_MASK 0xfff00000000/* GENMASK_ULL(43, 32) */ #define HV_HYPERCALL_REP_START_OFFSET 48 -#define HV_HYPERCALL_REP_START_MASK GENMASK_ULL(59, 48) +#define HV_HYPERCALL_REP_START_MASK 0xfff000000000000/* GENMASK_ULL(59, 48) */
The last two should gain ULL (or at least UL) suffixes. I also wonder whether both wouldn't better be expressed as (0xfffULL << N). With at least the suffixes added
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH 1/2] x86/hyperv: drop usage of GENMASK_ULL from hyperv-tlfs.h
Quoted 7 lines · Jan Beulich
Quoted 6 lines · Wei Liu
xen/include/asm-x86/guest/hyperv-tlfs.h +0
-0@@ -415,13 +415,13 @@ enum HV_GENERIC_SET_FORMAT { HV_GENERIC_SET_ALL, };
Quoted 14 lines
xen/include/asm-x86/guest/hyperv-tlfs.h enum HV_GENERIC_SET_FORMAT { · line 424
Quoted 10 lines
xen/include/asm-x86/guest/hyperv-tlfs.h +3
-3-#define HV_HYPERCALL_RESULT_MASK GENMASK_ULL(15, 0) +#define HV_HYPERCALL_RESULT_MASK 0xffff/* GENMASK_ULL(15, 0) */ #define HV_HYPERCALL_FAST_BIT BIT(16, UL)#define HV_HYPERCALL_VARHEAD_OFFSET 17#define HV_HYPERCALL_REP_COMP_OFFSET 32 -#define HV_HYPERCALL_REP_COMP_MASK GENMASK_ULL(43, 32) +#define HV_HYPERCALL_REP_COMP_MASK 0xfff00000000/* GENMASK_ULL(43, 32) */ #define HV_HYPERCALL_REP_START_OFFSET 48 -#define HV_HYPERCALL_REP_START_MASK GENMASK_ULL(59, 48) +#define HV_HYPERCALL_REP_START_MASK 0xfff000000000000/* GENMASK_ULL(59, 48) */ The last two should gain ULL (or at least UL) suffixes. I also wonder whether both wouldn't better be expressed as (
0xfffULL<< N). With at least the suffixes added
Thanks. I will fix those up.
Using (0xffffULL << N) works for me too. Let's see what form Paul prefers.
Wei.
Quoted 3 lines
Acked-by Jan Beulich <[email protected]>Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH 2/2 x86/hyperv: drop all __packed from hyperv-tlfs.h
In reply to Wei LiuAll structures are already naturally aligned. Linux added those attributes out of paranoia.
In Xen we've had instance we had to drop pointless __packed to placate gcc 9 (see ca9310b24e), it is better drop those attributes.
--- xen/include/asm-x86/guest/hyperv-tlfs.h | 54 ++++++++++++------------- 1 file changed, 27 insertions(+), 27 deletions(-)
xen/include/asm-x86/guest/hyperv-tlfs.h +27 -27
@@ -288,7 +288,7 @@ union hv_x64_msr_hypercall_contents { u64 enable:1; u64 reserved:11; u64 guest_physical_address:52; - } __packed; + }; };/*
@@ -300,7 +300,7 @@ struct ms_hyperv_tsc_page {volatile u64 tsc_scale;volatile s64 tsc_offset;u64 reserved2[509 ]; -} __packed; +};/* * The guest OS needs to register the guest ID with the hypervisor.
@@ -347,17 +347,17 @@ struct hv_reenlightenment_control { __u64 enabled:1; __u64 reserved2:15; __u64 target_vp:32; -} __packed; +};struct hv_tsc_emulation_control {__u64 enabled:1 ;__u64 reserved:63 ; -} __packed; +};struct hv_tsc_emulation_status {__u64 inprogress:1 ;__u64 reserved:63 ; -} __packed; +};#define HV_X64_MSR_HYPERCALL_ENABLE 0x00000001#define HV_X64_MSR_HYPERCALL_PAGE_ADDRESS_SHIFT 12
@@ -445,7 +445,7 @@ typedef struct _HV_REFERENCE_TSC_PAGE {__u32 res1;__u64 tsc_scale;__s64 tsc_offset; -}__packed HV_REFERENCE_TSC_PAGE , *PHV_REFERENCE_TSC_PAGE ; +}HV_REFERENCE_TSC_PAGE , *PHV_REFERENCE_TSC_PAGE ;/* Define the number of synthetic interrupt sources. */ #define HV_SYNIC_SINT_COUNT (16)
@@ -502,7 +502,7 @@ union hv_message_flags {struct {__u8 msg_pending:1 ;__u8 reserved:7 ; - } __packed; + }; };/* Define port identifier type. */
@@ -511,7 +511,7 @@ union hv_port_id {struct {__u32 id:24 ;__u32 reserved:8 ; - } __packed u; + } u; };/* Define synthetic interrupt controller message header. */
@@ -524,7 +524,7 @@ struct hv_message_header {__u64 sender;union hv_port_id port; }; -} __packed; +};/* Define synthetic interrupt controller message format. */ struct hv_message {
@@ -532,12 +532,12 @@ struct hv_message {union {__u64 payload[HV_MESSAGE_PAYLOAD_QWORD_COUNT ]; } u; -} __packed; +};/* Define the synthetic interrupt message page layout. */ struct hv_message_page {struct hv_message sint_message[HV_SYNIC_SINT_COUNT ]; -} __packed; +};/* Define timer message payload structure. */ struct hv_timer_message_payload {
@@ -545,7 +545,7 @@ struct hv_timer_message_payload {__u32 reserved;__u64 expiration_time;/* When the timer expired */ __u64 delivery_time;/* When the message was delivered */ -} __packed; +}; struct hv_nested_enlightenments_control { struct {
@@ -555,7 +555,7 @@ struct hv_nested_enlightenments_control {struct {__u32 reserved; } hypercallControls; -} __packed; +};/* Define virtual processor assist page structure. */ struct hv_vp_assist_page {
@@ -566,7 +566,7 @@ struct hv_vp_assist_page {__u8 enlighten_vmentry;__u8 reserved2[7 ];__u64 current_nested_vmcs; -} __packed; +};struct hv_enlightened_vmcs {u32 revision_id;
@@ -742,7 +742,7 @@ struct hv_enlightened_vmcs { u32 nested_flush_hypercall:1; u32 msr_bitmap:1; u32 reserved:30; - }__packed hv_enlightenments_control; + } hv_enlightenments_control;u32 hv_vp_id;u64 hv_vm_id;
@@ -752,7 +752,7 @@ struct hv_enlightened_vmcs {u64 padding64_5[7 ];u64 xss_exit_bitmap;u64 padding64_6[7 ]; -} __packed; +};#define HV_VMX_ENLIGHTENED_CLEAN_FIELD_NONE 0#define HV_VMX_ENLIGHTENED_CLEAN_FIELD_IO_BITMAP BIT(0, UL)
@@ -793,7 +793,7 @@ union hv_stimer_config { u64 reserved_z0:3; u64 sintx:4; u64 reserved_z1:44; - } __packed; + }; };
@@ -808,7 +808,7 @@ union hv_synic_scontrol {struct {u64 enable:1 ;u64 reserved:63 ; - } __packed; + }; };/* Define synthetic interrupt source. */
@@ -821,7 +821,7 @@ union hv_synic_sint { u64 auto_eoi:1; u64 polling:1; u64 reserved2:45; - } __packed; + }; };/* Define the format of the SIMP register */
@@ -831,7 +831,7 @@ union hv_synic_simp { u64 simp_enabled:1; u64 preserved:11; u64 base_simp_gpa:52; - } __packed; + }; };/* Define the format of the SIEFP register */
@@ -841,34 +841,34 @@ union hv_synic_siefp { u64 siefp_enabled:1; u64 preserved:11; u64 base_siefp_gpa:52; - } __packed; + }; };struct hv_vpset {u64 format;u64 valid_bank_mask;u64 bank_contents[]; -} __packed; +};/* HvCallSendSyntheticClusterIpi hypercall */ struct hv_send_ipi {u32 vector;u32 reserved;u64 cpu_mask; -} __packed; +};/* HvCallSendSyntheticClusterIpiEx hypercall */ struct hv_send_ipi_ex {u32 vector;u32 reserved;struct hv_vpset vp_set; -} __packed; +};/* HvFlushGuestPhysicalAddressSpace hypercalls */ struct hv_guest_mapping_flush {u64 address_space;u64 flags; -} __packed; +};/* * HV_MAX_FLUSH_PAGES = "additional_pages" + 1. It's limited
@@ -906,7 +906,7 @@ struct hv_tlb_flush {u64 flags;u64 processor_mask;u64 gva_list[]; -} __packed; +};/* HvFlushVirtualAddressSpaceEx hypercall */ struct hv_tlb_flush_ex {
@@ -914,7 +914,7 @@ struct hv_tlb_flush_ex {u64 flags;struct hv_vpset hv_vp_set;/* u64 gva_list[]; */ -} __packed; +};struct hv_partition_assist_pg {u32 tlb_lock_count;
Signature · 7 lines
2.20.1 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH 2/2] x86/hyperv: drop all __packed from hyperv-tlfs.h
Quoted 6 lines · Wei Liu
All structures are already naturally aligned. Linux added those attributes out of paranoia.
In Xen we've had instance we had to drop pointless
__packedto placate gcc 9 (seeca9310b24e
I think you should add:
"x86/IO-APIC: fix build with gcc9"
here.
Quoted 4 lines
), it is better drop those attributes.
Requested-by Jan Beulich <[email protected]>Signed-off-by Wei Liu <[email protected]>
Paul
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH 2/2] x86/hyperv: drop all __packed from hyperv-tlfs.h
Quoted 5 lines · Paul Durrant
Quoted 4 lines · Wei Liu
All structures are already naturally aligned. Linux added those attributes out of paranoia.
Quoted 8 lines
Quoted 2 lines
In Xen we've had instance we had to drop pointless
__packedto placate gcc 9 (seeca9310b24eI think you should add:
"x86/IO-APIC: fix build with gcc9"
here.
I have fixed it up locally. Do you want me to resend these two patches just for this update?
Wei.
Quoted 7 lines
Quoted 5 lines
), it is better drop those attributes.
Requested-by Jan Beulich <[email protected]>Signed-off-by Wei Liu <[email protected]>Paul
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH 2/2] x86/hyperv: drop all __packed from hyperv-tlfs.h
Quoted 21 lines
-----Original Message-----
From: Xen-devel <[email protected]> On Behalf Of Wei Liu
Sent: 08 January 2020 12:27
To: Paul Durrant <[email protected]>
Cc: Wei Liu <[email protected]>; Wei Liu <[email protected]>; Andrew Cooper <[email protected]>; Michael Kelley <[email protected]>; Jan Beulich <[email protected]>; Xen Development List <xen- [email protected]>; Roger Pau Monné <[email protected]>
Subject: Re: [Xen-devel] [PATCH 2/2] x86/hyperv: drop all__packedfromhyperv-tlfs.hQuoted 8 lines · Paul Durrant
Quoted 6 lines · Wei Liu
All structures are already naturally aligned. Linux added those attributes out of paranoia.
In Xen we've had instance we had to drop pointless
__packedto placate gcc 9 (seeca9310b24e
Quoted 8 lines
Quoted 5 lines
I think you should add:
"x86/IO-APIC: fix build with gcc9"
here.
I have fixed it up locally. Do you want me to resend these two patches just for this update?
As long as it is fixed when committed any way will do.
Paul
Quoted 9 lines
Wei.
Quoted 6 lines
Quoted 5 lines
), it is better drop those attributes.
Requested-by Jan Beulich <[email protected]>Signed-off-by Wei Liu <[email protected]>
Quoted 6 lines
Quoted 1 line
Paul
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH 2/2] x86/hyperv: drop all __packed from hyperv-tlfs.h
In reply to Wei LiuQuoted 8 lines · Wei Liu
All structures are already naturally aligned. Linux added those attributes out of paranoia.
In Xen we've had instance we had to drop pointless
__packedto placate gcc 9 (seeca9310b24e), it is better drop those attributes.Requested-by Jan Beulich <[email protected]>Signed-off-by Wei Liu <[email protected]>
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel