From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BFB1EC3F2C6 for ; Tue, 3 Mar 2020 16:28:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A1FE520838 for ; Tue, 3 Mar 2020 16:28:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730389AbgCCQ2K (ORCPT ); Tue, 3 Mar 2020 11:28:10 -0500 Received: from mga07.intel.com ([134.134.136.100]:18741 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730385AbgCCQ2K (ORCPT ); Tue, 3 Mar 2020 11:28:10 -0500 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Mar 2020 08:28:09 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,511,1574150400"; d="scan'208";a="287035714" Received: from sjchrist-coffee.jf.intel.com (HELO linux.intel.com) ([10.54.74.202]) by FMSMGA003.fm.intel.com with ESMTP; 03 Mar 2020 08:28:08 -0800 Date: Tue, 3 Mar 2020 08:28:08 -0800 From: Sean Christopherson To: Paolo Bonzini Cc: Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Jan Kiszka , Xiaoyao Li Subject: Re: [PATCH 3/6] KVM: x86: Add dedicated emulator helper for grabbing CPUID.maxphyaddr Message-ID: <20200303162808.GJ1439@linux.intel.com> References: <20200302195736.24777-1-sean.j.christopherson@intel.com> <20200302195736.24777-4-sean.j.christopherson@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org On Tue, Mar 03, 2020 at 09:48:03AM +0100, Paolo Bonzini wrote: > On 02/03/20 20:57, Sean Christopherson wrote: > > Add a helper to retrieve cpuid_maxphyaddr() instead of manually > > calculating the value in the emulator via raw CPUID output. In addition > > to consolidating logic, this also paves the way toward simplifying > > kvm_cpuid(), whose somewhat confusing return value exists purely to > > support the emulator's maxphyaddr calculation. > > > > No functional change intended. > > I don't think this is a particularly useful change. Yes, it's not > intuitive but is it more than a matter of documentation (and possibly > moving the check_cr_write snippet into a separate function)? I really don't like duplicating the maxphyaddr logic. I'm paranoid something will come along and change the "effective" maxphyaddr and we'll forget all about the emulator, e.g. SEV, TME and paravirt XO all dance around maxphyaddr.