lkml.org 
[lkml]   [2022]   [Jun]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH v5 15/22] x86/virt/tdx: Allocate and set up PAMTs for TDMRs
From
On 6/27/22 17:48, Xiaoyao Li wrote:
>>
>> I meant this:
>>
>> +       switch (level) {
>> +       case PG_LEVEL_4K:
>> +               page_size = 0;
>> +               break;
>>
>> Because TDX_PG_4K==page_size==0, and for this:
>>
>> +       case PG_LEVEL_2M:
>> +               page_size = 1;
>
> here we can just do
>
>     page_size = level - 1;
>
> or
>     
>     tdx_page_level = level - 1;
>
> yes, TDX's page level definition is one level smaller of Linux's
> definition.

Uhh. No.

The 'page_size' is in the kernel/TDX-module ABI. It can't change.
PG_LEVEL_* is just some random internal Linux enum. It *CAN* change.

There's a *MASSIVE* difference between the two. What you suggest will
probably actually work. But, it will work accidentally and may break in
horribly confusing ways in the future.

It's the difference between hacking something together and actually
writing code that will keep working for a long time. Please, take a
minute and reflect on this. Please.

\
 
 \ /
  Last update: 2022-06-28 19:08    [W:1.802 / U:0.672 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site