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
);
83 struct kvm_irq_routing_entry
;
85 void kvm_add_routing_entry(KVMState
*s
, struct kvm_irq_routing_entry
*entry
);
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
);
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 */