Received: by 10.192.165.148 with SMTP id m20csp1935749imm; Thu, 3 May 2018 07:46:25 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpq7MLeCLWvHKoiABFCp0PnckcsKCziELNaLtqkemOwo2z7iueDixWqn/FvEzA/AqrZPJ3B X-Received: by 2002:a17:902:41:: with SMTP id 59-v6mr24463770pla.345.1525358785073; Thu, 03 May 2018 07:46:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525358785; cv=none; d=google.com; s=arc-20160816; b=vBFvRDs79KA6BNBhifeP7mhpTFnb2X7Ggp8rU0xpCyirnNi5uyBltsgWwh4CjDnYji mn3TyYMajOrx49ZOEg/X9fRJ/QBHV7Q8MEm00n3g8livsiRUte0V4jl9m+fEpn5ZHjcf aHeI2RWhhPN9rAfrrZWJOE1SshkFpNEDSq8ddXudLAn9+xS9+uZtb7E1i2oc2LFj8L+n 9elOrFPhDEHe2qxnYwAPSRJlxcYKEeCiYxXWn+GXc6lVPplPyRQceLCXIXi1oo0c2Ex8 6R2iig8zCLZs0v/ifBiT7aDykhqfcEt9bDLvcnMxV4uOizq/8vRhgkCnqiOIL1Y1EnfN bdoA== 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=ZFlTWdQoyvjxZSHbxdRzkMrfdCfnHxpuE1OqdL5V5SnU5JYMH+mH7r7DS810p7C4sQ inPZLQBfdEapX/tZnzqynYlAH8gzWk42X/lNJR3UVs/M9Eo3MEwbEIqiFY40bJaIFN9g byLlla7RvChSv/k1aBtdodc/NmLJXbfFshdcTH8gm1pxdK/200NIoTalXT9PUssY29yv HPUWROrcCEMJgJvRUhq4TJtVimKIdDu9SG1j5qTeHz/eXifFeBrOJ9UFzhgRZO5/ermU 8CcEit34mt+vAF9chlG4xWitVhNhyA9JbgB4aFzTf3N0Iu5ZRSuWA2xnMrHNsr6RP6br yWJw== 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 a66-v6si14124412pla.313.2018.05.03.07.46.11; Thu, 03 May 2018 07:46:25 -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 S1751417AbeECOpy (ORCPT + 99 others); Thu, 3 May 2018 10:45:54 -0400 Received: from smtp.ctxuk.citrix.com ([185.25.65.24]:63202 "EHLO SMTP.EU.CITRIX.COM" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751050AbeECOpw (ORCPT ); Thu, 3 May 2018 10:45:52 -0400 X-IronPort-AV: E=Sophos;i="5.49,358,1520899200"; d="scan'208";a="72566471" From: Roger Pau Monne To: CC: Roger Pau Monne , Boris Ostrovsky , Juergen Gross , Subject: [PATCH 1/3] xen/pvh: enable and set default MTRR type Date: Thu, 3 May 2018 15:44:59 +0100 Message-ID: <20180503144459.61007-1-roger.pau@citrix.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180503143646.60747-1-roger.pau@citrix.com> References: <20180503143646.60747-1-roger.pau@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-ClientProxiedBy: AMSPEX02CAS02.citrite.net (10.69.22.113) To AMSPEX02CL02.citrite.net (10.69.22.126) 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