From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751515AbcEJJOz (ORCPT ); Tue, 10 May 2016 05:14:55 -0400 Received: from mail.skyhub.de ([78.46.96.112]:37633 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751121AbcEJJOw (ORCPT ); Tue, 10 May 2016 05:14:52 -0400 Date: Tue, 10 May 2016 11:14:47 +0200 From: Borislav Petkov To: Suravee Suthikulpanit Cc: pbonzini@redhat.com, rkrcmar@redhat.com, joro@8bytes.org, gleb@kernel.org, alex.williamson@redhat.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, wei@redhat.com, sherry.hurwitz@amd.com Subject: Re: [PART1 V5 07/13] KVM: x86: Detect and Initialize AVIC support Message-ID: <20160510091447.GA16752@pd.tnic> References: <1462388992-25242-1-git-send-email-Suravee.Suthikulpanit@amd.com> <1462388992-25242-8-git-send-email-Suravee.Suthikulpanit@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1462388992-25242-8-git-send-email-Suravee.Suthikulpanit@amd.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 04, 2016 at 02:09:46PM -0500, Suravee Suthikulpanit wrote: > This patch introduces AVIC-related data structure, and AVIC > initialization code. > > There are three main data structures for AVIC: > * Virtual APIC (vAPIC) backing page (per-VCPU) > * Physical APIC ID table (per-VM) > * Logical APIC ID table (per-VM) > > Currently, AVIC is disabled by default. Users can manually > enable AVIC via kernel boot option kvm-amd.avic=1 or during > kvm-amd module loading with parameter avic=1. > > Signed-off-by: Suravee Suthikulpanit > --- > arch/x86/include/asm/kvm_host.h | 4 + > arch/x86/include/asm/svm.h | 3 + > arch/x86/kvm/svm.c | 224 +++++++++++++++++++++++++++++++++++++++- > 3 files changed, 230 insertions(+), 1 deletion(-) ... > @@ -162,8 +173,19 @@ struct vcpu_svm { > > /* cached guest cpuid flags for faster access */ > bool nrips_enabled : 1; > + > + struct page *avic_backing_page; > + u64 *avic_physical_id_cache; > }; > > +#define AVIC_LOGICAL_ID_ENTRY_GUEST_PHYSICAL_ID_MASK (0xFF) > +#define AVIC_LOGICAL_ID_ENTRY_VALID_MASK (1 << 31) > + > +#define AVIC_PHYSICAL_ID_ENTRY_HOST_PHYSICAL_ID_MASK (0xFFULL) > +#define AVIC_PHYSICAL_ID_ENTRY_BACKING_PAGE_MASK (0xFFFFFFFFFFULL << 12) > +#define AVIC_PHYSICAL_ID_ENTRY_IS_RUNNING_MASK (1ULL << 62) > +#define AVIC_PHYSICAL_ID_ENTRY_VALID_MASK (1ULL << 63) Those defines could be shortened a little. Maybe #define AVIC_PHYSID_HOST_PHYS_MASK #define AVIC_PHYSID_BACKING_PG_MASK and so on... -- Regards/Gruss, Boris. ECO tip #101: Trim your mails when you reply.