[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v4 05/12] x86/xen: set MTRR state when running as Xen PV initial domain
- To: Juergen Gross <jgross@xxxxxxxx>, linux-kernel@xxxxxxxxxxxxxxx, x86@xxxxxxxxxx
- From: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>
- Date: Tue, 7 Mar 2023 16:47:50 -0500
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=dpG+xGKacmMnCBzoNJgYKrMwSCPsPFa88o6cy8WxAgs=; b=dRl5Hf/4Io3Rd70+DkSsYXPW2ZMmi7yCAN2caAjZPgF6sdQkUdqu8rJ1oD6UKzUUbaCteiYP3jt85cWkggkbR/FRzArLITiQMsqYl3Gb6/8Ijl/QDoRI8KVg+TeHcOTS+Hg9AoJ5AX+XC6w6sTlXXVyLBHP8MPNGJDGrMDyHgTLXBFB5KDHNjW7vPaI3nqf0c4GRigBW/GS50h5s/uCVxp9edm9hQ2AVVE39hDo2ZkCQSPfO0DHnTRJEW3cFXI98KjTec+Dk2C3BxRqgfEo1xw1tNSWqTrpujJRoP8KewnZZqGOudu6jUSLS7gY7EIOTJMRqnXwcQVP47y+GP3fCWg==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nfWOKFSAmtaGL3ovHzMKtdWVfD1pLII8hS7OJO6sUJf+rGJslb0WlDCpVmqgIQd+T3EebYexDxFM7BgShRy0wqVSxMdc4yT6aGRxlTqF9wk7GmPfhOdhwx4KFt4Ry4G+dzGXRALOVNl35ILZJ2aN4Cg32jUOmpyxb34bWkQ7LV4Ajah5rdLPXhR/k9QAk98GjPuLgaAg48pF/9TX4E4pBxs7Vy6fUOnIFKkBEn1iLPKeuM6DenN9PAbe2TbWU3ZrTXQMs2xUta9xVk85QJeTPVPWgDrQsshtBJU2NipsCnIv73SrrJWyMiHge+Se+xFveSu3XqOe8Ibiao95vYpekQ==
- Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>, Ingo Molnar <mingo@xxxxxxxxxx>, Borislav Petkov <bp@xxxxxxxxx>, Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>, "H. Peter Anvin" <hpa@xxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
- Delivery-date: Tue, 07 Mar 2023 21:48:35 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 3/6/23 11:34 AM, Juergen Gross wrote:
When running as Xen PV initial domain (aka dom0), MTRRs are disabled
by the hypervisor, but the system should nevertheless use correct
cache memory types. This has always kind of worked, as disabled MTRRs
resulted in disabled PAT, too, so that the kernel avoided code paths
resulting in inconsistencies. This bypassed all of the sanity checks
the kernel is doing with enabled MTRRs in order to avoid memory
mappings with conflicting memory types.
This has been changed recently, leading to PAT being accepted to be
enabled, while MTRRs stayed disabled. The result is that
mtrr_type_lookup() no longer is accepting all memory type requests,
but started to return WB even if UC- was requested. This led to
driver failures during initialization of some devices.
In reality MTRRs are still in effect, but they are under complete
control of the Xen hypervisor. It is possible, however, to retrieve
the MTRR settings from the hypervisor.
In order to fix those problems, overwrite the MTRR state via
mtrr_overwrite_state() with the MTRR data from the hypervisor, if the
system is running as a Xen dom0.
Fixes: 72cbc8f04fe2 ("x86/PAT: Have pat_enabled() properly reflect state when
running on Xen")
Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
Reviewed-by: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>
|