From mboxrd@z Thu Jan 1 00:00:00 1970 From: Will Deacon Subject: Re: [PATCH 1/2] KVM: device: add simple registration mechanism for kvm_device_ops Date: Mon, 30 Jun 2014 18:31:15 +0100 Message-ID: <20140630173115.GF30740@arm.com> References: <1403803817-22140-1-git-send-email-will.deacon@arm.com> <20140630112114.2f185502.cornelia.huck@de.ibm.com> <53B19CEF.6080702@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Cornelia Huck , "kvm@vger.kernel.org" , "kvmarm@lists.cs.columbia.edu" , Gleb Natapov , Marc Zyngier , Christoffer Dall To: Paolo Bonzini Return-path: Received: from cam-admin0.cambridge.arm.com ([217.140.96.50]:37205 "EHLO cam-admin0.cambridge.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756218AbaF3RbZ (ORCPT ); Mon, 30 Jun 2014 13:31:25 -0400 Content-Disposition: inline In-Reply-To: <53B19CEF.6080702@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Mon, Jun 30, 2014 at 06:22:55PM +0100, Paolo Bonzini wrote: > Il 30/06/2014 11:21, Cornelia Huck ha scritto: > > On Thu, 26 Jun 2014 18:30:16 +0100 > > Will Deacon wrote: > >> diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h > >> index e11d8f170a62..3b368166286f 100644 > >> --- a/include/uapi/linux/kvm.h > >> +++ b/include/uapi/linux/kvm.h > >> @@ -949,6 +949,7 @@ struct kvm_device_attr { > >> #define KVM_DEV_VFIO_GROUP_DEL 2 > >> #define KVM_DEV_TYPE_ARM_VGIC_V2 5 > >> #define KVM_DEV_TYPE_FLIC 6 > >> +#define KVM_DEV_TYPE_MAX 7 > > > > This means we always need to move this value once we introduce a new > > kvm device type. Can't you keep it in a dynamic list instead of a > > table? We just need to do the lookup during device creation anyway. > > There's also this wonderful thing called enum. ;) > > It would let Will keep the simpler code with an array, and autogenerate > KVM_DEV_TYPE_MAX. Although this is uapi, so we may need to #define the symbols anyway to avoid breaking userspace #ifndef tests. What do you reckon; is this an ABI break? Will