Re: [PATCHv2 02/12] x86/virt/tdx: Allocate page bitmap for Dynamic PAMT

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

 



>  /*
>   * Locate a NUMA node which should hold the allocation of the @tdmr
>   * PAMT.  This node will have some memory covered by the TDMR.  The
> @@ -522,7 +534,16 @@ static int tdmr_set_up_pamt(struct tdmr_info *tdmr,
>  	 * and the total PAMT size.
>  	 */
>  	tdmr_pamt_size = 0;
> -	for (pgsz = TDX_PS_4K; pgsz < TDX_PS_NR; pgsz++) {
> +	pgsz = TDX_PS_4K;
> +
> +	/* With Dynamic PAMT, PAMT_4K is replaced with a bitmap */
> +	if (tdx_supports_dynamic_pamt(&tdx_sysinfo)) {
> +		pamt_size[pgsz] = tdmr_get_pamt_bitmap_sz(tdmr);
> +		tdmr_pamt_size += pamt_size[pgsz];
> +		pgsz++;
> +	}

This is the wrong place to do this.

Hide it in tdmr_get_pamt_sz(). Don't inject it in the main code flow
here and complicate the for loop.




[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