Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752782AbdHQOaN (ORCPT ); Thu, 17 Aug 2017 10:30:13 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43182 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751620AbdHQOaK (ORCPT ); Thu, 17 Aug 2017 10:30:10 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com B7004C027354 Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=pbonzini@redhat.com Subject: Re: [PATCH v1 4/4] KVM: MMU: Expose the LA57 feature to VM. To: Yu Zhang , kvm@vger.kernel.org Cc: linux-kernel@vger.kernel.org, rkrcmar@redhat.com, tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com, xiaoguangrong@tencent.com, joro@8bytes.org References: <1502544906-1108-1-git-send-email-yu.c.zhang@linux.intel.com> <1502544906-1108-5-git-send-email-yu.c.zhang@linux.intel.com> <040155e8-510a-3ada-9d83-f4b489d0981f@linux.intel.com> From: Paolo Bonzini Message-ID: <517efada-20b8-5746-e62c-cca6f2a8a274@redhat.com> Date: Thu, 17 Aug 2017 16:29:42 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <040155e8-510a-3ada-9d83-f4b489d0981f@linux.intel.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Thu, 17 Aug 2017 14:30:10 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1178 Lines: 32 On 17/08/2017 13:53, Yu Zhang wrote: > > > On 8/17/2017 7:57 PM, Paolo Bonzini wrote: >> On 12/08/2017 15:35, Yu Zhang wrote: >>> index a98b88a..50107ae 100644 >>> --- a/arch/x86/kvm/emulate.c >>> +++ b/arch/x86/kvm/emulate.c >>> @@ -694,7 +694,7 @@ static __always_inline int __linearize(struct >>> x86_emulate_ctxt *ctxt, >>> switch (mode) { >>> case X86EMUL_MODE_PROT64: >>> *linear = la; >>> - if (is_noncanonical_address(la)) >>> + if (emul_is_noncanonical_address(la, ctxt)) >>> goto bad; >>> *max_size = min_t(u64, ~0u, (1ull << 48) - la); >> Oops, you missed one here. Probably best to use ctxt_virt_addr_bits and >> then "inline" emul_is_noncanonical_address as "get_canonical(la, >> va_bits) != la". > > Sorry, I just sent out the v2 patch set without noticing this reply. :-) > > The emul_is_noncanonical() is defined in x86.h so that no > ctxt_virt_addr_bits needed in emulate.c, are you > suggesting to use ctx_virt_addr_bits in this file each time before > emul_is_noncanonical_address() is called? No, only in this instance which uses "48" after the call to emul_is_noncanonical_address. Paolo