On 11/27/15 at 12:13pm, Joerg Roedel wrote:
> On Fri, Nov 06, 2015 at 08:10:46PM +0800, Baoquan He wrote:
> > +static void copy_irq_table(u16 devid)
> > +{
> > + struct irq_remap_table *table = NULL;
> > + u16 alias;
> > + u64 dte;
> > + u64 old_intr_virt;
> > +
> > + alias = amd_iommu_alias_table[devid];
> > + table = irq_lookup_table[alias];
> > + if (table) {
> > + irq_lookup_table[devid] = table;
> > + return;
> > + }
> > + dte = amd_iommu_dev_table[devid].data[2];
> > + dte &= DTE_IRQ_PHYS_ADDR_MASK;
> > + if(!dte)
> > + return;
>
> Better check the IV bit here to see if the remapping table address is
> valid.
OK, will change.
>
> > +
> > + table = kzalloc(sizeof(*table), GFP_ATOMIC);
> > + if (!table){
> > + pr_warn("AMD-Vi: amd irq table allocation failed\n");
> > + return;
> > + }
> > + dte &= DTE_IRQ_PHYS_ADDR_MASK;
>
> Applying this mask here is redundant.
Will remove it.
>
> > + old_intr_virt = ioremap_cache(dte, MAX_IRQS_PER_TABLE * sizeof(u32));
>
> The Intel code now uses the memremap interface. Please use it for this
> too.
Will do.
>
> > + table->table = old_intr_virt;
> > + //table->table = dte;
> > + irq_lookup_table[devid] = table;
>
> Hmm, you are reusing the old tables memory, is there a reason for this?
> Copying the old table into new memory is better because it keeps the old
> kernels memory as it was at crash time.
I forget why I didn't copy the old tables memory. Seems because
table->min_index can't be got in this place. I will try copying the irq
table.
_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu