From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56409) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bmocd-00070u-CV for qemu-devel@nongnu.org; Wed, 21 Sep 2016 17:00:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bmocZ-0000Ki-6z for qemu-devel@nongnu.org; Wed, 21 Sep 2016 17:00:02 -0400 Received: from mail-yw0-f180.google.com ([209.85.161.180]:34744) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bmocZ-0000KZ-2D for qemu-devel@nongnu.org; Wed, 21 Sep 2016 16:59:59 -0400 Received: by mail-yw0-f180.google.com with SMTP id g192so75530632ywh.1 for ; Wed, 21 Sep 2016 13:59:58 -0700 (PDT) Sender: Richard Henderson References: <1474482404-15678-1-git-send-email-ehabkost@redhat.com> <1474482404-15678-6-git-send-email-ehabkost@redhat.com> <9930bdaf-5f7e-ccf8-636a-78e56f21131c@twiddle.net> <20160921201432.GQ3233@thinpad.lan.raisama.net> From: Richard Henderson Message-ID: Date: Wed, 21 Sep 2016 13:58:55 -0700 MIME-Version: 1.0 In-Reply-To: <20160921201432.GQ3233@thinpad.lan.raisama.net> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 5/6] target-i386: Automatically set level/xlevel/xlevel2 when needed List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eduardo Habkost Cc: qemu-devel@nongnu.org, Brijesh Singh , Bandan Das , Paolo Bonzini , Igor Mammedov On 09/21/2016 01:14 PM, Eduardo Habkost wrote: > On Wed, Sep 21, 2016 at 12:53:08PM -0700, Richard Henderson wrote: >> On 09/21/2016 11:26 AM, Eduardo Habkost wrote: >>> + /* Set cpuid_*level* based on cpuid_min_*level, if not explicitly set */ >>> + if (!env->cpuid_level) { >>> + env->cpuid_level = env->cpuid_min_level; >>> + } >>> + if (!env->cpuid_xlevel) { >>> + env->cpuid_xlevel = env->cpuid_min_xlevel; >>> + } >>> + if (!env->cpuid_xlevel2) { >>> + env->cpuid_xlevel2 = env->cpuid_min_xlevel2; >>> } >> >> Why are we not bounding them by MIN, if it's really a minimum? > > Not sure I understand what you mean. Do you mean silently > changing the value even if it was explicitly set by the user? You're changing it if the user explicitly set the level to 0, aren't you? Or is that merely an oversight and you really need the levels defaulted to some magic value like -1? >>> + /* Enable auto level-increase for CPUID[7].ECX features */ >>> + bool cpuid_auto_level_7_0_ecx; >>> + >>> + /* Enable auto level-increase for CPUID[6] features */ >>> + bool cpuid_auto_level_6; >> >> Why two variables? Seems like only one is needed for backward >> compatibility. > > It's true that we don't really need two variables to implement > pc-2.7 compatibility. I just implemented it this way because > having two separate variables looks clearer to me. I wouldn't > know how I would name the variable if it controlled both > CPUID[7].ECX and CPUID[6] at the same time (any suggestions?). cpuid_auto_level_compat(_27)? r~