[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 2/8] p2m-pt: Avoid hard-coding Xen's PAT
- To: Demi Marie Obenour <demi@xxxxxxxxxxxxxxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- From: Andrew Cooper <Andrew.Cooper3@xxxxxxxxxx>
- Date: Tue, 6 Dec 2022 10:59:09 +0000
- Accept-language: en-GB, en-US
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.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=/2AzkgF4a+9AJ7YOzwxj2q0kZigtMfhoQ0TvOO2fbSU=; b=N60ejX7L0nKTGsgXaM5y0ZCPCxLPHQixI4PnV119MLAAlfGdW4aSlgXoTqyTMubGI5AXW0se7gc0tWpkxnckysoognsbOjIOoYHyyiN59uKQUYxGK09Ts1xlpQn3yq+/FOgqfr5Y24L8XY2yYJNnmldAD5Mw0tfdqPYlrbKXFZ91LKLxYnvuqoPSyVbbWxJaaTpapLqk184s1VW8HLpXlvBm8rElhAG16unbp1uVLFztnfhDlhdtqOZwjrfwplz3uML2tnfoGWsrFY4U+bZoV3ZK8QnOXBCkjoQdeymSdwv1X23InxycF7tfJWhCGWPkPinANRGhMc2O/zmsM//a2w==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=T77HbFJ0metX9KTLqmAwbcmaMcRvFmn/b/YYwmrY++y5Y87PLTdylNC7StLXPz51zpzDn6iBip2cZoX3f4Cm2rD5beO4MXWxS8Wdrp6W+QTHeZ3+zmoBHKyDxTGHrno5rrC0shVpUzLVZpj0a+wQX7UWsQ+sDuOIUJvu1d3Hakl8zcwy5cF8gn1YnVwxRNC9s38wR7BsFQWiRXzZxy4ovnQkmYtDCjO651Y6mrmfWv6uoku/5S1j7v7Y+lGr6qFaPjeTpuO8CdBBXxKwbD6phYAZIgkC2o+EyYLoexOH6rU4Ezj7A/QVSbqISDPAt/vA1keeE4haycrLnXHOry/pug==
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
- Cc: Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Roger Pau Monne <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, George Dunlap <George.Dunlap@xxxxxxxxxx>, "Tim (Xen.org)" <tim@xxxxxxx>
- Delivery-date: Tue, 06 Dec 2022 10:59:38 +0000
- Ironport-data: A9a23:KtP+H6oVY3o6V9hfEmukDps56/BeBmLvZBIvgKrLsJaIsI4StFCzt garIBmBOPiLMWfwf9EkOoW2/R4O75CEyYJhTQVtrCkwFCNH85uZCYyVIHmrMnLJJKUvbq7FA +Y2MYCccZ9uHhcwgj/3b9ANeFEljfngqoLUUbKCYWYpAFc+E0/NsDo788YhmIlknNOlNA2Ev NL2sqX3NUSsnjV5KQr40YrawP9UlKm06W1wUmAWP6gR5gaEzydNVvrzGInqR5fGatgMdgKFb 76rIIGRpgvx4xorA9W5pbf3GmVirmn6ZFXmZtJ+AsBOszAazsAA+v9T2Mk0MC+7vw6hjdFpo OihgLTrIesf0g8gr8xGO/VQO3kW0aSrY9YrK1Dn2SCY5xWun3cBX5yCpaz5VGEV0r8fPI1Ay RAXAGAEMC2gl+Sx+7iyT8c23e57dcbNLapK7xmMzRmBZRonabbqZvyToPR/hXI3jM0IGuvCb c0EbzYpdA7HfxBEJlYQDtQ5gfusgX78NTZfrTp5p4JuuzSVkFM3jearaYWLEjCJbZw9ckKwj 2TK5WnmR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qDiPyGPQE0n15LImYRUPuTLH/ KofJ5GCf7qKmXjXY5Pwg3lQpFXbX0TStcctNo3U0+H5sjLNorpvOrGd+u7HsunLR80HmfkRn cTVjn6I8tNqkitR3/jmRDUH2jgf0TulKgAZ5QyP9JjvLTlGrc8wTT9027Jl/1jAQcywpAebQ 95PK7tlL+9qC2/4XvIhl8ZTyZgMg==
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
- Thread-index: AQHZCSwIzli/2Ant/U6BsahXUdEmfK5gsTCA
- Thread-topic: [PATCH 2/8] p2m-pt: Avoid hard-coding Xen's PAT
On 06/12/2022 04:33, Demi Marie Obenour wrote:
> This makes the code much easier to understand.
>
> Signed-off-by: Demi Marie Obenour <demi@xxxxxxxxxxxxxxxxxxxxxx>
> ---
> xen/arch/x86/mm/p2m-pt.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/xen/arch/x86/mm/p2m-pt.c b/xen/arch/x86/mm/p2m-pt.c
> index
> eaba2b0fb4e6830f52b7d112fba8175dfe6d2770..cd1af33b6772ab1016e8d4c3284a6bc5d282869d
> 100644
> --- a/xen/arch/x86/mm/p2m-pt.c
> +++ b/xen/arch/x86/mm/p2m-pt.c
> @@ -99,13 +99,13 @@ static unsigned long p2m_type_to_flags(const struct
> p2m_domain *p2m,
> return flags | P2M_BASE_FLAGS | _PAGE_RW | _PAGE_NX_BIT;
> case p2m_mmio_direct:
> if ( !rangeset_contains_singleton(mmio_ro_ranges, mfn_x(mfn)) )
> - flags |= _PAGE_RW;
> + flags |= _PAGE_RW | _PAGE_UCM;
> else
> {
> - flags |= _PAGE_PWT;
> + flags |= _PAGE_UC;
> ASSERT(!level);
> }
> - return flags | P2M_BASE_FLAGS | _PAGE_PCD;
> + return flags | P2M_BASE_FLAGS;
I agree that this is a correct transformation of the logic, but the
logic cannot possibly be correct in the first place.
The read-only-ness of the MMIO range has no legitimate bearing on UC vs
UC-. I have a feeling this is another attempt to control mixed
cacheability - the HVM side cleanup from XSA-402 is still very much pending.
I'm tempted to R-by and commit the patch, with a note in the commit
message saying that the transformation is correct but that it highlights
that the pre-existing logic is suspect.
~Andrew
|