hvm.c (8f0ea33f2bbf3a6aa80235f0a02fa5f2780c2b17) hvm.c (f8f1bb83f78e8a2b7f4f10432882c39bbd7952fb)
1/*
2 * Copyright (c) 2008, 2013 Citrix Systems, Inc.
3 * Copyright (c) 2012 Spectra Logic Corporation
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 86 unchanged lines hidden (view full) ---

95/*------------------------------- Per-CPU Data -------------------------------*/
96DPCPU_DEFINE(struct vcpu_info, vcpu_local_info);
97DPCPU_DEFINE(struct vcpu_info *, vcpu_info);
98
99/*------------------ Hypervisor Access Shared Memory Regions -----------------*/
100shared_info_t *HYPERVISOR_shared_info;
101start_info_t *HYPERVISOR_start_info;
102
1/*
2 * Copyright (c) 2008, 2013 Citrix Systems, Inc.
3 * Copyright (c) 2012 Spectra Logic Corporation
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 86 unchanged lines hidden (view full) ---

95/*------------------------------- Per-CPU Data -------------------------------*/
96DPCPU_DEFINE(struct vcpu_info, vcpu_local_info);
97DPCPU_DEFINE(struct vcpu_info *, vcpu_info);
98
99/*------------------ Hypervisor Access Shared Memory Regions -----------------*/
100shared_info_t *HYPERVISOR_shared_info;
101start_info_t *HYPERVISOR_start_info;
102
103
104/*------------------------------ Sysctl tunables -----------------------------*/
105int xen_disable_pv_disks = 0;
106int xen_disable_pv_nics = 0;
107TUNABLE_INT("hw.xen.disable_pv_disks", &xen_disable_pv_disks);
108TUNABLE_INT("hw.xen.disable_pv_nics", &xen_disable_pv_nics);
109
103#ifdef SMP
110#ifdef SMP
104/* XEN diverged cpu operations */
111/*---------------------- XEN diverged cpu operations -------------------------*/
105static void
106xen_hvm_cpu_resume(void)
107{
108 u_int cpuid = PCPU_GET(cpuid);
109
110 /*
111 * Reset pending bitmap IPIs, because Xen doesn't preserve pending
112 * event channels on migration.

--- 138 unchanged lines hidden (view full) ---

251 XMI_UNPLUG_IDE_DISKS = 0x01,
252 XMI_UNPLUG_NICS = 0x02,
253 XMI_UNPLUG_IDE_EXCEPT_PRI_MASTER = 0x04
254};
255
256static void
257xen_hvm_disable_emulated_devices(void)
258{
112static void
113xen_hvm_cpu_resume(void)
114{
115 u_int cpuid = PCPU_GET(cpuid);
116
117 /*
118 * Reset pending bitmap IPIs, because Xen doesn't preserve pending
119 * event channels on migration.

--- 138 unchanged lines hidden (view full) ---

258 XMI_UNPLUG_IDE_DISKS = 0x01,
259 XMI_UNPLUG_NICS = 0x02,
260 XMI_UNPLUG_IDE_EXCEPT_PRI_MASTER = 0x04
261};
262
263static void
264xen_hvm_disable_emulated_devices(void)
265{
266 u_short disable_devs = 0;
259
260 if (xen_pv_domain()) {
261 /*
262 * No emulated devices in the PV case, so no need to unplug
263 * anything.
264 */
267
268 if (xen_pv_domain()) {
269 /*
270 * No emulated devices in the PV case, so no need to unplug
271 * anything.
272 */
273 if (xen_disable_pv_disks != 0 || xen_disable_pv_nics != 0)
274 printf("PV devices cannot be disabled in PV guests\n");
265 return;
266 }
267
268 if (inw(XEN_MAGIC_IOPORT) != XMI_MAGIC)
269 return;
270
275 return;
276 }
277
278 if (inw(XEN_MAGIC_IOPORT) != XMI_MAGIC)
279 return;
280
271 if (bootverbose)
272 printf("XEN: Disabling emulated block and network devices\n");
273 outw(XEN_MAGIC_IOPORT, XMI_UNPLUG_IDE_DISKS|XMI_UNPLUG_NICS);
281 if (xen_disable_pv_disks == 0) {
282 if (bootverbose)
283 printf("XEN: disabling emulated disks\n");
284 disable_devs |= XMI_UNPLUG_IDE_DISKS;
285 }
286 if (xen_disable_pv_nics == 0) {
287 if (bootverbose)
288 printf("XEN: disabling emulated nics\n");
289 disable_devs |= XMI_UNPLUG_NICS;
290 }
291
292 if (disable_devs != 0)
293 outw(XEN_MAGIC_IOPORT, disable_devs);
274}
275
276static void
277xen_hvm_init(enum xen_hvm_init_type init_type)
278{
279 int error;
280 int i;
281

--- 126 unchanged lines hidden ---
294}
295
296static void
297xen_hvm_init(enum xen_hvm_init_type init_type)
298{
299 int error;
300 int i;
301

--- 126 unchanged lines hidden ---