forked from QubesOS/qubes-vmm-xen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
patch-0004-efi-Avoid-hard-coding-the-various-PAT-constants.patch
57 lines (51 loc) · 2.42 KB
/
patch-0004-efi-Avoid-hard-coding-the-various-PAT-constants.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
From 6c83c7bf17a85ecae8e1e7b99a8a39de983bf8dd Mon Sep 17 00:00:00 2001
Message-Id: <6c83c7bf17a85ecae8e1e7b99a8a39de983bf8dd.1671771766.git.demi@invisiblethingslab.com>
In-Reply-To: <[email protected]>
References: <[email protected]>
From: Demi Marie Obenour <[email protected]>
Date: Thu, 15 Dec 2022 17:04:40 +0100
Subject: [PATCH 04/10] efi: Avoid hard-coding the various PAT constants
Cc: Marek Marczykowski-Górecki <[email protected]>
This makes the code much easier to understand, and avoids problems if
Xen's PAT ever changes in the future.
Signed-off-by: Demi Marie Obenour <[email protected]>
Reviewed-by: Jan Beulich <[email protected]>
---
xen/common/efi/boot.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c
index bb3369f8d35d85556cc8d6b25b7b0934320f7372..ee78630914f8901abb08917806ac41b638a130ce 100644
--- a/xen/common/efi/boot.c
+++ b/xen/common/efi/boot.c
@@ -1737,23 +1737,23 @@ void __init efi_init_memory(void)
emfn = PFN_UP(desc->PhysicalStart + len);
if ( desc->Attribute & EFI_MEMORY_WB )
- /* nothing */;
+ prot |= _PAGE_WB;
else if ( desc->Attribute & EFI_MEMORY_WT )
- prot |= _PAGE_PWT | MAP_SMALL_PAGES;
+ prot |= _PAGE_WT | MAP_SMALL_PAGES;
else if ( desc->Attribute & EFI_MEMORY_WC )
- prot |= _PAGE_PAT | MAP_SMALL_PAGES;
+ prot |= _PAGE_WC | MAP_SMALL_PAGES;
else if ( desc->Attribute & (EFI_MEMORY_UC | EFI_MEMORY_UCE) )
- prot |= _PAGE_PWT | _PAGE_PCD | MAP_SMALL_PAGES;
+ prot |= _PAGE_UC | MAP_SMALL_PAGES;
else if ( efi_bs_revision >= EFI_REVISION(2, 5) &&
(desc->Attribute & EFI_MEMORY_WP) )
- prot |= _PAGE_PAT | _PAGE_PWT | MAP_SMALL_PAGES;
+ prot |= _PAGE_WP | MAP_SMALL_PAGES;
else
{
printk(XENLOG_ERR "Unknown cachability for MFNs %#lx-%#lx%s\n",
smfn, emfn - 1, efi_map_uc ? ", assuming UC" : "");
if ( !efi_map_uc )
continue;
- prot |= _PAGE_PWT | _PAGE_PCD | MAP_SMALL_PAGES;
+ prot |= _PAGE_UC | MAP_SMALL_PAGES;
}
if ( desc->Attribute & (efi_bs_revision < EFI_REVISION(2, 5)
--
Sincerely,
Demi Marie Obenour (she/her/hers)
Invisible Things Lab