On 07.06.2024 11:40, Sergiy Kibrik wrote:
> 07.06.24 10:50, Jan Beulich:
>> On 07.06.2024 09:25, Jan Beulich wrote:
>>> On 03.06.2024 13:09, Sergiy Kibrik wrote:
>>>> @@ -38,9 +34,13 @@ static inline bool altp2m_active(const struct domain *d)
>>>>   }
>>>>   
>>>>   /* Only declaration is needed. DCE will optimise it out when linking. */
>>>> -uint16_t altp2m_vcpu_idx(const struct vcpu *v);
>>>>   void altp2m_vcpu_disable_ve(struct vcpu *v);
>>>>   
>>>>   #endif
>>>>   
>>>> +static inline uint16_t altp2m_vcpu_idx(const struct vcpu *v)
>>>> +{
>>>> +    return altp2m_active(v->domain) ? vcpu_altp2m(v).p2midx : 0;
>>>> +}
>>>
>>> While perhaps okay this way as a first step,
>>
>> Hmm, or maybe not. 0 is a valid index, and hence could be misleading
>> at call sites.
> 
> I'm returning 0 index here because implementation of 
> p2m_get_mem_access() for x86 & ARM expects it to be 0 when altp2m not 
> active or not implemented.

Tamas, considering the comment in x86'es p2m_get_mem_access(), what purpose
are d->arch.altp2m_p2m[0] and d->arch.altp2m_eptp[0] then? In case it indeed
is unused, why would p2m_init_altp2m() set up slot 0 in the first place?

Jan

Reply via email to