aboutsummaryrefslogtreecommitdiff
path: root/hw/i386
diff options
context:
space:
mode:
authorPeter Xu <peterx@redhat.com>2017-06-09 21:53:29 +0800
committerMichael S. Tsirkin <mst@redhat.com>2017-06-16 18:44:56 +0300
commite7a3b91fdfa84c9028003b315ca959ea4de30363 (patch)
tree74085a15ebcea043c4a5abe7735fc2b6c21fd693 /hw/i386
parentb9313021f3115e4052966f1975022e4db2df665b (diff)
intel_iommu: cleanup vtd_interrupt_remap_msi()
Move the memcpy upper into where needed, then share the trace so that we trace every correct remapping. 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>
Diffstat (limited to 'hw/i386')
-rw-r--r--hw/i386/intel_iommu.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c
index 24bdd000fa..a9b59bdce5 100644
--- a/hw/i386/intel_iommu.c
+++ b/hw/i386/intel_iommu.c
@@ -2520,7 +2520,8 @@ static int vtd_interrupt_remap_msi(IntelIOMMUState *iommu,
trace_vtd_ir_remap_msi_req(origin->address, origin->data);
if (!iommu || !iommu->intr_enabled) {
- goto do_not_translate;
+ memcpy(translated, origin, sizeof(*origin));
+ goto out;
}
if (origin->address & VTD_MSI_ADDR_HI_MASK) {
@@ -2537,7 +2538,8 @@ static int vtd_interrupt_remap_msi(IntelIOMMUState *iommu,
/* This is compatible mode. */
if (addr.addr.int_mode != VTD_IR_INT_FORMAT_REMAP) {
- goto do_not_translate;
+ memcpy(translated, origin, sizeof(*origin));
+ goto out;
}
index = addr.addr.index_h << 15 | le16_to_cpu(addr.addr.index_l);
@@ -2589,13 +2591,9 @@ static int vtd_interrupt_remap_msi(IntelIOMMUState *iommu,
/* Translate VTDIrq to MSI message */
vtd_generate_msi_message(&irq, translated);
+out:
trace_vtd_ir_remap_msi(origin->address, origin->data,
translated->address, translated->data);
-
- return 0;
-
-do_not_translate:
- memcpy(translated, origin, sizeof(*origin));
return 0;
}