4 * Copyright (C) 2006-2008 Qumranet Technologies
6 * Licensed under the terms of the GNU GPL version 2 or higher.
8 #ifndef THE_ORIGINAL_AND_TRUE_QEMU_KVM_H
9 #define THE_ORIGINAL_AND_TRUE_QEMU_KVM_H
21 #define __user /* temporary, until installed via make headers_install */
24 #include <linux/kvm.h>
28 /* FIXME: share this number with kvm */
29 /* FIXME: or dynamically alloc/realloc regions */
30 #define KVM_MAX_NUM_MEM_REGIONS 32u
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
);
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
);
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
);
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
);
84 * \brief Clears the temporary irq routing table
86 * Clears the temporary irq routing table. Nothing is committed to the
90 int kvm_clear_gsi_routes(void);
93 * \brief Removes an irq route from the temporary irq routing table
95 * Adds an irq route to the temporary irq routing table. Nothing is
96 * committed to the running VM.
98 int kvm_del_irq_route(int gsi
, int irqchip
, int pin
);
100 struct kvm_irq_routing_entry
;
102 void kvm_add_routing_entry(KVMState
*s
, struct kvm_irq_routing_entry
*entry
);
105 * \brief Removes a routing from the temporary irq routing table
107 * Remove a routing to the temporary irq routing table. Nothing is
108 * committed to the running VM.
110 int kvm_del_routing_entry(struct kvm_irq_routing_entry
*entry
);
113 * \brief Updates a routing in the temporary irq routing table
115 * Update a routing in the temporary irq routing table
116 * with a new value. entry type and GSI can not be changed.
117 * Nothing is committed to the running VM.
119 int kvm_update_routing_entry(struct kvm_irq_routing_entry
*entry
,
120 struct kvm_irq_routing_entry
*newentry
);
123 int kvm_assign_set_msix_nr(KVMState
*s
, struct kvm_assigned_msix_nr
*msix_nr
);
124 int kvm_assign_set_msix_entry(KVMState
*s
,
125 struct kvm_assigned_msix_entry
*entry
);
127 #endif /* CONFIG_KVM */
129 int kvm_add_ioport_region(unsigned long start
, unsigned long size
,
131 int kvm_remove_ioport_region(unsigned long start
, unsigned long size
,
134 int kvm_update_ioport_access(CPUState
*env
);
135 int kvm_arch_set_ioport_access(unsigned long start
, unsigned long size
,