lkml.org 
[lkml]   [2015]   [Sep]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 10/10] iommu/amd: Copy the old ir table
Date
Signed-off-by: Baoquan He <bhe@redhat.com>
---
drivers/iommu/amd_iommu.c | 25 +++++++++++++++++++------
1 file changed, 19 insertions(+), 6 deletions(-)

diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
index 1e86f4c..f4f3e63 100644
--- a/drivers/iommu/amd_iommu.c
+++ b/drivers/iommu/amd_iommu.c
@@ -3683,12 +3683,25 @@ static struct irq_remap_table *get_irq_table(u16 devid, bool ioapic)

memset(table->table, 0, MAX_IRQS_PER_TABLE * sizeof(u32));

- if (ioapic) {
- int i;
-
- for (i = 0; i < 32; ++i)
- table->table[i] = IRTE_ALLOCATED;
- }
+ if (translation_pre_enabled()) {
+ u64 dte;
+ u64 old_intr_virt;
+ dte = amd_iommu_dev_table[devid].data[2];
+ dte &= DTE_IRQ_PHYS_ADDR_MASK;
+ old_intr_virt = ioremap_cache(dte, MAX_IRQS_PER_TABLE * sizeof(u32));
+ memcpy_fromio(table->table, old_intr_virt, MAX_IRQS_PER_TABLE * sizeof(u32));
+ iounmap(old_intr_virt);
+ iommu_flush_irt(iommu, devid);
+ }
+ else {
+
+ if (ioapic) {
+ int i;
+
+ for (i = 0; i < 32; ++i)
+ table->table[i] = IRTE_ALLOCATED;
+ }
+ }

irq_lookup_table[devid] = table;
set_dte_irq_entry(devid, table);
--
2.4.0


\
 
 \ /
  Last update: 2015-09-24 09:01    [W:0.097 / U:0.148 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site