Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2121889imm; Mon, 3 Sep 2018 20:04:18 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbodC8ugCyiqb7FFrXRg4+B118h0g0/WU9MvjLPmpbQ7atTuD9kQXLtT8ZL+Wv3VaU21Yoa X-Received: by 2002:a63:eb53:: with SMTP id b19-v6mr29223724pgk.371.1536030258825; Mon, 03 Sep 2018 20:04:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536030258; cv=none; d=google.com; s=arc-20160816; b=LZXwZX2LeCm9oH+EivdA0qu//vinZmtm+aC1MZsoUU9XEP4B/hLjZp/1WJotOSRv7J fe1lfDgk3lxavIccLqdqbqKYnjIO1TdOuSYMNmVlscazfJ/z8PT2JHiaiYSSwlnLcPsX g3F49XMk7q6NeOY/xTZaiAFaCjHapfYOwl+51xo+IgfAsQejZRqJ4WMPJUbDHjuUFZlp Sei6HvV4ya2DjkCJMC3xSjEIJUTPkoapD3z8/QbYF8e0ab4LgsnGfgcZbT+tLyj9PV2K W2xlKH1jMvA2LU1sH7OA3QPUXH+V75ck5os9eUp7zD8uantgSJW0KDJqSCGj5d6W/+Ok poNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:references:cc:to:subject:from:arc-authentication-results; bh=YFI1DKJgUHAYLePCZ9pP24GOryLgNlAUaXJHUDY1/j0=; b=tvi+AHsd0uLHSpFlxAxzjaGhxi6DNUYxFvhootILHPOMnN1yMS7xEOa1+qflP/SZDD D4nfaBr3yEJE5vBqRAWZCHk7YbF/DC32m2sRl0EDwGEP4qARCoOWyflqvhuQvZdq3IL+ SQCjLnA6DoQ+Rm+Xi6frpOZy8U8OEFhR0/nD/jz0HTFp94f8wmnTtLzcCmzt4CNc40ZO GOurnnhSxB1p1m2nYNwbYEJPv9vbJq6sILyt3BwYLPEp+NPkUj9f/77l2tbr5Es3ovRb JvN5wQ/mcgsltwT/nqLYP+vo2CWMnBc2K2k4bit+tGqfvf+pE5ooqoHTGE2SoCAHNp0s 6rgA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e37-v6si21776625plb.313.2018.09.03.20.04.03; Mon, 03 Sep 2018 20:04:18 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726168AbeIDHZ7 (ORCPT + 99 others); Tue, 4 Sep 2018 03:25:59 -0400 Received: from smtp20.cstnet.cn ([159.226.251.20]:40228 "EHLO cstnet.cn" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725911AbeIDHZ7 (ORCPT ); Tue, 4 Sep 2018 03:25:59 -0400 Received: from [172.20.20.131] (unknown [182.150.46.145]) by APP-10 (Coremail) with SMTP id tACowAC3je_T9Y1bYE5IBw--.12281S2; Tue, 04 Sep 2018 11:02:44 +0800 (CST) From: Pu Wen Subject: Re: [PATCH v5 03/16] x86/mtrr: get MTRR number and support TOP_MEM2 To: Borislav Petkov Cc: tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com, x86@kernel.org, thomas.lendacky@amd.com, pbonzini@redhat.com, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org References: <36ea05160d886ebf8d4a645c0fe8efdc9d6760c3.1535459013.git.puwen@hygon.cn> <20180903190438.GF10249@zn.tnic> Message-ID: <946157a5-fdb2-a45a-63aa-97e9d602e6f0@hygon.cn> Date: Tue, 4 Sep 2018 11:02:41 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20180903190438.GF10249@zn.tnic> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-CM-TRANSID: tACowAC3je_T9Y1bYE5IBw--.12281S2 X-Coremail-Antispam: 1UD129KBjvdXoWrtr17ZFyrZr1kCFyktF43Jrb_yoWDCFb_ur yUCr15t3yqya1FqrZxGr45Jw43Jws09rnY9FyjqrWUCr1fAFy5GanrtrWDKrn2qa1fJw4q kF4vkas09w42vjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUb2kYjsxI4VWDJwAYFVCjjxCrM7AC8VAFwI0_Gr0_Xr1l1xkIjI8I 6I8E6xAIw20EY4v20xvaj40_Wr0E3s1l1IIY67AEw4v_Jr0_Jr4l8cAvFVAK0II2c7xJM2 8CjxkF64kEwVA0rcxSw2x7M28EF7xvwVC0I7IYx2IY67AKxVWUJVWUCwA2z4x0Y4vE2Ix0 cI8IcVCY1x0267AKxVWUJVW8JwA2z4x0Y4vEx4A2jsIE14v26r1j6r4UM28EF7xvwVC2z2 80aVCY1x0267AKxVWUJVW8JwAS0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC0VAK zVAqx4xG6I80ewAv7VC0I7IYx2IY67AKxVWUAVWUtwAv7VC2z280aVAFwI0_Gr0_Cr1lOx 8S6xCaFVCjc4AY6r1j6r4UM4x0Y48IcVAKI48JMxk0xIA0c2IEe2xFo4CEbIxvr21l42xK 82IYc2Ij64vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJVWUGw C20s026x8GjcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r1q6r43MIIYrxkI7VAKI48J MIIF0xvE2Ix0cI8IcVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2IY6xkF7I0E14v26r1j6r4UMI IF0xvE42xK8VAvwI8IcIk0rVWrZr1j6s0DMIIF0xvEx4A2jsIE14v26r1j6r4UMIIF0xvE x4A2jsIEc7CjxVAFwI0_Jr0_GrUvcSsGvfC2KfnxnUUI43ZEXa7IU89ID7UUUUU== X-Originating-IP: [182.150.46.145] X-CM-SenderInfo: psxzv046klw03qof0z/ Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018/9/4 3:04, Borislav Petkov wrote: > It was "Hygon Dhyana" before now "Hygon" only. Can we agree on the > naming nomenclature and stick with it. OK, agree on it. ... >> - if (!((boot_cpu_data.x86_vendor == X86_VENDOR_AMD) && >> - (boot_cpu_data.x86 >= 0x0f))) >> + if (!((boot_cpu_data.x86_vendor == X86_VENDOR_AMD && >> + boot_cpu_data.x86 >= 0x0f) || >> + boot_cpu_data.x86_vendor == X86_VENDOR_HYGON)) > > Why are you even touching this statement? The function returns early on > !X86_VENDOR_AMD. The statement is briefly equal to !(X86_VENDOR_AMD || X86_VENDOR_HYGON). So the function will not return early on !X86_VENDOR_AMD. :-) Also the statement can be changed to: + if (!(boot_cpu_data.x86_vendor == X86_VENDOR_AMD && + boot_cpu_data.x86 >= 0x0f) && + !(boot_cpu_data.x86_vendor == X86_VENDOR_HYGON)) or: + if ((boot_cpu_data.x86_vendor != X86_VENDOR_AMD || + boot_cpu_data.x86 < 0x0f) && + (boot_cpu_data.x86_vendor != X86_VENDOR_HYGON)) Which statement is better? Thanks, Pu Wen