xref: /kvmtool/x86/kvm.c (revision 3a60be06942944e25fe39726b1849d7e3bf252b6)
1af7b0868SMatt Evans #include "kvm/kvm.h"
2af7b0868SMatt Evans #include "kvm/boot-protocol.h"
3af7b0868SMatt Evans #include "kvm/cpufeature.h"
4af7b0868SMatt Evans #include "kvm/interrupt.h"
5af7b0868SMatt Evans #include "kvm/mptable.h"
6af7b0868SMatt Evans #include "kvm/util.h"
70b69bdefSMatt Evans #include "kvm/8250-serial.h"
80b69bdefSMatt Evans #include "kvm/virtio-console.h"
9af7b0868SMatt Evans 
10af7b0868SMatt Evans #include <asm/bootparam.h>
11af7b0868SMatt Evans #include <linux/kvm.h>
12af7b0868SMatt Evans 
13af7b0868SMatt Evans #include <sys/types.h>
14af7b0868SMatt Evans #include <sys/ioctl.h>
15af7b0868SMatt Evans #include <sys/mman.h>
16af7b0868SMatt Evans #include <sys/stat.h>
17af7b0868SMatt Evans #include <stdbool.h>
18af7b0868SMatt Evans #include <assert.h>
19af7b0868SMatt Evans #include <stdlib.h>
20af7b0868SMatt Evans #include <string.h>
21af7b0868SMatt Evans #include <unistd.h>
22af7b0868SMatt Evans #include <stdio.h>
23af7b0868SMatt Evans #include <fcntl.h>
24af7b0868SMatt Evans 
25af7b0868SMatt Evans struct kvm_ext kvm_req_ext[] = {
26af7b0868SMatt Evans 	{ DEFINE_KVM_EXT(KVM_CAP_COALESCED_MMIO) },
27af7b0868SMatt Evans 	{ DEFINE_KVM_EXT(KVM_CAP_SET_TSS_ADDR) },
28af7b0868SMatt Evans 	{ DEFINE_KVM_EXT(KVM_CAP_PIT2) },
29af7b0868SMatt Evans 	{ DEFINE_KVM_EXT(KVM_CAP_USER_MEMORY) },
30af7b0868SMatt Evans 	{ DEFINE_KVM_EXT(KVM_CAP_IRQ_ROUTING) },
31af7b0868SMatt Evans 	{ DEFINE_KVM_EXT(KVM_CAP_IRQCHIP) },
32af7b0868SMatt Evans 	{ DEFINE_KVM_EXT(KVM_CAP_HLT) },
33af7b0868SMatt Evans 	{ DEFINE_KVM_EXT(KVM_CAP_IRQ_INJECT_STATUS) },
34af7b0868SMatt Evans 	{ DEFINE_KVM_EXT(KVM_CAP_EXT_CPUID) },
35af7b0868SMatt Evans 	{ 0, 0 }
36af7b0868SMatt Evans };
37af7b0868SMatt Evans 
38af7b0868SMatt Evans bool kvm__arch_cpu_supports_vm(void)
39af7b0868SMatt Evans {
40af7b0868SMatt Evans 	struct cpuid_regs regs;
41af7b0868SMatt Evans 	u32 eax_base;
42af7b0868SMatt Evans 	int feature;
43af7b0868SMatt Evans 
44af7b0868SMatt Evans 	regs	= (struct cpuid_regs) {
45af7b0868SMatt Evans 		.eax		= 0x00,
46af7b0868SMatt Evans 	};
47af7b0868SMatt Evans 	host_cpuid(&regs);
48af7b0868SMatt Evans 
49af7b0868SMatt Evans 	switch (regs.ebx) {
50af7b0868SMatt Evans 	case CPUID_VENDOR_INTEL_1:
51af7b0868SMatt Evans 		eax_base	= 0x00;
52af7b0868SMatt Evans 		feature		= KVM__X86_FEATURE_VMX;
53af7b0868SMatt Evans 		break;
54af7b0868SMatt Evans 
55af7b0868SMatt Evans 	case CPUID_VENDOR_AMD_1:
56af7b0868SMatt Evans 		eax_base	= 0x80000000;
57af7b0868SMatt Evans 		feature		= KVM__X86_FEATURE_SVM;
58af7b0868SMatt Evans 		break;
59af7b0868SMatt Evans 
60af7b0868SMatt Evans 	default:
61af7b0868SMatt Evans 		return false;
62af7b0868SMatt Evans 	}
63af7b0868SMatt Evans 
64af7b0868SMatt Evans 	regs	= (struct cpuid_regs) {
65af7b0868SMatt Evans 		.eax		= eax_base,
66af7b0868SMatt Evans 	};
67af7b0868SMatt Evans 	host_cpuid(&regs);
68af7b0868SMatt Evans 
69af7b0868SMatt Evans 	if (regs.eax < eax_base + 0x01)
70af7b0868SMatt Evans 		return false;
71af7b0868SMatt Evans 
72af7b0868SMatt Evans 	regs	= (struct cpuid_regs) {
73af7b0868SMatt Evans 		.eax		= eax_base + 0x01
74af7b0868SMatt Evans 	};
75af7b0868SMatt Evans 	host_cpuid(&regs);
76af7b0868SMatt Evans 
77af7b0868SMatt Evans 	return regs.ecx & (1 << feature);
78af7b0868SMatt Evans }
79af7b0868SMatt Evans 
80af7b0868SMatt Evans /*
81af7b0868SMatt Evans  * Allocating RAM size bigger than 4GB requires us to leave a gap
82af7b0868SMatt Evans  * in the RAM which is used for PCI MMIO, hotplug, and unconfigured
83af7b0868SMatt Evans  * devices (see documentation of e820_setup_gap() for details).
84af7b0868SMatt Evans  *
85af7b0868SMatt Evans  * If we're required to initialize RAM bigger than 4GB, we will create
86af7b0868SMatt Evans  * a gap between 0xe0000000 and 0x100000000 in the guest virtual mem space.
87af7b0868SMatt Evans  */
88af7b0868SMatt Evans 
89af7b0868SMatt Evans void kvm__init_ram(struct kvm *kvm)
90af7b0868SMatt Evans {
91af7b0868SMatt Evans 	u64	phys_start, phys_size;
92af7b0868SMatt Evans 	void	*host_mem;
93af7b0868SMatt Evans 
94af7b0868SMatt Evans 	if (kvm->ram_size < KVM_32BIT_GAP_START) {
95af7b0868SMatt Evans 		/* Use a single block of RAM for 32bit RAM */
96af7b0868SMatt Evans 
97af7b0868SMatt Evans 		phys_start = 0;
98af7b0868SMatt Evans 		phys_size  = kvm->ram_size;
99af7b0868SMatt Evans 		host_mem   = kvm->ram_start;
100af7b0868SMatt Evans 
101af7b0868SMatt Evans 		kvm__register_mem(kvm, phys_start, phys_size, host_mem);
102af7b0868SMatt Evans 	} else {
103af7b0868SMatt Evans 		/* First RAM range from zero to the PCI gap: */
104af7b0868SMatt Evans 
105af7b0868SMatt Evans 		phys_start = 0;
106af7b0868SMatt Evans 		phys_size  = KVM_32BIT_GAP_START;
107af7b0868SMatt Evans 		host_mem   = kvm->ram_start;
108af7b0868SMatt Evans 
109af7b0868SMatt Evans 		kvm__register_mem(kvm, phys_start, phys_size, host_mem);
110af7b0868SMatt Evans 
111af7b0868SMatt Evans 		/* Second RAM range from 4GB to the end of RAM: */
112af7b0868SMatt Evans 
113af7b0868SMatt Evans 		phys_start = 0x100000000ULL;
114af7b0868SMatt Evans 		phys_size  = kvm->ram_size - phys_size;
115af7b0868SMatt Evans 		host_mem   = kvm->ram_start + phys_start;
116af7b0868SMatt Evans 
117af7b0868SMatt Evans 		kvm__register_mem(kvm, phys_start, phys_size, host_mem);
118af7b0868SMatt Evans 	}
119af7b0868SMatt Evans }
120af7b0868SMatt Evans 
1218e704a7aSMatt Evans /* Arch-specific commandline setup */
1228e704a7aSMatt Evans void kvm__arch_set_cmdline(char *cmdline, bool video)
1238e704a7aSMatt Evans {
1248e704a7aSMatt Evans 	strcpy(cmdline, "noapic noacpi pci=conf1 reboot=k panic=1 i8042.direct=1 "
1258e704a7aSMatt Evans 				"i8042.dumbkbd=1 i8042.nopnp=1");
126*3a60be06SSasha Levin 	if (video)
1278e704a7aSMatt Evans 		strcat(cmdline, " video=vesafb console=tty0");
128*3a60be06SSasha Levin 	else
1298e704a7aSMatt Evans 		strcat(cmdline, " console=ttyS0 earlyprintk=serial i8042.noaux=1");
1308e704a7aSMatt Evans }
1318e704a7aSMatt Evans 
13261061257SMatt Evans /* This function wraps the decision between hugetlbfs map (if requested) or normal mmap */
13361061257SMatt Evans static void *mmap_anon_or_hugetlbfs(const char *hugetlbfs_path, u64 size)
13461061257SMatt Evans {
135*3a60be06SSasha Levin 	if (hugetlbfs_path)
13661061257SMatt Evans 		/*
13761061257SMatt Evans 		 * We don't /need/ to map guest RAM from hugetlbfs, but we do so
13861061257SMatt Evans 		 * if the user specifies a hugetlbfs path.
13961061257SMatt Evans 		 */
14061061257SMatt Evans 		return mmap_hugetlbfs(hugetlbfs_path, size);
141*3a60be06SSasha Levin 	else
14261061257SMatt Evans 		return mmap(NULL, size, PROT_RW, MAP_ANON_NORESERVE, -1, 0);
14361061257SMatt Evans }
14461061257SMatt Evans 
145af7b0868SMatt Evans /* Architecture-specific KVM init */
14661061257SMatt Evans void kvm__arch_init(struct kvm *kvm, const char *kvm_dev, const char *hugetlbfs_path, u64 ram_size, const char *name)
147af7b0868SMatt Evans {
148af7b0868SMatt Evans 	struct kvm_pit_config pit_config = { .flags = 0, };
149af7b0868SMatt Evans 	int ret;
150af7b0868SMatt Evans 
151af7b0868SMatt Evans 	ret = ioctl(kvm->vm_fd, KVM_SET_TSS_ADDR, 0xfffbd000);
152af7b0868SMatt Evans 	if (ret < 0)
153af7b0868SMatt Evans 		die_perror("KVM_SET_TSS_ADDR ioctl");
154af7b0868SMatt Evans 
155af7b0868SMatt Evans 	ret = ioctl(kvm->vm_fd, KVM_CREATE_PIT2, &pit_config);
156af7b0868SMatt Evans 	if (ret < 0)
157af7b0868SMatt Evans 		die_perror("KVM_CREATE_PIT2 ioctl");
158af7b0868SMatt Evans 
159af7b0868SMatt Evans 	kvm->ram_size = ram_size;
160af7b0868SMatt Evans 
161af7b0868SMatt Evans 	if (kvm->ram_size < KVM_32BIT_GAP_START) {
16261061257SMatt Evans 		kvm->ram_start = mmap_anon_or_hugetlbfs(hugetlbfs_path, ram_size);
163af7b0868SMatt Evans 	} else {
16461061257SMatt Evans 		kvm->ram_start = mmap_anon_or_hugetlbfs(hugetlbfs_path, ram_size + KVM_32BIT_GAP_SIZE);
165*3a60be06SSasha Levin 		if (kvm->ram_start != MAP_FAILED)
166af7b0868SMatt Evans 			/*
167af7b0868SMatt Evans 			 * We mprotect the gap (see kvm__init_ram() for details) PROT_NONE so that
168af7b0868SMatt Evans 			 * if we accidently write to it, we will know.
169af7b0868SMatt Evans 			 */
170af7b0868SMatt Evans 			mprotect(kvm->ram_start + KVM_32BIT_GAP_START, KVM_32BIT_GAP_SIZE, PROT_NONE);
171af7b0868SMatt Evans 	}
172af7b0868SMatt Evans 	if (kvm->ram_start == MAP_FAILED)
173af7b0868SMatt Evans 		die("out of memory");
174af7b0868SMatt Evans 
175af7b0868SMatt Evans 	madvise(kvm->ram_start, kvm->ram_size, MADV_MERGEABLE);
176af7b0868SMatt Evans 
177af7b0868SMatt Evans 	ret = ioctl(kvm->vm_fd, KVM_CREATE_IRQCHIP);
178af7b0868SMatt Evans 	if (ret < 0)
179af7b0868SMatt Evans 		die_perror("KVM_CREATE_IRQCHIP ioctl");
180af7b0868SMatt Evans }
181af7b0868SMatt Evans 
182af7b0868SMatt Evans void kvm__irq_line(struct kvm *kvm, int irq, int level)
183af7b0868SMatt Evans {
184af7b0868SMatt Evans 	struct kvm_irq_level irq_level;
185af7b0868SMatt Evans 
186af7b0868SMatt Evans 	irq_level	= (struct kvm_irq_level) {
187af7b0868SMatt Evans 		{
188af7b0868SMatt Evans 			.irq		= irq,
189af7b0868SMatt Evans 		},
190af7b0868SMatt Evans 		.level		= level,
191af7b0868SMatt Evans 	};
192af7b0868SMatt Evans 
193af7b0868SMatt Evans 	if (ioctl(kvm->vm_fd, KVM_IRQ_LINE, &irq_level) < 0)
194af7b0868SMatt Evans 		die_perror("KVM_IRQ_LINE failed");
195af7b0868SMatt Evans }
196af7b0868SMatt Evans 
197af7b0868SMatt Evans void kvm__irq_trigger(struct kvm *kvm, int irq)
198af7b0868SMatt Evans {
199af7b0868SMatt Evans 	kvm__irq_line(kvm, irq, 1);
200af7b0868SMatt Evans 	kvm__irq_line(kvm, irq, 0);
201af7b0868SMatt Evans }
202af7b0868SMatt Evans 
203af7b0868SMatt Evans #define BOOT_LOADER_SELECTOR	0x1000
204af7b0868SMatt Evans #define BOOT_LOADER_IP		0x0000
205af7b0868SMatt Evans #define BOOT_LOADER_SP		0x8000
206af7b0868SMatt Evans #define BOOT_CMDLINE_OFFSET	0x20000
207af7b0868SMatt Evans 
208af7b0868SMatt Evans #define BOOT_PROTOCOL_REQUIRED	0x206
209af7b0868SMatt Evans #define LOAD_HIGH		0x01
210af7b0868SMatt Evans 
211604dbd63SMatt Evans int load_flat_binary(struct kvm *kvm, int fd_kernel, int fd_initrd, const char *kernel_cmdline)
212af7b0868SMatt Evans {
213af7b0868SMatt Evans 	void *p;
214af7b0868SMatt Evans 	int nr;
215af7b0868SMatt Evans 
216604dbd63SMatt Evans 	/*
217604dbd63SMatt Evans 	 * Some architectures may support loading an initrd alongside the flat kernel,
218604dbd63SMatt Evans 	 * but we do not.
219604dbd63SMatt Evans 	 */
220604dbd63SMatt Evans 	if (fd_initrd != -1)
221604dbd63SMatt Evans 		pr_warning("Loading initrd with flat binary not supported.");
222604dbd63SMatt Evans 
223604dbd63SMatt Evans 	if (lseek(fd_kernel, 0, SEEK_SET) < 0)
224af7b0868SMatt Evans 		die_perror("lseek");
225af7b0868SMatt Evans 
226af7b0868SMatt Evans 	p = guest_real_to_host(kvm, BOOT_LOADER_SELECTOR, BOOT_LOADER_IP);
227af7b0868SMatt Evans 
228604dbd63SMatt Evans 	while ((nr = read(fd_kernel, p, 65536)) > 0)
229af7b0868SMatt Evans 		p += nr;
230af7b0868SMatt Evans 
231af7b0868SMatt Evans 	kvm->boot_selector	= BOOT_LOADER_SELECTOR;
232af7b0868SMatt Evans 	kvm->boot_ip		= BOOT_LOADER_IP;
233af7b0868SMatt Evans 	kvm->boot_sp		= BOOT_LOADER_SP;
234af7b0868SMatt Evans 
235af7b0868SMatt Evans 	return true;
236af7b0868SMatt Evans }
237af7b0868SMatt Evans 
238af7b0868SMatt Evans static const char *BZIMAGE_MAGIC = "HdrS";
239af7b0868SMatt Evans 
240af7b0868SMatt Evans bool load_bzimage(struct kvm *kvm, int fd_kernel,
241af7b0868SMatt Evans 		  int fd_initrd, const char *kernel_cmdline, u16 vidmode)
242af7b0868SMatt Evans {
243af7b0868SMatt Evans 	struct boot_params *kern_boot;
244af7b0868SMatt Evans 	unsigned long setup_sects;
245af7b0868SMatt Evans 	struct boot_params boot;
246af7b0868SMatt Evans 	size_t cmdline_size;
247af7b0868SMatt Evans 	ssize_t setup_size;
248af7b0868SMatt Evans 	void *p;
249af7b0868SMatt Evans 	int nr;
250af7b0868SMatt Evans 
251af7b0868SMatt Evans 	/*
252af7b0868SMatt Evans 	 * See Documentation/x86/boot.txt for details no bzImage on-disk and
253af7b0868SMatt Evans 	 * memory layout.
254af7b0868SMatt Evans 	 */
255af7b0868SMatt Evans 
256af7b0868SMatt Evans 	if (lseek(fd_kernel, 0, SEEK_SET) < 0)
257af7b0868SMatt Evans 		die_perror("lseek");
258af7b0868SMatt Evans 
259af7b0868SMatt Evans 	if (read(fd_kernel, &boot, sizeof(boot)) != sizeof(boot))
260af7b0868SMatt Evans 		return false;
261af7b0868SMatt Evans 
262af7b0868SMatt Evans 	if (memcmp(&boot.hdr.header, BZIMAGE_MAGIC, strlen(BZIMAGE_MAGIC)))
263af7b0868SMatt Evans 		return false;
264af7b0868SMatt Evans 
265af7b0868SMatt Evans 	if (boot.hdr.version < BOOT_PROTOCOL_REQUIRED)
266af7b0868SMatt Evans 		die("Too old kernel");
267af7b0868SMatt Evans 
268af7b0868SMatt Evans 	if (lseek(fd_kernel, 0, SEEK_SET) < 0)
269af7b0868SMatt Evans 		die_perror("lseek");
270af7b0868SMatt Evans 
271af7b0868SMatt Evans 	if (!boot.hdr.setup_sects)
272af7b0868SMatt Evans 		boot.hdr.setup_sects = BZ_DEFAULT_SETUP_SECTS;
273af7b0868SMatt Evans 	setup_sects = boot.hdr.setup_sects + 1;
274af7b0868SMatt Evans 
275af7b0868SMatt Evans 	setup_size = setup_sects << 9;
276af7b0868SMatt Evans 	p = guest_real_to_host(kvm, BOOT_LOADER_SELECTOR, BOOT_LOADER_IP);
277af7b0868SMatt Evans 
278af7b0868SMatt Evans 	/* copy setup.bin to mem*/
279af7b0868SMatt Evans 	if (read(fd_kernel, p, setup_size) != setup_size)
280af7b0868SMatt Evans 		die_perror("read");
281af7b0868SMatt Evans 
282af7b0868SMatt Evans 	/* copy vmlinux.bin to BZ_KERNEL_START*/
283af7b0868SMatt Evans 	p = guest_flat_to_host(kvm, BZ_KERNEL_START);
284af7b0868SMatt Evans 
285af7b0868SMatt Evans 	while ((nr = read(fd_kernel, p, 65536)) > 0)
286af7b0868SMatt Evans 		p += nr;
287af7b0868SMatt Evans 
288af7b0868SMatt Evans 	p = guest_flat_to_host(kvm, BOOT_CMDLINE_OFFSET);
289af7b0868SMatt Evans 	if (kernel_cmdline) {
290af7b0868SMatt Evans 		cmdline_size = strlen(kernel_cmdline) + 1;
291af7b0868SMatt Evans 		if (cmdline_size > boot.hdr.cmdline_size)
292af7b0868SMatt Evans 			cmdline_size = boot.hdr.cmdline_size;
293af7b0868SMatt Evans 
294af7b0868SMatt Evans 		memset(p, 0, boot.hdr.cmdline_size);
295af7b0868SMatt Evans 		memcpy(p, kernel_cmdline, cmdline_size - 1);
296af7b0868SMatt Evans 	}
297af7b0868SMatt Evans 
298af7b0868SMatt Evans 	kern_boot	= guest_real_to_host(kvm, BOOT_LOADER_SELECTOR, 0x00);
299af7b0868SMatt Evans 
300af7b0868SMatt Evans 	kern_boot->hdr.cmd_line_ptr	= BOOT_CMDLINE_OFFSET;
301af7b0868SMatt Evans 	kern_boot->hdr.type_of_loader	= 0xff;
302af7b0868SMatt Evans 	kern_boot->hdr.heap_end_ptr	= 0xfe00;
303af7b0868SMatt Evans 	kern_boot->hdr.loadflags	|= CAN_USE_HEAP;
304af7b0868SMatt Evans 	kern_boot->hdr.vid_mode		= vidmode;
305af7b0868SMatt Evans 
306af7b0868SMatt Evans 	/*
307af7b0868SMatt Evans 	 * Read initrd image into guest memory
308af7b0868SMatt Evans 	 */
309af7b0868SMatt Evans 	if (fd_initrd >= 0) {
310af7b0868SMatt Evans 		struct stat initrd_stat;
311af7b0868SMatt Evans 		unsigned long addr;
312af7b0868SMatt Evans 
313af7b0868SMatt Evans 		if (fstat(fd_initrd, &initrd_stat))
314af7b0868SMatt Evans 			die_perror("fstat");
315af7b0868SMatt Evans 
316af7b0868SMatt Evans 		addr = boot.hdr.initrd_addr_max & ~0xfffff;
317af7b0868SMatt Evans 		for (;;) {
318af7b0868SMatt Evans 			if (addr < BZ_KERNEL_START)
319af7b0868SMatt Evans 				die("Not enough memory for initrd");
320af7b0868SMatt Evans 			else if (addr < (kvm->ram_size - initrd_stat.st_size))
321af7b0868SMatt Evans 				break;
322af7b0868SMatt Evans 			addr -= 0x100000;
323af7b0868SMatt Evans 		}
324af7b0868SMatt Evans 
325af7b0868SMatt Evans 		p = guest_flat_to_host(kvm, addr);
326af7b0868SMatt Evans 		nr = read(fd_initrd, p, initrd_stat.st_size);
327af7b0868SMatt Evans 		if (nr != initrd_stat.st_size)
328af7b0868SMatt Evans 			die("Failed to read initrd");
329af7b0868SMatt Evans 
330af7b0868SMatt Evans 		kern_boot->hdr.ramdisk_image	= addr;
331af7b0868SMatt Evans 		kern_boot->hdr.ramdisk_size	= initrd_stat.st_size;
332af7b0868SMatt Evans 	}
333af7b0868SMatt Evans 
334af7b0868SMatt Evans 	kvm->boot_selector = BOOT_LOADER_SELECTOR;
335af7b0868SMatt Evans 	/*
336af7b0868SMatt Evans 	 * The real-mode setup code starts at offset 0x200 of a bzImage. See
337af7b0868SMatt Evans 	 * Documentation/x86/boot.txt for details.
338af7b0868SMatt Evans 	 */
339af7b0868SMatt Evans 	kvm->boot_ip = BOOT_LOADER_IP + 0x200;
340af7b0868SMatt Evans 	kvm->boot_sp = BOOT_LOADER_SP;
341af7b0868SMatt Evans 
342af7b0868SMatt Evans 	return true;
343af7b0868SMatt Evans }
344af7b0868SMatt Evans 
345af7b0868SMatt Evans /**
346af7b0868SMatt Evans  * kvm__arch_setup_firmware - inject BIOS into guest system memory
347af7b0868SMatt Evans  * @kvm - guest system descriptor
348af7b0868SMatt Evans  *
349af7b0868SMatt Evans  * This function is a main routine where we poke guest memory
350af7b0868SMatt Evans  * and install BIOS there.
351af7b0868SMatt Evans  */
352af7b0868SMatt Evans void kvm__arch_setup_firmware(struct kvm *kvm)
353af7b0868SMatt Evans {
354af7b0868SMatt Evans 	/* standart minimal configuration */
355af7b0868SMatt Evans 	setup_bios(kvm);
356af7b0868SMatt Evans 
357af7b0868SMatt Evans 	/* FIXME: SMP, ACPI and friends here */
358af7b0868SMatt Evans 
359af7b0868SMatt Evans 	/* MP table */
360af7b0868SMatt Evans 	mptable_setup(kvm, kvm->nrcpus);
361af7b0868SMatt Evans }
3620b69bdefSMatt Evans 
3630b69bdefSMatt Evans void kvm__arch_periodic_poll(struct kvm *kvm)
3640b69bdefSMatt Evans {
365f6b8ccc1SThomas Gleixner 	serial8250__update_consoles(kvm);
3660b69bdefSMatt Evans 	virtio_console__inject_interrupt(kvm);
3670b69bdefSMatt Evans }
368