Received: by 10.192.165.148 with SMTP id m20csp5333274imm; Wed, 9 May 2018 03:22:52 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqoBdBgYuQF24OYN94CCUuWC1splkcGvThM58mHZizh2JGFJR7TFmQOAJampg/RfLhBt2vH X-Received: by 2002:a63:69c3:: with SMTP id e186-v6mr35424855pgc.353.1525861372170; Wed, 09 May 2018 03:22:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525861372; cv=none; d=google.com; s=arc-20160816; b=S/Z/dqVvwkWFbIERhaamRQcszOWCzIbbagarD5DMYhjadiqfJ75qgmPTfDAKVY4E/U uJ7sakQ1hUljvCOemNKbzkwrEyLYbgLym19KkxbmUxjVfXrH7e0unYHENTRE/+SdCo0w 5yC7FSMKrLKREQHgEKlHSDxk19LavuWQWN+ZJXBjG/tE8aIY/i5+WWVD2zq0iZt/JKIR CXaUPv7NT9hc3drWTDLhuEaoNMwQQMvzKEBWqzepDLeIdZdvPHQXm8QZ6bEArIv1QfHY teZEmbfgxyvXJEi811tPzsaKxx5SC9oe6t3PuS6KKGGRtxAPTGeIjfI9i+hZIQ+9XxnU dSkQ== 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:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=al1JU80STj1c0UFcQMDMT4Yaj1rpool/7E3hL9B2pVo=; b=YvcRFtAs02ldimxMEXLEO7PD36nN+CkxEuKa/u/WqdeGygfJPIqEUqwYPYhzOTolXA X16p+O3FhH4dv/W2DmrlkESNJUFg1LDaXUSuM7cxFwg5H9rE6Ow8FveZDD9r05So74PZ eKThpi41rzRsWNHRwkcBZaScrmS8cOhWreeRAN5AAm5V/+EM8yBnoIjZRAvwNaIyeM1F wBqMUb+ikw0Y88OFY9EwMkwBv7JHJCbGBPbuZHw99YX7I3x+khfx5GzMs4s1w3DUvFvN rs0tSzxEuyNZlGDMBK3XK31FXzmZXlpOaF19MKcg+IMcrg4QumP+RXSx2AeQYN8ESUOU xDAw== 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 a2-v6si20773946pgq.278.2018.05.09.03.22.37; Wed, 09 May 2018 03:22:52 -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 S934302AbeEIKVr (ORCPT + 99 others); Wed, 9 May 2018 06:21:47 -0400 Received: from smtp03.citrix.com ([162.221.156.55]:16799 "EHLO SMTP03.CITRIX.COM" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934038AbeEIKVq (ORCPT ); Wed, 9 May 2018 06:21:46 -0400 X-IronPort-AV: E=Sophos;i="5.49,381,1520899200"; d="scan'208";a="54081117" From: Roger Pau Monne To: CC: Roger Pau Monne , Boris Ostrovsky , Juergen Gross , Subject: [PATCH v2 1/3] xen/pvh: enable and set default MTRR type Date: Wed, 9 May 2018 11:21:27 +0100 Message-ID: <20180509102129.14832-2-roger.pau@citrix.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180509102129.14832-1-roger.pau@citrix.com> References: <20180509102129.14832-1-roger.pau@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On PVH MTRR is not initialized by the firmware (because there's no firmware), so the kernel is started with MTRR disabled which means all memory accesses are UC. So far there have been no issues (ie: slowdowns) caused by this because PVH only supported DomU mode without passed-through devices, so Xen was using WB as the default memory type instead of UC. Fix this by enabling MTRR and setting the default type to WB. Linux will use PAT to set the actual memory cache attributes. Signed-off-by: Boris Ostrovsky Signed-off-by: Roger Pau Monné --- Cc: Boris Ostrovsky Cc: Juergen Gross Cc: xen-devel@lists.xenproject.org --- arch/x86/xen/enlighten_pvh.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/x86/xen/enlighten_pvh.c b/arch/x86/xen/enlighten_pvh.c index aa1c6a6831a9..e039d1809809 100644 --- a/arch/x86/xen/enlighten_pvh.c +++ b/arch/x86/xen/enlighten_pvh.c @@ -6,6 +6,7 @@ #include #include #include +#include #include #include @@ -98,6 +99,8 @@ void __init xen_prepare_pvh(void) xen_pvh = 1; + wrmsr_safe(MSR_MTRRdefType, 0x800 | MTRR_TYPE_WRBACK, 0); + msr = cpuid_ebx(xen_cpuid_base() + 2); pfn = __pa(hypercall_page); wrmsr_safe(msr, (u32)pfn, (u32)(pfn >> 32)); -- 2.17.0