Merge branch 'upstream-merge'
[qemu-kvm.git] / qemu-kvm.h
blob3ebbbb6e6429fde8fe31fd3bc5a41fc068838e35
1 /*
2 * qemu/kvm integration
4 * Copyright (C) 2006-2008 Qumranet Technologies
6 * Licensed under the terms of the GNU GPL version 2 or higher.
7 */
8 #ifndef THE_ORIGINAL_AND_TRUE_QEMU_KVM_H
9 #define THE_ORIGINAL_AND_TRUE_QEMU_KVM_H
11 #include "cpu.h"
13 #include <signal.h>
14 #include <stdlib.h>
16 #ifdef CONFIG_KVM
18 #include <stdint.h>
20 #ifndef __user
21 #define __user /* temporary, until installed via make headers_install */
22 #endif
24 #include <linux/kvm.h>
26 #include <signal.h>
28 /* FIXME: share this number with kvm */
29 /* FIXME: or dynamically alloc/realloc regions */
30 #define KVM_MAX_NUM_MEM_REGIONS 32u
31 #define MAX_VCPUS 16
33 #include "kvm.h"
35 /*!
36 * \brief Notifies host kernel about a PCI device to be assigned to a guest
38 * Used for PCI device assignment, this function notifies the host
39 * kernel about the assigning of the physical PCI device to a guest.
41 * \param kvm Pointer to the current kvm_context
42 * \param assigned_dev Parameters, like bus, devfn number, etc
44 int kvm_assign_pci_device(KVMState *s,
45 struct kvm_assigned_pci_dev *assigned_dev);
47 /*!
48 * \brief Assign IRQ for an assigned device
50 * Used for PCI device assignment, this function assigns IRQ numbers for
51 * an physical device and guest IRQ handling.
53 * \param kvm Pointer to the current kvm_context
54 * \param assigned_irq Parameters, like dev id, host irq, guest irq, etc
56 int kvm_assign_irq(KVMState *s, struct kvm_assigned_irq *assigned_irq);
58 /*!
59 * \brief Deassign IRQ for an assigned device
61 * Used for PCI device assignment, this function deassigns IRQ numbers
62 * for an assigned device.
64 * \param kvm Pointer to the current kvm_context
65 * \param assigned_irq Parameters, like dev id, host irq, guest irq, etc
67 int kvm_deassign_irq(KVMState *s, struct kvm_assigned_irq *assigned_irq);
69 int kvm_device_intx_set_mask(KVMState *s, uint32_t dev_id, bool masked);
71 /*!
72 * \brief Notifies host kernel about a PCI device to be deassigned from a guest
74 * Used for hot remove PCI device, this function notifies the host
75 * kernel about the deassigning of the physical PCI device from a guest.
77 * \param kvm Pointer to the current kvm_context
78 * \param assigned_dev Parameters, like bus, devfn number, etc
80 int kvm_deassign_pci_device(KVMState *s,
81 struct kvm_assigned_pci_dev *assigned_dev);
83 struct kvm_irq_routing_entry;
85 void kvm_add_routing_entry(KVMState *s, struct kvm_irq_routing_entry *entry);
87 /*!
88 * \brief Removes a routing from the temporary irq routing table
90 * Remove a routing to the temporary irq routing table. Nothing is
91 * committed to the running VM.
93 int kvm_del_routing_entry(struct kvm_irq_routing_entry *entry);
95 /*!
96 * \brief Updates a routing in the temporary irq routing table
98 * Update a routing in the temporary irq routing table
99 * with a new value. entry type and GSI can not be changed.
100 * Nothing is committed to the running VM.
102 int kvm_update_routing_entry(struct kvm_irq_routing_entry *entry,
103 struct kvm_irq_routing_entry *newentry);
106 int kvm_assign_set_msix_nr(KVMState *s, struct kvm_assigned_msix_nr *msix_nr);
107 int kvm_assign_set_msix_entry(KVMState *s,
108 struct kvm_assigned_msix_entry *entry);
110 #endif /* CONFIG_KVM */
112 #endif