Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933634AbcCOCSv (ORCPT ); Mon, 14 Mar 2016 22:18:51 -0400 Received: from g4t3426.houston.hp.com ([15.201.208.54]:17195 "EHLO g4t3426.houston.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932809AbcCOCSs (ORCPT ); Mon, 14 Mar 2016 22:18:48 -0400 Message-ID: <1458011476.6393.327.camel@hpe.com> Subject: Re: [PATCH 1/2] x86/mm/pat: Change pat_disable() to emulate PAT table From: Toshi Kani To: "Luis R. Rodriguez" , Borislav Petkov Cc: "mingo@kernel.org" , "hpa@zytor.com" , "tglx@linutronix.de" , "jgross@suse.com" , "paul.gortmaker@windriver.com" , "x86@kernel.org" , "linux-kernel@vger.kernel.org" , xen-devel@lists.xenproject.org, boris.ostrovsky@oracle.com Date: Mon, 14 Mar 2016 21:11:16 -0600 In-Reply-To: <20160315002921.GG25147@wotan.suse.de> References: <1457671546-13486-1-git-send-email-toshi.kani@hpe.com> <1457671546-13486-2-git-send-email-toshi.kani@hpe.com> <20160311091229.GA4347@pd.tnic> <1457713660.6393.55.camel@hpe.com> <20160311155439.GF4312@pd.tnic> <1457724504.6393.151.camel@hpe.com> <20160312115544.GA23410@pd.tnic> <20160315002921.GG25147@wotan.suse.de> Content-Type: multipart/mixed; boundary="=-aVNuKP0eyAGslvgQcx/I" X-Mailer: Evolution 3.18.4 (3.18.4-1.fc23) Mime-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 9035 Lines: 150 --=-aVNuKP0eyAGslvgQcx/I Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit On Tue, 2016-03-15 at 01:29 +0100, Luis R. Rodriguez wrote: > I like this approach more as it stuff more PAT setup on its own type > of calls, but: > > On Sat, Mar 12, 2016 at 12:55:44PM +0100, Borislav Petkov wrote: > > diff --git a/arch/x86/kernel/cpu/mtrr/main.c > > b/arch/x86/kernel/cpu/mtrr/main.c > > index 10f8d4796240..5c442b4bd52a 100644 > > --- a/arch/x86/kernel/cpu/mtrr/main.c > > +++ b/arch/x86/kernel/cpu/mtrr/main.c > > @@ -759,8 +761,11 @@ void __init mtrr_bp_init(void) > >   } > >   } > >   > > - if (!mtrr_enabled()) > > + if (!__mtrr_enabled) { > >   pr_info("MTRR: Disabled\n"); > > + pat_disable("PAT disabled by MTRR"); > > + pat_setup(); > > + } > >  } > > This hunk would break PAT on Xen. Can you try the attached patches?  They apply on top of my original patch- set.  With this change, PAT code generally supports Xen, and the PAT init code in Xen is now removed.  If they look OK, I will reorganize the patch series. Thanks, -Toshi --=-aVNuKP0eyAGslvgQcx/I Content-Disposition: attachment; filename="03-pat-emu.patch" Content-Type: text/x-patch; name="03-pat-emu.patch"; charset="UTF-8" Content-Transfer-Encoding: base64 RnJvbTogVG9zaGkgS2FuaSA8dG9zaGkua2FuaUBocGUuY29tPgoKQWRkIHN1cHBvcnQgb2YgUEFU IGVtdWxhdGlvbiB0aGF0IG1hdGNoZXMgd2l0aCB0aGUgUEFUIE1TUi4KCi0tLQogYXJjaC94ODYv bW0vcGF0LmMgfCAgIDczICsrKysrKysrKysrKysrKysrKysrKysrKysrKysrKystLS0tLS0tLS0t LS0tLS0tLS0tLS0tCiAxIGZpbGUgY2hhbmdlZCwgNDMgaW5zZXJ0aW9ucygrKSwgMzAgZGVsZXRp b25zKC0pCgpkaWZmIC0tZ2l0IGEvYXJjaC94ODYvbW0vcGF0LmMgYi9hcmNoL3g4Ni9tbS9wYXQu YwppbmRleCAxZmY4YWE5Li41NjVhNDc4IDEwMDY0NAotLS0gYS9hcmNoL3g4Ni9tbS9wYXQuYwor KysgYi9hcmNoL3g4Ni9tbS9wYXQuYwpAQCAtNDAsNyArNDAsNyBAQAogc3RhdGljIGJvb2wgYm9v dF9jcHVfZG9uZTsKIAogc3RhdGljIGludCBfX3JlYWRfbW9zdGx5IF9fcGF0X2VuYWJsZWQgPS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LCBpdCBpcyByZWRpcmVjdGVkIHRv IFVDLSBwZXIKKwkJICogdGhlIGRlZmF1bHQgc2V0dXAgaW4gX19jYWNoZW1vZGUycHRlX3RibFtd LgorCQkgKi8KKwkJcGF0ID0gUEFUKDAsIFdCKSB8IFBBVCgxLCBXVCkgfCBQQVQoMiwgVUNfTUlO VVMpIHwgUEFUKDMsIFVDKSB8CisJCSAgICAgIFBBVCg0LCBXQikgfCBQQVQoNSwgV1QpIHwgUEFU KDYsIFVDX01JTlVTKSB8IFBBVCg3LCBVQyk7CisJfQogCiAJcGF0X2luaXRfY2FjaGVfbW9kZXMo cGF0KTsKIAotCWRpc2FibGVfaW5pdF9kb25lID0gMTsKKwllbXVfaW5pdF9kb25lID0gMTsKIH0K IAogdm9pZCBwYXRfaW5pdCh2b2lkKQpAQCAtMjgxLDcgKzI5NCw3IEBAIHZvaWQgcGF0X2luaXQo dm9pZCkKIAlzdHJ1Y3QgY3B1aW5mb194ODYgKmMgPSAmYm9vdF9jcHVfZGF0YTsKIAogCWlmICgh cGF0X2VuYWJsZWQoKSkgewotCQlwYXRfZGlzYWJsZV9pbml0KCk7CisJCXBhdF9lbXVfaW5pdCgp OwogCQlyZXR1cm47CiAJfQogCg== --=-aVNuKP0eyAGslvgQcx/I Content-Disposition: attachment; filename="04-xen-mtrr.patch" Content-Type: text/x-patch; name="04-xen-mtrr.patch"; charset="UTF-8" Content-Transfer-Encoding: base64 RnJvbTogVG9zaGkgS2FuaSA8dG9zaGkua2FuaUBocGUuY29tPgoKRGVsZXRlIHRoZSBQQVQgdGFi bGUgaW5pdGlhbGl6YXRpb24gY29kZSBmcm9tIFhlbiBhcyB0aGlzIGNhc2UKaXMgbm93IHN1cHBv cnRlZCBieSBQQVQuCgotLS0KIGFyY2gveDg2L2luY2x1ZGUvYXNtL210cnIuaCAgICAgfCAgICAy ICstCiBhcmNoL3g4Ni9rZXJuZWwvY3B1L210cnIvbWFpbi5jIHwgICAgNCArKy0tCiBhcmNoL3g4 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