vgic-init.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * Copyright (C) 2015, 2016 ARM Ltd.
  4. */
  5. #include <linux/uaccess.h>
  6. #include <linux/interrupt.h>
  7. #include <linux/cpu.h>
  8. #include <linux/kvm_host.h>
  9. #include <kvm/arm_vgic.h>
  10. #include <asm/kvm_emulate.h>
  11. #include <asm/kvm_mmu.h>
  12. #include "vgic.h"
  13. /*
  14. * Initialization rules: there are multiple stages to the vgic
  15. * initialization, both for the distributor and the CPU interfaces. The basic
  16. * idea is that even though the VGIC is not functional or not requested from
  17. * user space, the critical path of the run loop can still call VGIC functions
  18. * that just won't do anything, without them having to check additional
  19. * initialization flags to ensure they don't look at uninitialized data
  20. * structures.
  21. *
  22. * Distributor:
  23. *
  24. * - kvm_vgic_early_init(): initialization of static data that doesn't
  25. * depend on any sizing information or emulation type. No allocation
  26. * is allowed there.
  27. *
  28. * - vgic_init(): allocation and initialization of the generic data
  29. * structures that depend on sizing information (number of CPUs,
  30. * number of interrupts). Also initializes the vcpu specific data
  31. * structures. Can be executed lazily for GICv2.
  32. *
  33. * CPU Interface:
  34. *
  35. * - kvm_vgic_vcpu_init(): initialization of static data that
  36. * doesn't depend on any sizing information or emulation type. No
  37. * allocation is allowed there.
  38. */
  39. /* EARLY INIT */
  40. /**
  41. * kvm_vgic_early_init() - Initialize static VGIC VCPU data structures
  42. * @kvm: The VM whose VGIC districutor should be initialized
  43. *
  44. * Only do initialization of static structures that don't require any
  45. * allocation or sizing information from userspace. vgic_init() called
  46. * kvm_vgic_dist_init() which takes care of the rest.
  47. */
  48. void kvm_vgic_early_init(struct kvm *kvm)
  49. {
  50. struct vgic_dist *dist = &kvm->arch.vgic;
  51. INIT_LIST_HEAD(&dist->lpi_list_head);
  52. INIT_LIST_HEAD(&dist->lpi_translation_cache);
  53. raw_spin_lock_init(&dist->lpi_list_lock);
  54. }
  55. /* CREATION */
  56. /**
  57. * kvm_vgic_create: triggered by the instantiation of the VGIC device by
  58. * user space, either through the legacy KVM_CREATE_IRQCHIP ioctl (v2 only)
  59. * or through the generic KVM_CREATE_DEVICE API ioctl.
  60. * irqchip_in_kernel() tells you if this function succeeded or not.
  61. * @kvm: kvm struct pointer
  62. * @type: KVM_DEV_TYPE_ARM_VGIC_V[23]
  63. */
  64. int kvm_vgic_create(struct kvm *kvm, u32 type)
  65. {
  66. struct kvm_vcpu *vcpu;
  67. unsigned long i;
  68. int ret;
  69. /*
  70. * This function is also called by the KVM_CREATE_IRQCHIP handler,
  71. * which had no chance yet to check the availability of the GICv2
  72. * emulation. So check this here again. KVM_CREATE_DEVICE does
  73. * the proper checks already.
  74. */
  75. if (type == KVM_DEV_TYPE_ARM_VGIC_V2 &&
  76. !kvm_vgic_global_state.can_emulate_gicv2)
  77. return -ENODEV;
  78. /* Must be held to avoid race with vCPU creation */
  79. lockdep_assert_held(&kvm->lock);
  80. ret = -EBUSY;
  81. if (!lock_all_vcpus(kvm))
  82. return ret;
  83. mutex_lock(&kvm->arch.config_lock);
  84. if (irqchip_in_kernel(kvm)) {
  85. ret = -EEXIST;
  86. goto out_unlock;
  87. }
  88. kvm_for_each_vcpu(i, vcpu, kvm) {
  89. if (vcpu_has_run_once(vcpu))
  90. goto out_unlock;
  91. }
  92. ret = 0;
  93. if (type == KVM_DEV_TYPE_ARM_VGIC_V2)
  94. kvm->max_vcpus = VGIC_V2_MAX_CPUS;
  95. else
  96. kvm->max_vcpus = VGIC_V3_MAX_CPUS;
  97. if (atomic_read(&kvm->online_vcpus) > kvm->max_vcpus) {
  98. ret = -E2BIG;
  99. goto out_unlock;
  100. }
  101. kvm->arch.vgic.in_kernel = true;
  102. kvm->arch.vgic.vgic_model = type;
  103. kvm->arch.vgic.vgic_dist_base = VGIC_ADDR_UNDEF;
  104. if (type == KVM_DEV_TYPE_ARM_VGIC_V2)
  105. kvm->arch.vgic.vgic_cpu_base = VGIC_ADDR_UNDEF;
  106. else
  107. INIT_LIST_HEAD(&kvm->arch.vgic.rd_regions);
  108. out_unlock:
  109. mutex_unlock(&kvm->arch.config_lock);
  110. unlock_all_vcpus(kvm);
  111. return ret;
  112. }
  113. /* INIT/DESTROY */
  114. /**
  115. * kvm_vgic_dist_init: initialize the dist data structures
  116. * @kvm: kvm struct pointer
  117. * @nr_spis: number of spis, frozen by caller
  118. */
  119. static int kvm_vgic_dist_init(struct kvm *kvm, unsigned int nr_spis)
  120. {
  121. struct vgic_dist *dist = &kvm->arch.vgic;
  122. struct kvm_vcpu *vcpu0 = kvm_get_vcpu(kvm, 0);
  123. int i;
  124. dist->spis = kcalloc(nr_spis, sizeof(struct vgic_irq), GFP_KERNEL_ACCOUNT);
  125. if (!dist->spis)
  126. return -ENOMEM;
  127. /*
  128. * In the following code we do not take the irq struct lock since
  129. * no other action on irq structs can happen while the VGIC is
  130. * not initialized yet:
  131. * If someone wants to inject an interrupt or does a MMIO access, we
  132. * require prior initialization in case of a virtual GICv3 or trigger
  133. * initialization when using a virtual GICv2.
  134. */
  135. for (i = 0; i < nr_spis; i++) {
  136. struct vgic_irq *irq = &dist->spis[i];
  137. irq->intid = i + VGIC_NR_PRIVATE_IRQS;
  138. INIT_LIST_HEAD(&irq->ap_list);
  139. raw_spin_lock_init(&irq->irq_lock);
  140. irq->vcpu = NULL;
  141. irq->target_vcpu = vcpu0;
  142. kref_init(&irq->refcount);
  143. switch (dist->vgic_model) {
  144. case KVM_DEV_TYPE_ARM_VGIC_V2:
  145. irq->targets = 0;
  146. irq->group = 0;
  147. break;
  148. case KVM_DEV_TYPE_ARM_VGIC_V3:
  149. irq->mpidr = 0;
  150. irq->group = 1;
  151. break;
  152. default:
  153. kfree(dist->spis);
  154. dist->spis = NULL;
  155. return -EINVAL;
  156. }
  157. }
  158. return 0;
  159. }
  160. /**
  161. * kvm_vgic_vcpu_init() - Initialize static VGIC VCPU data
  162. * structures and register VCPU-specific KVM iodevs
  163. *
  164. * @vcpu: pointer to the VCPU being created and initialized
  165. *
  166. * Only do initialization, but do not actually enable the
  167. * VGIC CPU interface
  168. */
  169. int kvm_vgic_vcpu_init(struct kvm_vcpu *vcpu)
  170. {
  171. struct vgic_cpu *vgic_cpu = &vcpu->arch.vgic_cpu;
  172. struct vgic_dist *dist = &vcpu->kvm->arch.vgic;
  173. int ret = 0;
  174. int i;
  175. vgic_cpu->rd_iodev.base_addr = VGIC_ADDR_UNDEF;
  176. INIT_LIST_HEAD(&vgic_cpu->ap_list_head);
  177. raw_spin_lock_init(&vgic_cpu->ap_list_lock);
  178. atomic_set(&vgic_cpu->vgic_v3.its_vpe.vlpi_count, 0);
  179. /*
  180. * Enable and configure all SGIs to be edge-triggered and
  181. * configure all PPIs as level-triggered.
  182. */
  183. for (i = 0; i < VGIC_NR_PRIVATE_IRQS; i++) {
  184. struct vgic_irq *irq = &vgic_cpu->private_irqs[i];
  185. INIT_LIST_HEAD(&irq->ap_list);
  186. raw_spin_lock_init(&irq->irq_lock);
  187. irq->intid = i;
  188. irq->vcpu = NULL;
  189. irq->target_vcpu = vcpu;
  190. kref_init(&irq->refcount);
  191. if (vgic_irq_is_sgi(i)) {
  192. /* SGIs */
  193. irq->enabled = 1;
  194. irq->config = VGIC_CONFIG_EDGE;
  195. } else {
  196. /* PPIs */
  197. irq->config = VGIC_CONFIG_LEVEL;
  198. }
  199. }
  200. if (!irqchip_in_kernel(vcpu->kvm))
  201. return 0;
  202. /*
  203. * If we are creating a VCPU with a GICv3 we must also register the
  204. * KVM io device for the redistributor that belongs to this VCPU.
  205. */
  206. if (dist->vgic_model == KVM_DEV_TYPE_ARM_VGIC_V3) {
  207. mutex_lock(&vcpu->kvm->slots_lock);
  208. ret = vgic_register_redist_iodev(vcpu);
  209. mutex_unlock(&vcpu->kvm->slots_lock);
  210. }
  211. return ret;
  212. }
  213. static void kvm_vgic_vcpu_enable(struct kvm_vcpu *vcpu)
  214. {
  215. if (kvm_vgic_global_state.type == VGIC_V2)
  216. vgic_v2_enable(vcpu);
  217. else
  218. vgic_v3_enable(vcpu);
  219. }
  220. /*
  221. * vgic_init: allocates and initializes dist and vcpu data structures
  222. * depending on two dimensioning parameters:
  223. * - the number of spis
  224. * - the number of vcpus
  225. * The function is generally called when nr_spis has been explicitly set
  226. * by the guest through the KVM DEVICE API. If not nr_spis is set to 256.
  227. * vgic_initialized() returns true when this function has succeeded.
  228. */
  229. int vgic_init(struct kvm *kvm)
  230. {
  231. struct vgic_dist *dist = &kvm->arch.vgic;
  232. struct kvm_vcpu *vcpu;
  233. int ret = 0, i;
  234. unsigned long idx;
  235. lockdep_assert_held(&kvm->arch.config_lock);
  236. if (vgic_initialized(kvm))
  237. return 0;
  238. /* Are we also in the middle of creating a VCPU? */
  239. if (kvm->created_vcpus != atomic_read(&kvm->online_vcpus))
  240. return -EBUSY;
  241. /* freeze the number of spis */
  242. if (!dist->nr_spis)
  243. dist->nr_spis = VGIC_NR_IRQS_LEGACY - VGIC_NR_PRIVATE_IRQS;
  244. ret = kvm_vgic_dist_init(kvm, dist->nr_spis);
  245. if (ret)
  246. goto out;
  247. /* Initialize groups on CPUs created before the VGIC type was known */
  248. kvm_for_each_vcpu(idx, vcpu, kvm) {
  249. struct vgic_cpu *vgic_cpu = &vcpu->arch.vgic_cpu;
  250. for (i = 0; i < VGIC_NR_PRIVATE_IRQS; i++) {
  251. struct vgic_irq *irq = &vgic_cpu->private_irqs[i];
  252. switch (dist->vgic_model) {
  253. case KVM_DEV_TYPE_ARM_VGIC_V3:
  254. irq->group = 1;
  255. irq->mpidr = kvm_vcpu_get_mpidr_aff(vcpu);
  256. break;
  257. case KVM_DEV_TYPE_ARM_VGIC_V2:
  258. irq->group = 0;
  259. irq->targets = 1U << idx;
  260. break;
  261. default:
  262. ret = -EINVAL;
  263. goto out;
  264. }
  265. }
  266. }
  267. if (vgic_has_its(kvm))
  268. vgic_lpi_translation_cache_init(kvm);
  269. /*
  270. * If we have GICv4.1 enabled, unconditionnaly request enable the
  271. * v4 support so that we get HW-accelerated vSGIs. Otherwise, only
  272. * enable it if we present a virtual ITS to the guest.
  273. */
  274. if (vgic_supports_direct_msis(kvm)) {
  275. ret = vgic_v4_init(kvm);
  276. if (ret)
  277. goto out;
  278. }
  279. kvm_for_each_vcpu(idx, vcpu, kvm)
  280. kvm_vgic_vcpu_enable(vcpu);
  281. ret = kvm_vgic_setup_default_irq_routing(kvm);
  282. if (ret)
  283. goto out;
  284. vgic_debug_init(kvm);
  285. /*
  286. * If userspace didn't set the GIC implementation revision,
  287. * default to the latest and greatest. You know want it.
  288. */
  289. if (!dist->implementation_rev)
  290. dist->implementation_rev = KVM_VGIC_IMP_REV_LATEST;
  291. dist->initialized = true;
  292. out:
  293. return ret;
  294. }
  295. static void kvm_vgic_dist_destroy(struct kvm *kvm)
  296. {
  297. struct vgic_dist *dist = &kvm->arch.vgic;
  298. struct vgic_redist_region *rdreg, *next;
  299. dist->ready = false;
  300. dist->initialized = false;
  301. kfree(dist->spis);
  302. dist->spis = NULL;
  303. dist->nr_spis = 0;
  304. dist->vgic_dist_base = VGIC_ADDR_UNDEF;
  305. if (dist->vgic_model == KVM_DEV_TYPE_ARM_VGIC_V3) {
  306. list_for_each_entry_safe(rdreg, next, &dist->rd_regions, list)
  307. vgic_v3_free_redist_region(rdreg);
  308. INIT_LIST_HEAD(&dist->rd_regions);
  309. } else {
  310. dist->vgic_cpu_base = VGIC_ADDR_UNDEF;
  311. }
  312. if (vgic_has_its(kvm))
  313. vgic_lpi_translation_cache_destroy(kvm);
  314. if (vgic_supports_direct_msis(kvm))
  315. vgic_v4_teardown(kvm);
  316. }
  317. void kvm_vgic_vcpu_destroy(struct kvm_vcpu *vcpu)
  318. {
  319. struct vgic_cpu *vgic_cpu = &vcpu->arch.vgic_cpu;
  320. /*
  321. * Retire all pending LPIs on this vcpu anyway as we're
  322. * going to destroy it.
  323. */
  324. vgic_flush_pending_lpis(vcpu);
  325. INIT_LIST_HEAD(&vgic_cpu->ap_list_head);
  326. vgic_cpu->rd_iodev.base_addr = VGIC_ADDR_UNDEF;
  327. }
  328. static void __kvm_vgic_destroy(struct kvm *kvm)
  329. {
  330. struct kvm_vcpu *vcpu;
  331. unsigned long i;
  332. lockdep_assert_held(&kvm->arch.config_lock);
  333. vgic_debug_destroy(kvm);
  334. kvm_for_each_vcpu(i, vcpu, kvm)
  335. kvm_vgic_vcpu_destroy(vcpu);
  336. kvm_vgic_dist_destroy(kvm);
  337. }
  338. void kvm_vgic_destroy(struct kvm *kvm)
  339. {
  340. mutex_lock(&kvm->arch.config_lock);
  341. __kvm_vgic_destroy(kvm);
  342. mutex_unlock(&kvm->arch.config_lock);
  343. }
  344. /**
  345. * vgic_lazy_init: Lazy init is only allowed if the GIC exposed to the guest
  346. * is a GICv2. A GICv3 must be explicitly initialized by the guest using the
  347. * KVM_DEV_ARM_VGIC_GRP_CTRL KVM_DEVICE group.
  348. * @kvm: kvm struct pointer
  349. */
  350. int vgic_lazy_init(struct kvm *kvm)
  351. {
  352. int ret = 0;
  353. if (unlikely(!vgic_initialized(kvm))) {
  354. /*
  355. * We only provide the automatic initialization of the VGIC
  356. * for the legacy case of a GICv2. Any other type must
  357. * be explicitly initialized once setup with the respective
  358. * KVM device call.
  359. */
  360. if (kvm->arch.vgic.vgic_model != KVM_DEV_TYPE_ARM_VGIC_V2)
  361. return -EBUSY;
  362. mutex_lock(&kvm->arch.config_lock);
  363. ret = vgic_init(kvm);
  364. mutex_unlock(&kvm->arch.config_lock);
  365. }
  366. return ret;
  367. }
  368. /* RESOURCE MAPPING */
  369. /**
  370. * Map the MMIO regions depending on the VGIC model exposed to the guest
  371. * called on the first VCPU run.
  372. * Also map the virtual CPU interface into the VM.
  373. * v2 calls vgic_init() if not already done.
  374. * v3 and derivatives return an error if the VGIC is not initialized.
  375. * vgic_ready() returns true if this function has succeeded.
  376. * @kvm: kvm struct pointer
  377. */
  378. int kvm_vgic_map_resources(struct kvm *kvm)
  379. {
  380. struct vgic_dist *dist = &kvm->arch.vgic;
  381. enum vgic_type type;
  382. gpa_t dist_base;
  383. int ret = 0;
  384. if (likely(vgic_ready(kvm)))
  385. return 0;
  386. mutex_lock(&kvm->slots_lock);
  387. mutex_lock(&kvm->arch.config_lock);
  388. if (vgic_ready(kvm))
  389. goto out;
  390. if (!irqchip_in_kernel(kvm))
  391. goto out;
  392. if (dist->vgic_model == KVM_DEV_TYPE_ARM_VGIC_V2) {
  393. ret = vgic_v2_map_resources(kvm);
  394. type = VGIC_V2;
  395. } else {
  396. ret = vgic_v3_map_resources(kvm);
  397. type = VGIC_V3;
  398. }
  399. if (ret) {
  400. __kvm_vgic_destroy(kvm);
  401. goto out;
  402. }
  403. dist->ready = true;
  404. dist_base = dist->vgic_dist_base;
  405. mutex_unlock(&kvm->arch.config_lock);
  406. ret = vgic_register_dist_iodev(kvm, dist_base, type);
  407. if (ret) {
  408. kvm_err("Unable to register VGIC dist MMIO regions\n");
  409. kvm_vgic_destroy(kvm);
  410. }
  411. mutex_unlock(&kvm->slots_lock);
  412. return ret;
  413. out:
  414. mutex_unlock(&kvm->arch.config_lock);
  415. mutex_unlock(&kvm->slots_lock);
  416. return ret;
  417. }
  418. /* GENERIC PROBE */
  419. static int vgic_init_cpu_starting(unsigned int cpu)
  420. {
  421. enable_percpu_irq(kvm_vgic_global_state.maint_irq, 0);
  422. return 0;
  423. }
  424. static int vgic_init_cpu_dying(unsigned int cpu)
  425. {
  426. disable_percpu_irq(kvm_vgic_global_state.maint_irq);
  427. return 0;
  428. }
  429. static irqreturn_t vgic_maintenance_handler(int irq, void *data)
  430. {
  431. /*
  432. * We cannot rely on the vgic maintenance interrupt to be
  433. * delivered synchronously. This means we can only use it to
  434. * exit the VM, and we perform the handling of EOIed
  435. * interrupts on the exit path (see vgic_fold_lr_state).
  436. */
  437. return IRQ_HANDLED;
  438. }
  439. static struct gic_kvm_info *gic_kvm_info;
  440. void __init vgic_set_kvm_info(const struct gic_kvm_info *info)
  441. {
  442. BUG_ON(gic_kvm_info != NULL);
  443. gic_kvm_info = kmalloc(sizeof(*info), GFP_KERNEL);
  444. if (gic_kvm_info)
  445. *gic_kvm_info = *info;
  446. }
  447. /**
  448. * kvm_vgic_init_cpu_hardware - initialize the GIC VE hardware
  449. *
  450. * For a specific CPU, initialize the GIC VE hardware.
  451. */
  452. void kvm_vgic_init_cpu_hardware(void)
  453. {
  454. BUG_ON(preemptible());
  455. /*
  456. * We want to make sure the list registers start out clear so that we
  457. * only have the program the used registers.
  458. */
  459. if (kvm_vgic_global_state.type == VGIC_V2)
  460. vgic_v2_init_lrs();
  461. else
  462. kvm_call_hyp(__vgic_v3_init_lrs);
  463. }
  464. /**
  465. * kvm_vgic_hyp_init: populates the kvm_vgic_global_state variable
  466. * according to the host GIC model. Accordingly calls either
  467. * vgic_v2/v3_probe which registers the KVM_DEVICE that can be
  468. * instantiated by a guest later on .
  469. */
  470. int kvm_vgic_hyp_init(void)
  471. {
  472. bool has_mask;
  473. int ret;
  474. if (!gic_kvm_info)
  475. return -ENODEV;
  476. has_mask = !gic_kvm_info->no_maint_irq_mask;
  477. if (has_mask && !gic_kvm_info->maint_irq) {
  478. kvm_err("No vgic maintenance irq\n");
  479. return -ENXIO;
  480. }
  481. /*
  482. * If we get one of these oddball non-GICs, taint the kernel,
  483. * as we have no idea of how they *really* behave.
  484. */
  485. if (gic_kvm_info->no_hw_deactivation) {
  486. kvm_info("Non-architectural vgic, tainting kernel\n");
  487. add_taint(TAINT_CPU_OUT_OF_SPEC, LOCKDEP_STILL_OK);
  488. kvm_vgic_global_state.no_hw_deactivation = true;
  489. }
  490. switch (gic_kvm_info->type) {
  491. case GIC_V2:
  492. ret = vgic_v2_probe(gic_kvm_info);
  493. break;
  494. case GIC_V3:
  495. ret = vgic_v3_probe(gic_kvm_info);
  496. if (!ret) {
  497. static_branch_enable(&kvm_vgic_global_state.gicv3_cpuif);
  498. kvm_info("GIC system register CPU interface enabled\n");
  499. }
  500. break;
  501. default:
  502. ret = -ENODEV;
  503. }
  504. kvm_vgic_global_state.maint_irq = gic_kvm_info->maint_irq;
  505. kfree(gic_kvm_info);
  506. gic_kvm_info = NULL;
  507. if (ret)
  508. return ret;
  509. if (!has_mask)
  510. return 0;
  511. ret = request_percpu_irq(kvm_vgic_global_state.maint_irq,
  512. vgic_maintenance_handler,
  513. "vgic", kvm_get_running_vcpus());
  514. if (ret) {
  515. kvm_err("Cannot register interrupt %d\n",
  516. kvm_vgic_global_state.maint_irq);
  517. return ret;
  518. }
  519. ret = cpuhp_setup_state(CPUHP_AP_KVM_ARM_VGIC_INIT_STARTING,
  520. "kvm/arm/vgic:starting",
  521. vgic_init_cpu_starting, vgic_init_cpu_dying);
  522. if (ret) {
  523. kvm_err("Cannot register vgic CPU notifier\n");
  524. goto out_free_irq;
  525. }
  526. kvm_info("vgic interrupt IRQ%d\n", kvm_vgic_global_state.maint_irq);
  527. return 0;
  528. out_free_irq:
  529. free_percpu_irq(kvm_vgic_global_state.maint_irq,
  530. kvm_get_running_vcpus());
  531. return ret;
  532. }