Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1369145imm; Sun, 23 Sep 2018 02:35:31 -0700 (PDT) X-Google-Smtp-Source: ACcGV609jEbI7jHMdVwDC4AomSAab3EagobNcnKRuHpd4Fairz+sbgUOSjcMWIshcFzt/ADt007k X-Received: by 2002:a17:902:9696:: with SMTP id n22-v6mr5915378plp.212.1537695331246; Sun, 23 Sep 2018 02:35:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537695331; cv=none; d=google.com; s=arc-20160816; b=rmUjmjnF6ULtmSYUsbjRQLfiiJoiZsc2cZir4k2UvuyzOa6kZPXrg3/ur9t51zpTd4 w4vqWtCQ/zevBcGXdlMmVLeUJRbehgc++k1ze9A/kwdw/6AwfZGtAXPFcAovcuUVZgPF tzj2c1i9wjHro5g0J6slenbIRnO53+MUIWGR1iaLd7D33bpos0ZQYhpO/uM/c9k6jdZO hyhb/CqcHnBs2SV2djyZiEkLvZ7usfpjxkxublLmJcDkUb07kxGLIkpeZdzgLRCbvtrB LwRM5cc2FboiIANa8/yikVytovCEamFHJOea5BygpW7TQbf18+jcpu6ALnj5bju8M66L /WbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=yO7VMl0mf2yRaD575CmvcYkfkxd0c8v5BkoJGkMHdjs=; b=A8OMtdDMkQi/AnzNc0719NTHdMBq+eMc69Y9zrpIHzgIKrdSP5Q7NC8QJw3H0GMsZH VaU5S3UMkBpIDBMJYSRTADkNFxkAulp+TOO6amS9hY8YDj9WXW+SD+6zpbtxNqnyrQOW J+GStZmF9o0G0bL9Hx8LwAmRigLbo8V3xJ2Pw1nVgSMHhSNaUx9j22VBU3FrAdPAUoWu Rk1LAhxu6RM9mec9Rg68ty8eB3yfNBhsadJMCjpYjZPJVHRKK/zXTLOTkmXMGvX+Y80M qjqPhPxXhc2sF+g8JD7d4dCzA9ddv0fGEpjxKSBprrF+IkmucyQqpm5ib3gzUQ4BTOr1 WhwA== 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 c8-v6si5761833pgm.447.2018.09.23.02.35.15; Sun, 23 Sep 2018 02:35:31 -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 S1726376AbeIWPbX (ORCPT + 99 others); Sun, 23 Sep 2018 11:31:23 -0400 Received: from smtp21.cstnet.cn ([159.226.251.21]:47166 "EHLO cstnet.cn" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726135AbeIWPbW (ORCPT ); Sun, 23 Sep 2018 11:31:22 -0400 Received: from pw-vbox.higon.com (unknown [182.150.46.145]) by APP-01 (Coremail) with SMTP id qwCowAAHH0UZXqdbaTazDA--.35S2; Sun, 23 Sep 2018 17:34:22 +0800 (CST) From: Pu Wen To: bp@alien8.de, tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com, x86@kernel.org, thomas.lendacky@amd.com Cc: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, Pu Wen Subject: [PATCH v8 03/16] x86/cpu/mtrr: Support TOP_MEM2 and get MTRR number Date: Sun, 23 Sep 2018 17:34:16 +0800 Message-Id: <8246f81648d014601de3812ade40e85d9c50d9b3.1537533369.git.puwen@hygon.cn> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: X-CM-TRANSID: qwCowAAHH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o: psxzv046klw03qof0z/ Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The Hygon Dhyana CPU has a special magic MSR way to force WB for memory >4GB, and support TOP_MEM2. Therefore, it is necessary to add Hygon Dhyana support in amd_special_default_mtrr(). The number of variable MTRRs for Hygon is 2 as AMD's. Signed-off-by: Pu Wen Reviewed-by: Borislav Petkov --- arch/x86/kernel/cpu/mtrr/cleanup.c | 3 ++- arch/x86/kernel/cpu/mtrr/mtrr.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/cpu/mtrr/cleanup.c b/arch/x86/kernel/cpu/mtrr/cleanup.c index 765afd5..3668c5d 100644 --- a/arch/x86/kernel/cpu/mtrr/cleanup.c +++ b/arch/x86/kernel/cpu/mtrr/cleanup.c @@ -831,7 +831,8 @@ int __init amd_special_default_mtrr(void) { u32 l, h; - if (boot_cpu_data.x86_vendor != X86_VENDOR_AMD) + if (boot_cpu_data.x86_vendor != X86_VENDOR_AMD && + boot_cpu_data.x86_vendor != X86_VENDOR_HYGON) return 0; if (boot_cpu_data.x86 < 0xf) return 0; diff --git a/arch/x86/kernel/cpu/mtrr/mtrr.c b/arch/x86/kernel/cpu/mtrr/mtrr.c index 9a19c80..507039c 100644 --- a/arch/x86/kernel/cpu/mtrr/mtrr.c +++ b/arch/x86/kernel/cpu/mtrr/mtrr.c @@ -127,7 +127,7 @@ static void __init set_num_var_ranges(void) if (use_intel()) rdmsr(MSR_MTRRcap, config, dummy); - else if (is_cpu(AMD)) + else if (is_cpu(AMD) || is_cpu(HYGON)) config = 2; else if (is_cpu(CYRIX) || is_cpu(CENTAUR)) config = 8; -- 2.7.4