mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-07 17:53:56 -06:00
x86-iommu: introduce IEC notifiers
This patch introduces x86 IOMMU IEC (Interrupt Entry Cache) invalidation notifier list. When vIOMMU receives IEC invalidate request, all the registered units will be notified with specific invalidation requests. Intel IOMMU is the first provider that generates such a event. Signed-off-by: Peter Xu <peterx@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
parent
8b5ed7dffa
commit
02a2cbc872
5 changed files with 122 additions and 12 deletions
|
@ -22,6 +22,33 @@
|
|||
#include "hw/boards.h"
|
||||
#include "hw/i386/x86-iommu.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "trace.h"
|
||||
|
||||
void x86_iommu_iec_register_notifier(X86IOMMUState *iommu,
|
||||
iec_notify_fn fn, void *data)
|
||||
{
|
||||
IEC_Notifier *notifier = g_new0(IEC_Notifier, 1);
|
||||
|
||||
notifier->iec_notify = fn;
|
||||
notifier->private = data;
|
||||
|
||||
QLIST_INSERT_HEAD(&iommu->iec_notifiers, notifier, list);
|
||||
}
|
||||
|
||||
void x86_iommu_iec_notify_all(X86IOMMUState *iommu, bool global,
|
||||
uint32_t index, uint32_t mask)
|
||||
{
|
||||
IEC_Notifier *notifier;
|
||||
|
||||
trace_x86_iommu_iec_notify(global, index, mask);
|
||||
|
||||
QLIST_FOREACH(notifier, &iommu->iec_notifiers, list) {
|
||||
if (notifier->iec_notify) {
|
||||
notifier->iec_notify(notifier->private, global,
|
||||
index, mask);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Default X86 IOMMU device */
|
||||
static X86IOMMUState *x86_iommu_default = NULL;
|
||||
|
@ -46,7 +73,9 @@ X86IOMMUState *x86_iommu_get_default(void)
|
|||
|
||||
static void x86_iommu_realize(DeviceState *dev, Error **errp)
|
||||
{
|
||||
X86IOMMUState *x86_iommu = X86_IOMMU_DEVICE(dev);
|
||||
X86IOMMUClass *x86_class = X86_IOMMU_GET_CLASS(dev);
|
||||
QLIST_INIT(&x86_iommu->iec_notifiers);
|
||||
if (x86_class->realize) {
|
||||
x86_class->realize(dev, errp);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue