Re: [RFC PATCH V3 2/4] KVM: X86: Introduce role.glevel for level expanded pagetable

From: Paolo Bonzini
Date: Wed Apr 13 2022 - 12:04:04 EST


On 4/13/22 17:32, Sean Christopherson wrote:
Are we planning on removing direct?

I think so, it's redundant and the code almost always checks
direct||passthrough (which would be passthrough_delta > 0 with your scheme).

I'm ok dropping direct and rolling it into target_level, just so long as we add
helpers, e.g. IIUC they would be

static inline bool is_sp_direct(...)
{
return !sp->role.target_level;
}

static inline bool is_sp_direct_or_passthrough(...)
{
return sp->role.target_level != sp->role.level;
}

Yes of course. Or respectively:

return sp->role.passthrough_levels == s->role.level;

return sp->role.passthrough_levels > 0;

I'm not sure about a more concise name for the latter. Maybe sp_has_gpt(...) but I haven't thought it through very much.

Hmm, it's not a raw level though.

Hence the plural. :)

LOL, I honestly thought that was a typo. Making it plural sounds like it's passing
through to multiple levels.

I meant it as number of levels being passed through. I'll leave that to Jiangshan, either target_level or passthrough_levels will do for me.

Paolo