aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kvm/e500mc.c
diff options
context:
space:
mode:
authorSean Christopherson <sean.j.christopherson@intel.com>2019-12-18 13:54:56 -0800
committerPaolo Bonzini <pbonzini@redhat.com>2020-01-24 09:18:58 +0100
commit3ec8ca29647078db11a820ab22855dd64d9a4897 (patch)
tree40474ce53744bac949a11bbfff8b3ba289edb0a4 /arch/powerpc/kvm/e500mc.c
parentKVM: x86: Move kvm_vcpu_init() invocation to common code (diff)
downloadlinux-dev-3ec8ca29647078db11a820ab22855dd64d9a4897.tar.xz
linux-dev-3ec8ca29647078db11a820ab22855dd64d9a4897.zip
KVM: PPC: e500mc: Add build-time assert that vcpu is at offset 0
In preparation for moving vcpu allocation to common PPC code, add an explicit, albeit redundant, build-time assert to ensure the vcpu member is located at offset 0. The assert is redundant in the sense that kvmppc_core_vcpu_create_e500() contains a functionally identical assert. The motiviation for adding the extra assert is to provide visual confirmation of the correctness of moving vcpu allocation to common code. Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to '')
-rw-r--r--arch/powerpc/kvm/e500mc.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/arch/powerpc/kvm/e500mc.c b/arch/powerpc/kvm/e500mc.c
index 318e65c65999..c51f4bb086fd 100644
--- a/arch/powerpc/kvm/e500mc.c
+++ b/arch/powerpc/kvm/e500mc.c
@@ -308,6 +308,8 @@ static struct kvm_vcpu *kvmppc_core_vcpu_create_e500mc(struct kvm *kvm,
struct kvm_vcpu *vcpu;
int err;
+ BUILD_BUG_ON(offsetof(struct kvmppc_vcpu_e500, vcpu) != 0);
+
vcpu_e500 = kmem_cache_zalloc(kvm_vcpu_cache, GFP_KERNEL);
if (!vcpu_e500) {
err = -ENOMEM;