lkml.org 
[lkml]   [2021]   [Dec]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v7 10/45] x86/sev: Add support for hypervisor feature VMGEXIT
On Wed, Nov 10, 2021 at 04:06:56PM -0600, Brijesh Singh wrote:
> +/*
> + * The hypervisor features are available from GHCB version 2 onward.
> + */
> +static bool get_hv_features(void)
> +{
> + u64 val;
> +
> + sev_hv_features = 0;
> +
> + if (ghcb_version < 2)
> + return false;
> +
> + sev_es_wr_ghcb_msr(GHCB_MSR_HV_FT_REQ);
> + VMGEXIT();
> +
> + val = sev_es_rd_ghcb_msr();
> + if (GHCB_RESP_CODE(val) != GHCB_MSR_HV_FT_RESP)
> + return false;
> +
> + sev_hv_features = GHCB_MSR_HV_FT_RESP_VAL(val);
> +
> + return true;
> +}

I still don't like this.

This is more of that run-me-in-the-exception-handler thing while this is
purely feature detection stuff which needs to be done exactly once on
init.

IOW, that stanza

if (!sev_es_negotiate_protocol())
sev_es_terminate(SEV_TERM_SET_GEN, GHCB_SEV_ES_PROT_UNSUPPORTED);

should be called once in sev_enable() for the decompressor kernel and
once in sev_es_init_vc_handling() for kernel proper.

Then you don't need to do any of that sev_hv_features = 0 thing but
detect them exactly once and query them as much as you can.

Thx.

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette

\
 
 \ /
  Last update: 2021-12-02 18:53    [W:0.978 / U:0.708 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site