Re: [PATCH v5 15/22] x86/virt/tdx: Allocate and set up PAMTs for TDMRs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux