Commit c7d31124 authored by Suravee Suthikulpanit's avatar Suravee Suthikulpanit Committed by Joerg Roedel

iommu/amd: Update set_dte_irq_entry

Start using per PCI segment device table instead of global
device table.
Signed-off-by: default avatarSuravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Signed-off-by: default avatarVasant Hegde <vasant.hegde@amd.com>
Link: https://lore.kernel.org/r/20220706113825.25582-25-vasant.hegde@amd.comSigned-off-by: default avatarJoerg Roedel <jroedel@suse.de>
parent 4cc053d7
...@@ -2731,18 +2731,20 @@ EXPORT_SYMBOL(amd_iommu_device_info); ...@@ -2731,18 +2731,20 @@ EXPORT_SYMBOL(amd_iommu_device_info);
static struct irq_chip amd_ir_chip; static struct irq_chip amd_ir_chip;
static DEFINE_SPINLOCK(iommu_table_lock); static DEFINE_SPINLOCK(iommu_table_lock);
static void set_dte_irq_entry(u16 devid, struct irq_remap_table *table) static void set_dte_irq_entry(struct amd_iommu *iommu, u16 devid,
struct irq_remap_table *table)
{ {
u64 dte; u64 dte;
struct dev_table_entry *dev_table = get_dev_table(iommu);
dte = amd_iommu_dev_table[devid].data[2]; dte = dev_table[devid].data[2];
dte &= ~DTE_IRQ_PHYS_ADDR_MASK; dte &= ~DTE_IRQ_PHYS_ADDR_MASK;
dte |= iommu_virt_to_phys(table->table); dte |= iommu_virt_to_phys(table->table);
dte |= DTE_IRQ_REMAP_INTCTL; dte |= DTE_IRQ_REMAP_INTCTL;
dte |= DTE_INTTABLEN; dte |= DTE_INTTABLEN;
dte |= DTE_IRQ_REMAP_ENABLE; dte |= DTE_IRQ_REMAP_ENABLE;
amd_iommu_dev_table[devid].data[2] = dte; dev_table[devid].data[2] = dte;
} }
static struct irq_remap_table *get_irq_table(struct amd_iommu *iommu, u16 devid) static struct irq_remap_table *get_irq_table(struct amd_iommu *iommu, u16 devid)
...@@ -2793,7 +2795,7 @@ static void set_remap_table_entry(struct amd_iommu *iommu, u16 devid, ...@@ -2793,7 +2795,7 @@ static void set_remap_table_entry(struct amd_iommu *iommu, u16 devid,
struct amd_iommu_pci_seg *pci_seg = iommu->pci_seg; struct amd_iommu_pci_seg *pci_seg = iommu->pci_seg;
pci_seg->irq_lookup_table[devid] = table; pci_seg->irq_lookup_table[devid] = table;
set_dte_irq_entry(devid, table); set_dte_irq_entry(iommu, devid, table);
iommu_flush_dte(iommu, devid); iommu_flush_dte(iommu, devid);
} }
...@@ -2809,8 +2811,7 @@ static int set_remap_table_entry_alias(struct pci_dev *pdev, u16 alias, ...@@ -2809,8 +2811,7 @@ static int set_remap_table_entry_alias(struct pci_dev *pdev, u16 alias,
pci_seg = iommu->pci_seg; pci_seg = iommu->pci_seg;
pci_seg->irq_lookup_table[alias] = table; pci_seg->irq_lookup_table[alias] = table;
set_dte_irq_entry(alias, table); set_dte_irq_entry(iommu, alias, table);
iommu_flush_dte(pci_seg->rlookup_table[alias], alias); iommu_flush_dte(pci_seg->rlookup_table[alias], alias);
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment