Skip to content

Commit ad7b572

Browse files
committed
xen/arch/x86/intel_txt.c: allow to-be-reserved-mem to be unlisted
Signed-off-by: Sergii Dmytruk <[email protected]>
1 parent 3ea3f9c commit ad7b572

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

xen/arch/x86/intel_txt.c

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,29 @@ static int __init reserve_e820(struct e820map *e820, uint64_t s, uint64_t e)
3939
{
4040
uint64_t rs = e820->map[i].addr;
4141
uint64_t re = rs + e820->map[i].size;
42+
43+
/* The entry includes the range. */
4244
if ( s >= rs && e <= re )
4345
break;
46+
47+
/* The entry intersects the range. */
48+
if ( e > rs && s < re )
49+
{
50+
/* Fatal failure. */
51+
return 0;
52+
}
4453
}
4554

46-
if ( i != e820->nr_map && e820->map[i].type == E820_RESERVED )
55+
/*
56+
* If the range is not included by any entry and no entry intersects it,
57+
* then it's not listed in the memory map. Consider this case as a success
58+
* since we're only preventing RAM from being used and unlisted range should
59+
* not be used.
60+
*/
61+
if ( i == e820->nr_map )
62+
return 1;
63+
64+
if ( e820->map[i].type == E820_RESERVED )
4765
{
4866
/* Nothing to do, the range is already covered as reserved. */
4967
return 1;

0 commit comments

Comments
 (0)