Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1231885 > unrolled thread

[PATCH 10/10] iommu/amd: Copy the old ir table

Started byBaoquan He <bhe@redhat.com>
First post2015-09-24 08:40 +0200
Last post2015-09-29 18:20 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 10/10] iommu/amd: Copy the old ir table Baoquan He <bhe@redhat.com> - 2015-09-24 08:40 +0200
    Re: [PATCH 10/10] iommu/amd: Copy the old ir table Joerg Roedel <joro@8bytes.org> - 2015-09-29 18:20 +0200

#1231885 — [PATCH 10/10] iommu/amd: Copy the old ir table

FromBaoquan He <bhe@redhat.com>
Date2015-09-24 08:40 +0200
Subject[PATCH 10/10] iommu/amd: Copy the old ir table
Message-ID<qc8me-3vB-11@gated-at.bofh.it>
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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1235358

FromJoerg Roedel <joro@8bytes.org>
Date2015-09-29 18:20 +0200
Message-ID<qe5Nf-38N-5@gated-at.bofh.it>
In reply to#1231885
On Thu, Sep 24, 2015 at 02:37:36PM +0800, Baoquan He wrote:
> 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;
> +                }
> +        }

Is it necessary to copy the old ir tables? On AMD these tables are
per-device, so it is probably the best to handle them like the io
page-tables and just update the pointer to it in the device-table upon
interrupt initialization.


	Joerg

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web