Lines Matching full:leaf

169 static int __sev_cpuid_hv_msr(struct cpuid_leaf *leaf)  in __sev_cpuid_hv_msr()  argument
181 if (cpuid_function_is_indexed(leaf->fn) && leaf->subfn) in __sev_cpuid_hv_msr()
184 ret = __sev_cpuid_hv(leaf->fn, GHCB_CPUID_REQ_EAX, &leaf->eax); in __sev_cpuid_hv_msr()
185 ret = ret ? : __sev_cpuid_hv(leaf->fn, GHCB_CPUID_REQ_EBX, &leaf->ebx); in __sev_cpuid_hv_msr()
186 ret = ret ? : __sev_cpuid_hv(leaf->fn, GHCB_CPUID_REQ_ECX, &leaf->ecx); in __sev_cpuid_hv_msr()
187 ret = ret ? : __sev_cpuid_hv(leaf->fn, GHCB_CPUID_REQ_EDX, &leaf->edx); in __sev_cpuid_hv_msr()
262 snp_cpuid_get_validated_func(struct cpuid_leaf *leaf) in snp_cpuid_get_validated_func() argument
270 if (e->eax_in != leaf->fn) in snp_cpuid_get_validated_func()
273 if (cpuid_function_is_indexed(leaf->fn) && e->ecx_in != leaf->subfn) in snp_cpuid_get_validated_func()
286 leaf->eax = e->eax; in snp_cpuid_get_validated_func()
287 leaf->ebx = e->ebx; in snp_cpuid_get_validated_func()
288 leaf->ecx = e->ecx; in snp_cpuid_get_validated_func()
289 leaf->edx = e->edx; in snp_cpuid_get_validated_func()
297 static void snp_cpuid_hv_msr(void *ctx, struct cpuid_leaf *leaf) in snp_cpuid_hv_msr() argument
299 if (__sev_cpuid_hv_msr(leaf)) in snp_cpuid_hv_msr()
304 snp_cpuid_postprocess(void (*cpuid_fn)(void *ctx, struct cpuid_leaf *leaf), in snp_cpuid_postprocess() argument
305 void *ctx, struct cpuid_leaf *leaf) in snp_cpuid_postprocess()
307 struct cpuid_leaf leaf_hv = *leaf; in snp_cpuid_postprocess()
309 switch (leaf->fn) { in snp_cpuid_postprocess()
314 leaf->ebx = (leaf_hv.ebx & GENMASK(31, 24)) | (leaf->ebx & GENMASK(23, 0)); in snp_cpuid_postprocess()
316 leaf->edx = (leaf_hv.edx & BIT(9)) | (leaf->edx & ~BIT(9)); in snp_cpuid_postprocess()
320 leaf->ecx |= BIT(27); in snp_cpuid_postprocess()
324 leaf->ecx &= ~BIT(4); in snp_cpuid_postprocess()
326 leaf->ecx |= BIT(4); in snp_cpuid_postprocess()
333 leaf->edx = leaf_hv.edx; in snp_cpuid_postprocess()
340 if (leaf->subfn != 0 && leaf->subfn != 1) in snp_cpuid_postprocess()
345 if (leaf->subfn == 1) { in snp_cpuid_postprocess()
347 if (leaf->eax & BIT(3)) { in snp_cpuid_postprocess()
364 if (!(leaf->eax & (BIT(1) | BIT(3)))) in snp_cpuid_postprocess()
374 leaf->ebx = xsave_size; in snp_cpuid_postprocess()
381 leaf->eax = leaf_hv.eax; in snp_cpuid_postprocess()
383 leaf->ebx = (leaf->ebx & GENMASK(31, 8)) | (leaf_hv.ebx & GENMASK(7, 0)); in snp_cpuid_postprocess()
385 leaf->ecx = (leaf->ecx & GENMASK(31, 8)) | (leaf_hv.ecx & GENMASK(7, 0)); in snp_cpuid_postprocess()
399 int snp_cpuid(void (*cpuid_fn)(void *ctx, struct cpuid_leaf *leaf), in snp_cpuid() argument
400 void *ctx, struct cpuid_leaf *leaf) in snp_cpuid()
407 if (!snp_cpuid_get_validated_func(leaf)) { in snp_cpuid()
425 leaf->eax = leaf->ebx = leaf->ecx = leaf->edx = 0; in snp_cpuid()
428 if (!(leaf->fn <= cpuid_std_range_max || in snp_cpuid()
429 (leaf->fn >= 0x40000000 && leaf->fn <= cpuid_hyp_range_max) || in snp_cpuid()
430 (leaf->fn >= 0x80000000 && leaf->fn <= cpuid_ext_range_max))) in snp_cpuid()
434 return snp_cpuid_postprocess(cpuid_fn, ctx, leaf); in snp_cpuid()
447 struct cpuid_leaf leaf; in do_vc_no_ghcb() local
458 leaf.fn = fn; in do_vc_no_ghcb()
459 leaf.subfn = subfn; in do_vc_no_ghcb()
468 ret = snp_cpuid(snp_cpuid_hv_msr, NULL, &leaf); in do_vc_no_ghcb()
479 if (__sev_cpuid_hv_msr(&leaf)) in do_vc_no_ghcb()
483 regs->ax = leaf.eax; in do_vc_no_ghcb()
484 regs->bx = leaf.ebx; in do_vc_no_ghcb()
485 regs->cx = leaf.ecx; in do_vc_no_ghcb()
486 regs->dx = leaf.edx; in do_vc_no_ghcb()
496 * - Availability of CPUID leaf 0x8000001f in do_vc_no_ghcb()
504 /* SEV leaf check */ in do_vc_no_ghcb()