Skip to contentSkip to conversation

ptp_kvm: try to detect hypercall availability

PATCH New Radim Krčmář 2 participants 2 messages Feb 15, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ptp_kvm: try to detect hypercall availability

No point in registering the device if it cannot work. The hypercall does not advertise itself, so we have to call it.

---
 drivers/ptp/ptp_kvm.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/ptp/ptp_kvm.c +7 -0
index 0a54e8326a90..0803286ca6b7 100644
@@ -176,12 +176,19 @@ static void __exit ptp_kvm_exit(void)
 
 static int __init ptp_kvm_init(void)
 {
+	long ret;
+
 	clock_pair_gpa = slow_virt_to_phys(&clock_pair);
 	hv_clock = pvclock_pvti_cpu0_va();
 
 	if (!hv_clock)
 		return -ENODEV;
 
+	ret = kvm_hypercall2(KVM_HC_CLOCK_PAIRING, clock_pair_gpa,
+			KVM_CLOCK_PAIRING_WALLCLOCK);
+	if (ret == -KVM_ENOSYS || ret == -KVM_EOPNOTSUPP)
+		return -ENODEV:
+
 	kvm_ptp_clock.caps = ptp_kvm_caps;
 
 	kvm_ptp_clock.ptp_clock = ptp_clock_register(&kvm_ptp_clock.caps, NULL);
Signature · 1 line
2.11.1
#1 lore raw
url: https://github.com/0day-ci/linux/commits/Radim-Kr-m/ptp_kvm-try-to-detect-hypercall-availability/20170216-040707 config: x86_64-acpi-redef (attached as .config) compiler: gcc-6 (Debian 6.2.0-3)…

Hi Radim,

[auto build test ERROR on next-20170215]
[cannot apply to linus/master linux/master v4.9-rc8 v4.9-rc7 v4.9-rc6 v4.10-rc8] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Radim-Kr-m/ptp_kvm-try-to-detect-hypercall-availability/20170216-040707
config: x86_64-acpi-redef (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:

        # save the attached .config to linux build tree
        make ARCH=x86_64 

All errors (new ones prefixed by >>):

drivers/ptp/ptp_kvm.c: In function 'ptp_kvm_init':

>> drivers/ptp/ptp_kvm.c:190:17: error: expected ';' before ':' token
      return -ENODEV:
                    ^
   At top level:
   drivers/ptp/ptp_kvm.c:153:30: warning: 'ptp_kvm_caps' defined but not used [-Wunused-variable]
    static struct ptp_clock_info ptp_kvm_caps = {
                                 ^~~~~~~~~~~~

vim +190 drivers/ptp/ptp_kvm.c

184 if (!hv_clock)
185 return -ENODEV;
186
187 ret = kvm_hypercall2(KVM_HC_CLOCK_PAIRING, clock_pair_gpa,
188 KVM_CLOCK_PAIRING_WALLCLOCK);
189 if (ret == -KVM_ENOSYS || ret == -KVM_EOPNOTSUPP)

 > 190			return -ENODEV:

191
192 kvm_ptp_clock.caps = ptp_kvm_caps;
193

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation