Re: [PATCH] KVM: x86: fix DR6 delivery for emulated hardware breakpoint
From: kbuild test robot
Date: Tue May 05 2020 - 21:14:14 EST
Hi Paolo,
I love your patch! Yet something to improve:
[auto build test ERROR on kvm/linux-next]
[also build test ERROR on tip/auto-latest linus/master v5.7-rc4 next-20200505]
[cannot apply to linux/master]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Paolo-Bonzini/KVM-x86-fix-DR6-delivery-for-emulated-hardware-breakpoint/20200506-043817
base: https://git.kernel.org/pub/scm/virt/kvm/kvm.git linux-next
config: i386-allyesconfig (attached as .config)
compiler: gcc-7 (Ubuntu 7.5.0-6ubuntu2) 7.5.0
reproduce:
# save the attached .config to linux build tree
make ARCH=i386
If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@xxxxxxxxx>
All error/warnings (new ones prefixed by >>):
arch/x86/kvm/x86.c: In function 'kvm_deliver_exception_payload':
>> arch/x86/kvm/x86.c:472:3: error: implicit declaration of function 'kvm_update_dr6'; did you mean 'kvm_update_cpuid'? [-Werror=implicit-function-declaration]
kvm_update_dr6(vcpu);
^~~~~~~~~~~~~~
kvm_update_cpuid
arch/x86/kvm/x86.c: At top level:
>> arch/x86/kvm/x86.c:1071:13: warning: conflicting types for 'kvm_update_dr6'
static void kvm_update_dr6(struct kvm_vcpu *vcpu)
^~~~~~~~~~~~~~
>> arch/x86/kvm/x86.c:1071:13: error: static declaration of 'kvm_update_dr6' follows non-static declaration
arch/x86/kvm/x86.c:472:3: note: previous implicit declaration of 'kvm_update_dr6' was here
kvm_update_dr6(vcpu);
^~~~~~~~~~~~~~
cc1: some warnings being treated as errors
vim +472 arch/x86/kvm/x86.c
432
433 void kvm_deliver_exception_payload(struct kvm_vcpu *vcpu)
434 {
435 unsigned nr = vcpu->arch.exception.nr;
436 bool has_payload = vcpu->arch.exception.has_payload;
437 unsigned long payload = vcpu->arch.exception.payload;
438
439 if (!has_payload)
440 return;
441
442 switch (nr) {
443 case DB_VECTOR:
444 /*
445 * "Certain debug exceptions may clear bit 0-3. The
446 * remaining contents of the DR6 register are never
447 * cleared by the processor".
448 */
449 vcpu->arch.dr6 &= ~DR_TRAP_BITS;
450 /*
451 * DR6.RTM is set by all #DB exceptions that don't clear it.
452 */
453 vcpu->arch.dr6 |= DR6_RTM;
454 vcpu->arch.dr6 |= payload;
455 /*
456 * Bit 16 should be set in the payload whenever the #DB
457 * exception should clear DR6.RTM. This makes the payload
458 * compatible with the pending debug exceptions under VMX.
459 * Though not currently documented in the SDM, this also
460 * makes the payload compatible with the exit qualification
461 * for #DB exceptions under VMX.
462 */
463 vcpu->arch.dr6 ^= payload & DR6_RTM;
464
465 /*
466 * The #DB payload is defined as compatible with the 'pending
467 * debug exceptions' field under VMX, not DR6. While bit 12 is
468 * defined in the 'pending debug exceptions' field (enabled
469 * breakpoint), it is reserved and must be zero in DR6.
470 */
471 vcpu->arch.dr6 &= ~BIT(12);
> 472 kvm_update_dr6(vcpu);
473 break;
474 case PF_VECTOR:
475 vcpu->arch.cr2 = payload;
476 break;
477 }
478
479 vcpu->arch.exception.has_payload = false;
480 vcpu->arch.exception.payload = 0;
481 }
482 EXPORT_SYMBOL_GPL(kvm_deliver_exception_payload);
483
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx
Attachment:
.config.gz
Description: application/gzip