Re: [PATCH 06/21] KVM: TDX: Add accessors VMX VMCS helpers

From: Paolo Bonzini
Date: Tue Sep 10 2024 - 06:49:00 EST


On 9/9/24 23:29, Edgecombe, Rick P wrote:
Maybe a bit large when inlined?  Maybe

        if (unlikely(err))
                tdh_vp_wr_failed(tdx, field, bit, err);

and add tdh_vp_wr_failed to tdx.c.
There is a tiny bit of difference between the messages:
pr_err("TDH_VP_WR["#uclass".0x%x] = 0x%llx failed: 0x%llx\n", ...
pr_err("TDH_VP_WR["#uclass".0x%x] |= 0x%llx failed: 0x%llx\n", ...
pr_err("TDH_VP_WR["#uclass".0x%x] &= ~0x%llx failed: 0x%llx\n", ...

We can parameterize that part of the message, but it gets a bit tortured. Or
just lose that bit of detail. We can take a look. Thanks.

Yes, you can:

1) have three different functions for the failure

2) leave out the value part

3) pass the mask as well to tdh_vp_wr_failed() and use it to deduce the =/|=/&= part, like

if (!~mask)
op = "=";
else if (!value)
op = "&= ~", value = mask;
else if (value == mask)
op = "|=";
else
op = "??, value = ";

Paolo