lkml.org 
[lkml]   [2019]   [Dec]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v2 1/3] KVM: x86: assign two bits to track SPTE kinds
From
Date
On 12/12/19 01:29, Sean Christopherson wrote:
>> */
>> -#define MMIO_SPTE_GEN_MASK GENMASK_ULL(18, 0)
>> +#define MMIO_SPTE_GEN_MASK GENMASK_ULL(17, 0)
>>
>> #define MMIO_SPTE_GEN_LOW_START 3
>> #define MMIO_SPTE_GEN_LOW_END 11
>> #define MMIO_SPTE_GEN_LOW_MASK GENMASK_ULL(MMIO_SPTE_GEN_LOW_END, \
>> MMIO_SPTE_GEN_LOW_START)
>>
>> -#define MMIO_SPTE_GEN_HIGH_START 52
>> -#define MMIO_SPTE_GEN_HIGH_END 61
>> +/* Leave room for SPTE_SPECIAL_MASK. */
>> +#define MMIO_SPTE_GEN_HIGH_START PT64_SECOND_AVAIL_BITS_SHIFT
> I'd rather have GEN_HIGH_START be an explicit bit number and then add
> a BUILD_BUG_ON(GEN_HIGH_START < PT64_SECOND_AVAIL_BITS_SHIFT) to ensure
> the MMIO gen doesn't overlap other stuff. That way we get a build error
> if someone changes PT64_SECOND_AVAIL_BITS_SHIFT, otherwise the MMIO gen
> will end up who knows where and probably overwrite NX or EPT.SUPPRESS_VE.
>

Fair enough. While at it I'll also add MMIO_SPTE_GEN_BITS (
MMIO_SPTE_GEN_LOW_END - MMIO_SPTE_GEN_LOW_START + 1
+ MMIO_SPTE_GEN_HIGH_END - MMIO_SPTE_GEN_HIGH_START + 1) and use it in
MMIO_SPTE_GEN_MASK.

Paolo

\
 
 \ /
  Last update: 2019-12-12 01:33    [W:0.055 / U:0.800 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site