On Wed, 2014-08-06 at 19:33 +0300, Mihai Caraman wrote:
> @@ -390,19 +400,30 @@ static void kvmppc_core_vcpu_free_e500mc(struct 
> kvm_vcpu *vcpu)
>  
>  static int kvmppc_core_init_vm_e500mc(struct kvm *kvm)
>  {
> -     int lpid;
> +     int i, lpid;
>  
> -     lpid = kvmppc_alloc_lpid();
> -     if (lpid < 0)
> -             return lpid;
> +     /* The lpid pool supports only 2 entries now */
> +     if (threads_per_core > 2)
> +             return -ENOMEM;
> +
> +     /* Each VM allocates one LPID per HW thread index */
> +     for (i = 0; i < threads_per_core; i++) {
> +             lpid = kvmppc_alloc_lpid();
> +             if (lpid < 0)
> +                     return lpid;
> +
> +             kvm->arch.lpid_pool[i] = lpid;
> +     }

Wouldn't it be simpler to halve the size of the lpid pool that the
allocator sees, and just OR in the high bit based on the low bit of the
cpu number?

-Scott


--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to