lkml.org 
[lkml]   [2020]   [May]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3 54/75] x86/sev-es: Handle DR7 read/write events
On Tue, Apr 28, 2020 at 05:17:04PM +0200, Joerg Roedel wrote:
> +static enum es_result vc_handle_dr7_write(struct ghcb *ghcb,
> + struct es_em_ctxt *ctxt)
> +{
> + struct sev_es_runtime_data *data = this_cpu_read(runtime_data);
> + long val, *reg = vc_insn_get_rm(ctxt);
> + enum es_result ret;
> +
> + if (!reg)
> + return ES_DECODE_FAILED;
> +
> + val = *reg;
> +
> + /* Upper 32 bits must be written as zeroes */
> + if (val >> 32) {
> + ctxt->fi.vector = X86_TRAP_GP;
> + ctxt->fi.error_code = 0;
> + return ES_EXCEPTION;
> + }
> +
> + /* Clear out other reservered bits and set bit 10 */

"reserved"

> + val = (val & 0xffff23ffL) | BIT(10);
> +
> + /* Early non-zero writes to DR7 are not supported */
> + if (!data && (val & ~DR7_RESET_VALUE))
> + return ES_UNSUPPORTED;
> +
> + /* Using a value of 0 for ExitInfo1 means RAX holds the value */
> + ghcb_set_rax(ghcb, val);
> + ret = sev_es_ghcb_hv_call(ghcb, ctxt, SVM_EXIT_WRITE_DR7, 0, 0);
> + if (ret != ES_OK)
> + return ret;
> +
> + if (data)
> + data->dr7 = val;

Are we still returning ES_OK if !data?

> +
> + return ES_OK;
> +}

--
Regards/Gruss,
Boris.

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

\
 
 \ /
  Last update: 2020-05-25 13:00    [W:1.077 / U:0.484 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site