From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40383) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VhH37-0001Y4-Uk for qemu-devel@nongnu.org; Fri, 15 Nov 2013 05:54:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VhH31-0006I1-S8 for qemu-devel@nongnu.org; Fri, 15 Nov 2013 05:54:53 -0500 Received: from mx1.redhat.com ([209.132.183.28]:53741) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VhH31-0006Hu-IM for qemu-devel@nongnu.org; Fri, 15 Nov 2013 05:54:47 -0500 Message-ID: <5285FD71.60707@redhat.com> Date: Fri, 15 Nov 2013 11:54:41 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <1384456020-12251-1-git-send-email-peter.maydell@linaro.org> In-Reply-To: <1384456020-12251-1-git-send-email-peter.maydell@linaro.org> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RFC] target-arm: Provide mechanism for getting KVM constants even if not CONFIG_KVM List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: Gleb Natapov , qemu-devel@nongnu.org, kvm@vger.kernel.org, patches@linaro.org Il 14/11/2013 20:07, Peter Maydell ha scritto: > diff --git a/target-arm/kvm-consts.h b/target-arm/kvm-consts.h > new file mode 100644 > index 0000000..42ffb50 > --- /dev/null > +++ b/target-arm/kvm-consts.h > @@ -0,0 +1,34 @@ > +/* > + * Provide versions of KVM constant defines that can be used even > + * when CONFIG_KVM is not set and we don't have access to the > + * KVM headers. If CONFIG_KVM is set, we do a compile-time check > + * that we haven't got out of sync somehow. > + */ > +#ifndef ARM_KVM_CONSTS_H > +#define ARM_KVM_CONSTS_H > + > +#ifdef CONFIG_KVM > +#include "qemu/compiler.h" > +#include > + > +#define MISMATCH_CHECK(X, Y) QEMU_BUILD_BUG_ON(X != Y) > + > +#else > +#define MISMATCH_CHECK(X, Y) > +#endif > + > +#define CP_REG_SIZE_SHIFT 52 > +#define CP_REG_SIZE_MASK 0x00f0000000000000ULL > +#define CP_REG_SIZE_U32 0x0020000000000000ULL > +#define CP_REG_SIZE_U64 0x0030000000000000ULL > +#define CP_REG_ARM 0x4000000000000000ULL > + > +MISMATCH_CHECK(CP_REG_SIZE_SHIFT, KVM_REG_SIZE_SHIFT) > +MISMATCH_CHECK(CP_REG_SIZE_MASK, KVM_REG_SIZE_MASK) > +MISMATCH_CHECK(CP_REG_SIZE_U32, KVM_REG_SIZE_U32) > +MISMATCH_CHECK(CP_REG_SIZE_U64, KVM_REG_SIZE_U64) > +MISMATCH_CHECK(CP_REG_ARM, KVM_REG_ARM) > + > +#undef MISMATCH_CHECK > + > +#endif > It's okay. There are indeed advantages to putting this together with the definitions, instead of splitting it between target-arm/cpu.h and target-arm/kvm.c. The patch is missing the removal of the check from kvm.c though. Paolo