Re: [PATCH v7 14/20] x86/virt/tdx: Set up reserved areas for all TDMRs

From: Dave Hansen
Date: Mon Nov 28 2022 - 08:20:35 EST


On 11/28/22 01:14, Huang, Kai wrote:
> On Wed, 2022-11-23 at 15:39 -0800, Dave Hansen wrote:
...
>> /*
>>  * Go through tdx_memlist to find holes between memory areas. If any of
>>  * those holes fall within @tdmr, set up a TDMR reserved area to cover
>>  * the hole.
>>  */
>> static int tdmr_populate_rsvd_holes(struct list_head *tdx_memlist,
>> struct tdmr_info *tdmr,
>> int *rsvd_idx)
>
> Thanks!
>
> Should I also change below function 'tdmr_set_up_pamt_rsvd_areas()' to, i.e.
> tdmr_populate_rsvd_pamts()?
>
> Actually, there are two more functions in this patch: tdmr_set_up_rsvd_areas()
> and tdmrs_set_up_rsvd_areas_all(). Should I also change them to
> tdmr_populate_rsvd_areas() and tdmrs_populate_rsvd_areas_all()?

I don't know. I'll look at the naming again once I see it all together.

>> but I also get the feeling that 'prev_end' is a crummy variable name. I
>> don't have any better suggestions at the moment.
>>
>>> + list_for_each_entry(tmb, &tdx_memlist, list) {
>>> + u64 start, end;
>>> +
>>> + start = tmb->start_pfn << PAGE_SHIFT;
>>> + end = tmb->end_pfn << PAGE_SHIFT;
>>> +
>>
>> More alignment opportunities:
>>
>> start = tmb->start_pfn << PAGE_SHIFT;
>> end = tmb->end_pfn << PAGE_SHIFT;
>
> Should I use PFN_PHYS()? Then looks we don't need this alignment.

Sure.