On 07/03/2024 9:40 pm, Vaishali Thakkar wrote:
> diff --git a/xen/arch/x86/hvm/svm/svmdebug.c b/xen/arch/x86/hvm/svm/svmdebug.c
> index 24358c6eea..f54b426fb3 100644
> --- a/xen/arch/x86/hvm/svm/svmdebug.c
> +++ b/xen/arch/x86/hvm/svm/svmdebug.c
> @@ -53,6 +53,8 @@ void svm_vmcb_dump(const char *from, const struct 
> vmcb_struct *vmcb)
>             vmcb->exitinfo1, vmcb->exitinfo2);
>      printk("np_ctrl = %#"PRIx64" guest_asid = %#x\n",
>             vmcb_get_np_ctrl(vmcb), vmcb_get_guest_asid(vmcb));
> +    printk("sev = %d sev_es = %d\n",
> +           vmcb_get_sev(vmcb), vmcb_get_sev_es(vmcb));

Hmm.  These are covered by the previous line printing all of np_ctrl. 
What about rearranging the previous line to be something like:

printk("asid: %#x, np_ctrl: %#"PRIx64" -%s%s%s\n",
    vmcb->_asid, vmcb->_np_ctrl,
    vmcb->_np ? " NP" : "",
    vmcb->_sev ? " SEV" : "",
    ...);

This is more compact (things like "guest" in "guest asid" is entirely
redundant), and provides both the raw _np_ctrl field and a bit-by-bit
decode on the same line, rather than having different parts of the info
on different lines and bools written out in longhand?

See xen/arch/x86/spec_ctrl.c: print_details() for a rather more complete
example of this style of printk() rendering for bits, including how to
tabulate it for better readability.

~Andrew

Reply via email to