From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750792AbdE0RtH (ORCPT ); Sat, 27 May 2017 13:49:07 -0400 Received: from mail-qk0-f194.google.com ([209.85.220.194]:34552 "EHLO mail-qk0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750737AbdE0RtG (ORCPT ); Sat, 27 May 2017 13:49:06 -0400 MIME-Version: 1.0 In-Reply-To: <20170524120405.19079-5-vkuznets@redhat.com> References: <20170524120405.19079-1-vkuznets@redhat.com> <20170524120405.19079-5-vkuznets@redhat.com> From: Andy Shevchenko Date: Sat, 27 May 2017 20:49:04 +0300 Message-ID: Subject: Re: [PATCH v4 04/10] x86/hyper-v: fast hypercall implementation To: Vitaly Kuznetsov Cc: devel@linuxdriverproject.org, "x86@kernel.org" , "linux-kernel@vger.kernel.org" , "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Steven Rostedt , Jork Loeser , Simon Xiao , Andy Lutomirski Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 24, 2017 at 3:03 PM, Vitaly Kuznetsov wrote: > Hyper-V supports 'fast' hypercalls when all parameters are passed through > registers. Implement an inline version of a simpliest of these calls: > hypercall with one 8-byte input and no output. > > Proper hypercall input interface (struct hv_hypercall_input) definition is > added as well. > + u32 hv_status_hi, hv_status_lo; > + u32 input1_hi = (u32)(input1 >> 32); > + u32 input1_lo = (u32)input1; Explicit casting is redundant. Also consider using macros. > +/* Hypercall interface */ > +union hv_hypercall_input { Be careful wrt union aliasing. > + u64 as_uint64; > + struct { > + __u32 as_uint32_lo; > + __u32 as_uint32_hi; > + }; > + struct { > + __u64 code:16; > + __u64 fast:1; > + __u64 varhead_size:10; > + __u64 reserved1:5; > + __u64 rep_count:12; > + __u64 reserved2:4; > + __u64 rep_start:12; > + __u64 reserved3:4; > + }; > +}; -- With Best Regards, Andy Shevchenko