Re: [PATCH v3 09/10] KVM: selftests: Expect #PF(RSVD) when TDP is disabled

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Oct 31, 2022, David Matlack wrote:
> -static void guest_code(void)
> +static void guest_code(bool tdp_enabled)
>  {
> -	flds(MEM_REGION_GVA);
> +	uint64_t error_code;
> +	uint64_t vector;
> +
> +	vector = kvm_asm_safe_ec(FLDS_MEM_EAX, error_code, "a"(MEM_REGION_GVA));
> +
> +	/*
> +	 * When TDP is disabled, no instruction emulation is required so flds
> +	 * should generate #PF(RSVD).
> +	 */
> +	if (!tdp_enabled) {
> +		GUEST_ASSERT_EQ(vector, PF_VECTOR);
> +		GUEST_ASSERT(error_code & PFERR_RSVD_MASK);
> +	}

Probably worth adding

	} else {
		GUEST_ASSERT(!vector);
	}

to verify no fault occurs in the emulation case?  Or to avoid the inverted check,

	if (tdp_enabled) {
		GUEST_ASSERT(!vector);
	} else {
		GUEST_ASSERT_EQ(vector, PF_VECTOR);
		GUEST_ASSERT(error_code & PFERR_RSVD_MASK);
	}

It's mostly redundant with assert_exit_for_flds_emulation_failure(), but at worst
it'll help docuemnts the expected behavior in the TDP case.



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux