Re: [PATCH 4/7] KVM: x86: Add wrapper APIs to reset dirty/available register masks
From: Paolo Bonzini
Date: Wed Mar 11 2026 - 14:51:08 EST
On 3/11/26 14:31, Sean Christopherson wrote:
Not closely following this series and don't know this code well, butOh, yeah, I can do something like that. I originally misread the TDX code and
this API is very confusing for me tbh. Especially in comparison with
kvm_reset_dirty_registers().
Maybe rename this to kvm_clear_available_registers(), and pass in a
"clear_mask", then reverse the polarity:
vcpu->arch.regs_avail &= ~clear_mask;
thought it was explicitly setting regs_avail, and so came up with a roundabout
name. I didn't revisit the naming or the polarity of the param once I realized
all callers could use the same scheme.
No small part of me is tempted to turn it into a straigh "set" though, unless I'm
missing something, the whole &= business is an implementation quirk.
I like kvm_clear_available_registers() for this + removing the second argument completely for kvm_reset_dirty_registers().
Paolo