lkml.org 
[lkml]   [2022]   [Mar]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCHv6 05/30] x86/tdx: Exclude shared bit from __PHYSICAL_MASK
Date
On Wed, Mar 16 2022 at 05:08, Kirill A. Shutemov wrote:
> @@ -82,6 +82,14 @@ void __init tdx_early_init(void)
>
> cc_set_vendor(CC_VENDOR_INTEL);
>
> + /*
> + * All bits above GPA width are reserved and kernel treats shared bit
> + * as flag, not as part of physical address.
> + *
> + * Adjust physical mask to only cover valid GPA bits.
> + */
> + physical_mask &= GENMASK_ULL(gpa_width - 2, 0);
> +

Hrm. I forgot about the second use case for gpa_width, but my comment
about ordering still stands. OTOH:

GENMASK_ULL(gpa_width - 2, 0) == BIT_UL(gpa_width - 1) - 1

right? So you really can consolidate on the fact that cc_mask is a
single bit which is above the guests physical address space boundary.

I.e. make the code tell the story instead of adding lengthy comments
explaining the obfuscation.

Thanks,

tglx

\
 
 \ /
  Last update: 2022-03-17 01:16    [W:0.488 / U:2.312 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site