Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753308AbbGIGJp (ORCPT ); Thu, 9 Jul 2015 02:09:45 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44269 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751915AbbGIGJf (ORCPT ); Thu, 9 Jul 2015 02:09:35 -0400 Subject: Re: [PATCH] KVM: x86: Add host physical address width capability To: Bandan Das , kvm@vger.kernel.org References: Cc: Laszlo Ersek , linux-kernel@vger.kernel.org, qemu-devel@nongnu.org From: Paolo Bonzini Message-ID: <559E101A.7080601@redhat.com> Date: Thu, 9 Jul 2015 08:09:30 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.0.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1560 Lines: 51 On 09/07/2015 00:36, Bandan Das wrote: > Let userspace inquire the maximum physical address width > of the host processors; this can be used to identify maximum > memory that can be assigned to the guest. > > Reported-by: Laszlo Ersek > Signed-off-by: Bandan Das > --- > arch/x86/kvm/x86.c | 3 +++ > include/uapi/linux/kvm.h | 1 + > 2 files changed, 4 insertions(+) > > diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c > index bbaf44e..97d6746 100644 > --- a/arch/x86/kvm/x86.c > +++ b/arch/x86/kvm/x86.c > @@ -2683,6 +2683,9 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext) > case KVM_CAP_NR_MEMSLOTS: > r = KVM_USER_MEM_SLOTS; > break; > + case KVM_CAP_PHY_ADDR_WIDTH: > + r = boot_cpu_data.x86_phys_bits; > + break; Userspace can just use CPUID, can't it? Paolo > case KVM_CAP_PV_MMU: /* obsolete */ > r = 0; > break; > diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h > index 716ad4a..e7949a1 100644 > --- a/include/uapi/linux/kvm.h > +++ b/include/uapi/linux/kvm.h > @@ -817,6 +817,7 @@ struct kvm_ppc_smmu_info { > #define KVM_CAP_DISABLE_QUIRKS 116 > #define KVM_CAP_X86_SMM 117 > #define KVM_CAP_MULTI_ADDRESS_SPACE 118 > +#define KVM_CAP_PHY_ADDR_WIDTH 119 > > #ifdef KVM_CAP_IRQ_ROUTING > > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/