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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, May 24, 2017 at 3:03 PM, Vitaly Kuznetsov <vkuznets@xxxxxxxxxx> 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
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux