From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758044AbcLTRZE (ORCPT ); Tue, 20 Dec 2016 12:25:04 -0500 Received: from mail-pg0-f43.google.com ([74.125.83.43]:33622 "EHLO mail-pg0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757738AbcLTRZB (ORCPT ); Tue, 20 Dec 2016 12:25:01 -0500 Date: Tue, 20 Dec 2016 09:24:53 -0800 From: Stephen Hemminger To: Roman Kagan Cc: Paolo Bonzini , Radim =?UTF-8?B?S3LEjW3DocWZ?= , "K. Y. Srinivasan" , Vitaly Kuznetsov , kvm@vger.kernel.org, "Denis V . Lunev" , Haiyang Zhang , x86@kernel.org, linux-kernel@vger.kernel.org, Ingo Molnar , "H. Peter Anvin" , devel@linuxdriverproject.org, Thomas Gleixner Subject: Re: [PATCH 02/15] hyperv: uapi-fy synic event flags definitions Message-ID: <20161220092453.20d3a640@xeon-e3> In-Reply-To: <20161220155602.6298-3-rkagan@virtuozzo.com> References: <20161220155602.6298-1-rkagan@virtuozzo.com> <20161220155602.6298-3-rkagan@virtuozzo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 20 Dec 2016 18:55:49 +0300 Roman Kagan wrote: > Move definitions related to the Hyper-V SynIC event flags to a header > where they can be consumed by userspace. > > While doing so, also clean up their use by switching to standard bitops > and struct-based dereferencing. The latter is also done for message > pages. > > Signed-off-by: Roman Kagan > --- > arch/x86/include/uapi/asm/hyperv.h | 13 +++++++++ > drivers/hv/hyperv_vmbus.h | 24 ++-------------- > drivers/hv/channel_mgmt.c | 10 +++---- > drivers/hv/connection.c | 47 ++++++++++--------------------- > drivers/hv/vmbus_drv.c | 57 ++++++++++++++------------------------ > 5 files changed, 54 insertions(+), 97 deletions(-) > > diff --git a/arch/x86/include/uapi/asm/hyperv.h b/arch/x86/include/uapi/asm/hyperv.h > index 6098ab5..af542a3 100644 > --- a/arch/x86/include/uapi/asm/hyperv.h > +++ b/arch/x86/include/uapi/asm/hyperv.h > @@ -363,4 +363,17 @@ struct hv_timer_message_payload { > #define HV_STIMER_AUTOENABLE (1ULL << 3) > #define HV_STIMER_SINT(config) (__u8)(((config) >> 16) & 0x0F) > > +/* Define synthetic interrupt controller flag constants. */ > +#define HV_EVENT_FLAGS_COUNT (256 * 8) > + > +/* Define the synthetic interrupt controller event flags format. */ > +struct hv_synic_event_flags { > + __u64 flags[HV_EVENT_FLAGS_COUNT / 64]; > +}; > + > +/* Define the synthetic interrupt flags page layout. */ > +struct hv_synic_event_flags_page { > + struct hv_synic_event_flags sintevent_flags[HV_SYNIC_SINT_COUNT]; > +}; > + > #endif How are these going to be exposed to user space? They should really be unsigned long since there is no guarantee of atomic operation on 64 bit values on 32 bit architectures. From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Hemminger Subject: Re: [PATCH 02/15] hyperv: uapi-fy synic event flags definitions Date: Tue, 20 Dec 2016 09:24:53 -0800 Message-ID: <20161220092453.20d3a640@xeon-e3> References: <20161220155602.6298-1-rkagan@virtuozzo.com> <20161220155602.6298-3-rkagan@virtuozzo.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: "H. Peter Anvin" , kvm@vger.kernel.org, Radim =?UTF-8?B?S3LEjW3DocWZ?= , Haiyang Zhang , x86@kernel.org, linux-kernel@vger.kernel.org, devel@linuxdriverproject.org, Ingo Molnar , Paolo Bonzini , "Denis V . Lunev" , Thomas Gleixner To: Roman Kagan Return-path: In-Reply-To: <20161220155602.6298-3-rkagan@virtuozzo.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: driverdev-devel-bounces@linuxdriverproject.org Sender: "devel" List-Id: kvm.vger.kernel.org On Tue, 20 Dec 2016 18:55:49 +0300 Roman Kagan wrote: > Move definitions related to the Hyper-V SynIC event flags to a header > where they can be consumed by userspace. > > While doing so, also clean up their use by switching to standard bitops > and struct-based dereferencing. The latter is also done for message > pages. > > Signed-off-by: Roman Kagan > --- > arch/x86/include/uapi/asm/hyperv.h | 13 +++++++++ > drivers/hv/hyperv_vmbus.h | 24 ++-------------- > drivers/hv/channel_mgmt.c | 10 +++---- > drivers/hv/connection.c | 47 ++++++++++--------------------- > drivers/hv/vmbus_drv.c | 57 ++++++++++++++------------------------ > 5 files changed, 54 insertions(+), 97 deletions(-) > > diff --git a/arch/x86/include/uapi/asm/hyperv.h b/arch/x86/include/uapi/asm/hyperv.h > index 6098ab5..af542a3 100644 > --- a/arch/x86/include/uapi/asm/hyperv.h > +++ b/arch/x86/include/uapi/asm/hyperv.h > @@ -363,4 +363,17 @@ struct hv_timer_message_payload { > #define HV_STIMER_AUTOENABLE (1ULL << 3) > #define HV_STIMER_SINT(config) (__u8)(((config) >> 16) & 0x0F) > > +/* Define synthetic interrupt controller flag constants. */ > +#define HV_EVENT_FLAGS_COUNT (256 * 8) > + > +/* Define the synthetic interrupt controller event flags format. */ > +struct hv_synic_event_flags { > + __u64 flags[HV_EVENT_FLAGS_COUNT / 64]; > +}; > + > +/* Define the synthetic interrupt flags page layout. */ > +struct hv_synic_event_flags_page { > + struct hv_synic_event_flags sintevent_flags[HV_SYNIC_SINT_COUNT]; > +}; > + > #endif How are these going to be exposed to user space? They should really be unsigned long since there is no guarantee of atomic operation on 64 bit values on 32 bit architectures.