LDLIBS += $(LDLIBS_libxencall)
SRCS-y += core.c
-SRCS-y += emuirq.c
+SRCS-y += emuirq.c emuirq_unstable.c
LIB_OBJS := $(patsubst %.c,%.o,$(SRCS-y))
PIC_OBJS := $(patsubst %.c,%.opic,$(SRCS-y))
LIB += libxendevicemodel.so
endif
+# XXX These use unstable hypervisor interfaces
+emuirq_unstable.o emuirq_unstable.opic: CFLAGS += -D__XEN_TOOLS__
+
.PHONY: all
all: build
--- /dev/null
+/*
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <stdlib.h>
+#include <assert.h>
+#include <errno.h>
+
+#include "private.h"
+
+int xendevicemodel_inject_msi(xendevicemodel_handle *dm,
+ uint64_t addr, uint32_t data)
+{
+ xen_hvm_inject_msi_t *arg;
+ int ret = -1;
+
+ arg = xencall_alloc_buffer(dm->call, sizeof(*arg));
+ if ( arg == NULL )
+ {
+ LOGE(ERROR, "unable to allocate memory for inject MSI hypercall");
+ goto err;
+ }
+
+ arg->domid = dm->domid;
+ arg->addr = addr;
+ arg->data = data;
+
+ ret = xencall2(dm->call, __HYPERVISOR_hvm_op,
+ HVMOP_inject_msi,
+ (uintptr_t)arg);
+
+ if ( ret )
+ LOGE(ERROR, "inject MSI hypercall failed");
+
+ xencall_free_buffer(dm->call, arg);
+
+ err:
+ return ret;
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
* @isa_irq ISA IRQ 0..15 (inclusive).
* @assert Whether the given interrupt of the given type should be
* asserted or deasserted.
+ *
+ * For MSI injection is as if a device had written @data to guest
+ * physical address @addr.
*/
int xendevicemodel_set_pci_intx_level(xendevicemodel_handle *dm,
uint8_t domain, uint8_t bus, uint8_t dev,
int xendevicemodel_set_isa_irq_level(xendevicemodel_handle *dm,
uint8_t isa_irq, bool assert);
+int xendevicemodel_inject_msi(xendevicemodel_handle *dm,
+ uint64_t addr, uint32_t data);
+
/*
* Memory handling
* ===============