ACK/cmnt: [PATCH 2/2 V3] KVM: x86: Emulator should set DR6 upon GD like real CPU

Stefan Bader stefan.bader at canonical.com
Tue Feb 14 14:34:52 UTC 2017


On 14.02.2017 15:16, Stefan Bader wrote:
> On 14.02.2017 14:50, Tim Gardner wrote:
>> From: Nadav Amit <namit at cs.technion.ac.il>
>>
>> BugLink: http://bugs.launchpad.net/bugs/1660519
>>
>> It should clear B0-B3 and set BD.
>>
>> Signed-off-by: Nadav Amit <namit at cs.technion.ac.il>
>> Signed-off-by: Paolo Bonzini <pbonzini at redhat.com>
>> (back ported from commit 6d2a0526b09e551d0f395cfb63e7cb965db825af)
>> Signed-off-by: Tim Gardner <tim.gardner at canonical.com>
>> ---
>>
>> v2 - fixed commit log to indicate clean cherry-pick
>> v3 - dropped the use of DR6_RTM which had only one
>> use and no definition.
>>
>>  arch/x86/kvm/emulate.c | 9 ++++++++-
>>  1 file changed, 8 insertions(+), 1 deletion(-)
>>
>> diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
>> index f8eea19..23717df 100644
>> --- a/arch/x86/kvm/emulate.c
>> +++ b/arch/x86/kvm/emulate.c
>> @@ -3533,8 +3533,15 @@ static int check_dr_read(struct x86_emulate_ctxt *ctxt)
>>  	if ((cr4 & X86_CR4_DE) && (dr == 4 || dr == 5))
>>  		return emulate_ud(ctxt);
>>  
>> -	if (check_dr7_gd(ctxt))
>> +	if (check_dr7_gd(ctxt)) {
>> +		ulong dr6;
>> +
>> +		ctxt->ops->get_dr(ctxt, 6, &dr6);
>> +		dr6 &= ~15;
>> +		dr6 |= DR6_BD;
> 
> This now sets only bit 13 and not bit 16 ... (it was defined in the original
> patch by picking the definition from another patch).

After discussing this, its probably correct to drop the flag as the support for
it was added by the change not taken due to too many dependencies.
But should have an eye on testing really being done on that one.

-Stefan

> 
> 
>> +		ctxt->ops->set_dr(ctxt, 6, dr6);
>>  		return emulate_db(ctxt);
>> +	}
>>  
>>  	return X86EMUL_CONTINUE;
>>  }
>>
> 
> 
> 
> 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <https://lists.ubuntu.com/archives/kernel-team/attachments/20170214/083e35a6/attachment.sig>


More information about the kernel-team mailing list