Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp51067ybm; Tue, 26 May 2020 10:29:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzaWRPWrM1IqAoZUYsyM9IDT1ZQzWVwVSWbbNQnf+3JKYuUJLCChn3nwpDc5FSjjd75JIw0 X-Received: by 2002:a17:906:6b92:: with SMTP id l18mr487762ejr.145.1590514161280; Tue, 26 May 2020 10:29:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590514161; cv=none; d=google.com; s=arc-20160816; b=jseHYffeOPujhfPjlfQArBln9X67bUbgnjW3vL3Hf+vFX5xtXpvFSmU8tU1sPHMDU7 27f/ltV8YfmzcJUETRRsDdTKLbqt6ydyCYwrIbOeS6kiDGe7VO9eWc5XaImVqOcb1r8o GknSXej3yqCyW9XWmr4ATtBalsCT4/StWyec9Hd3HgA5CwaS2tS8wGvRZdQZhZAjA9a3 TEZ8F3i+eFaia7laVGe//BxocTg/7tkGPKHWH+ZEdvO/je9rrE9zeZAd2lfb3tvjXB4M AjcU7P1kmncW+OCMt34pCCDtYSkgMDNph3ktN/ZA4xuOZUd/QBiaR5QmzU1gm8TNd53P Kqdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=aWMuLu+D+5hDBHITPYz9gQFGs3iVcOHE/1FDulotv2A=; b=tbUzoMerJKUM0xHZfXGs2Q7epqhhj8rqrC2/z5Bk4qsNcyXScGOCRztUaW7YP8rOSl ywFRmF6GU8Q/OK14AB4DRuScVPNmMEF7mpvtUaUP2XanYX12KZRYbsNyG9RF9it423Nc S3U58Pp0PpvtRlzXqUcyVUushJRp2mI1AF0PPHi3nu5TO9dABJuxWcW/SuRcYwzQuEv/ lIOIC2h2+kdhkY30bOYMzmUPuN+YnNSJzBIWqToLIQvAQFUz7NAh/VLt5GonKuwJMECP seRkKzHwLzJPBKfa4YXA35jayqcAdIp+BdCgSfVhENmo6R+NEAcLWVAm/gp+jjcnPn51 +5AA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=TRgNf435; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r22si240238edq.354.2020.05.26.10.28.58; Tue, 26 May 2020 10:29:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=TRgNf435; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389484AbgEZRZA (ORCPT + 99 others); Tue, 26 May 2020 13:25:00 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:49559 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2389189AbgEZRX0 (ORCPT ); Tue, 26 May 2020 13:23:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1590513805; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aWMuLu+D+5hDBHITPYz9gQFGs3iVcOHE/1FDulotv2A=; b=TRgNf435B4D0n7eDZsuJ3zdupWdjH1fsB25/HqrExxzy7jamns4SRB0rwfeplW3ojCUyin QvnHMGzaJG1Ujw+U3YUqcVPIxXazZkzry8cuBg7NAj6K1TDv8ZJXKX46ZccB1P49Pe3GqL x00GRAD6FxBX1EmMGpufwRxY9FOHYPU= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-442-GjesUvQwNiOUcKPoOOjLMw-1; Tue, 26 May 2020 13:23:23 -0400 X-MC-Unique: GjesUvQwNiOUcKPoOOjLMw-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 68617107ACF3; Tue, 26 May 2020 17:23:22 +0000 (UTC) Received: from virtlab511.virt.lab.eng.bos.redhat.com (virtlab511.virt.lab.eng.bos.redhat.com [10.19.152.198]) by smtp.corp.redhat.com (Postfix) with ESMTP id D3A055C1D6; Tue, 26 May 2020 17:23:21 +0000 (UTC) From: Paolo Bonzini To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: vkuznets@redhat.com, mlevitsk@redhat.com, Sean Christopherson , Jim Mattson Subject: [PATCH 14/28] KVM: nSVM: remove trailing padding for struct vmcb_control_area Date: Tue, 26 May 2020 13:22:54 -0400 Message-Id: <20200526172308.111575-15-pbonzini@redhat.com> In-Reply-To: <20200526172308.111575-1-pbonzini@redhat.com> References: <20200526172308.111575-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Allow placing the VMCB structs on the stack or in other structs without wasting too much space. Add BUILD_BUG_ON as a quick safeguard against typos. Signed-off-by: Paolo Bonzini --- arch/x86/include/asm/svm.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/arch/x86/include/asm/svm.h b/arch/x86/include/asm/svm.h index 6ece8561ba66..8a1f5382a4ea 100644 --- a/arch/x86/include/asm/svm.h +++ b/arch/x86/include/asm/svm.h @@ -96,7 +96,6 @@ struct __attribute__ ((__packed__)) vmcb_control_area { u8 reserved_6[8]; /* Offset 0xe8 */ u64 avic_logical_id; /* Offset 0xf0 */ u64 avic_physical_id; /* Offset 0xf8 */ - u8 reserved_7[768]; }; @@ -203,8 +202,16 @@ struct __attribute__ ((__packed__)) vmcb_save_area { u64 last_excp_to; }; + +static inline void __unused_size_checks(void) +{ + BUILD_BUG_ON(sizeof(struct vmcb_save_area) != 0x298); + BUILD_BUG_ON(sizeof(struct vmcb_control_area) != 256); +} + struct __attribute__ ((__packed__)) vmcb { struct vmcb_control_area control; + u8 reserved_control[1024 - sizeof(struct vmcb_control_area)]; struct vmcb_save_area save; }; -- 2.26.2