Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1651944

Re: [PATCH v4 04/10] x86/hyper-v: fast hypercall implementation

From Andy Shevchenko <andy.shevchenko@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH v4 04/10] x86/hyper-v: fast hypercall implementation
Date 2017-05-27 19:50 +0200
Message-ID <tLO0F-77h-5@gated-at.bofh.it> (permalink)
References <tKDh0-2cD-7@gated-at.bofh.it> <tKDh0-2cD-21@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wed, May 24, 2017 at 3:03 PM, Vitaly Kuznetsov <vkuznets@redhat.com> 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

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

Re: [PATCH v4 04/10] x86/hyper-v: fast hypercall implementation Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-05-27 19:50 +0200

csiph-web