Skip to content

Commit 249d332

Browse files
jgunthorpejoergroedel
authored andcommitted
iommu/vtd: Remove iommu_alloc_pages_node()
Intel is the only thing that uses this now, convert to the size versions, trying to avoid PAGE_SHIFT. Reviewed-by: Lu Baolu <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joerg Roedel <[email protected]>
1 parent c3b42b6 commit 249d332

File tree

5 files changed

+11
-26
lines changed

5 files changed

+11
-26
lines changed

drivers/iommu/intel/iommu.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -493,14 +493,13 @@ struct q_inval {
493493

494494
/* Page Request Queue depth */
495495
#define PRQ_ORDER 4
496-
#define PRQ_RING_MASK ((0x1000 << PRQ_ORDER) - 0x20)
497-
#define PRQ_DEPTH ((0x1000 << PRQ_ORDER) >> 5)
496+
#define PRQ_SIZE (SZ_4K << PRQ_ORDER)
497+
#define PRQ_RING_MASK (PRQ_SIZE - 0x20)
498+
#define PRQ_DEPTH (PRQ_SIZE >> 5)
498499

499500
struct dmar_pci_notify_info;
500501

501502
#ifdef CONFIG_IRQ_REMAP
502-
/* 1MB - maximum possible interrupt remapping table size */
503-
#define INTR_REMAP_PAGE_ORDER 8
504503
#define INTR_REMAP_TABLE_REG_SIZE 0xf
505504
#define INTR_REMAP_TABLE_REG_SIZE_MASK 0xf
506505

drivers/iommu/intel/irq_remapping.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -530,11 +530,11 @@ static int intel_setup_irq_remapping(struct intel_iommu *iommu)
530530
if (!ir_table)
531531
return -ENOMEM;
532532

533-
ir_table_base = iommu_alloc_pages_node(iommu->node, GFP_KERNEL,
534-
INTR_REMAP_PAGE_ORDER);
533+
/* 1MB - maximum possible interrupt remapping table size */
534+
ir_table_base =
535+
iommu_alloc_pages_node_sz(iommu->node, GFP_KERNEL, SZ_1M);
535536
if (!ir_table_base) {
536-
pr_err("IR%d: failed to allocate pages of order %d\n",
537-
iommu->seq_id, INTR_REMAP_PAGE_ORDER);
537+
pr_err("IR%d: failed to allocate 1M of pages\n", iommu->seq_id);
538538
goto out_free_table;
539539
}
540540

drivers/iommu/intel/pasid.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ int intel_pasid_alloc_table(struct device *dev)
6060

6161
size = max_pasid >> (PASID_PDE_SHIFT - 3);
6262
order = size ? get_order(size) : 0;
63-
dir = iommu_alloc_pages_node(info->iommu->node, GFP_KERNEL, order);
63+
dir = iommu_alloc_pages_node_sz(info->iommu->node, GFP_KERNEL,
64+
1 << (order + PAGE_SHIFT));
6465
if (!dir) {
6566
kfree(pasid_table);
6667
return -ENOMEM;

drivers/iommu/intel/prq.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,8 @@ int intel_iommu_enable_prq(struct intel_iommu *iommu)
290290
struct iopf_queue *iopfq;
291291
int irq, ret;
292292

293-
iommu->prq = iommu_alloc_pages_node(iommu->node, GFP_KERNEL, PRQ_ORDER);
293+
iommu->prq =
294+
iommu_alloc_pages_node_sz(iommu->node, GFP_KERNEL, PRQ_SIZE);
294295
if (!iommu->prq) {
295296
pr_warn("IOMMU: %s: Failed to allocate page request queue\n",
296297
iommu->name);

drivers/iommu/iommu-pages.h

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -84,22 +84,6 @@ static inline bool iommu_pages_list_empty(struct iommu_pages_list *list)
8484
return list_empty(&list->pages);
8585
}
8686

87-
/**
88-
* iommu_alloc_pages_node - Allocate a zeroed page of a given order from
89-
* specific NUMA node
90-
* @nid: memory NUMA node id
91-
* @gfp: buddy allocator flags
92-
* @order: page order
93-
*
94-
* Returns the virtual address of the allocated page.
95-
* Prefer to use iommu_alloc_pages_node_lg2()
96-
*/
97-
static inline void *iommu_alloc_pages_node(int nid, gfp_t gfp,
98-
unsigned int order)
99-
{
100-
return iommu_alloc_pages_node_sz(nid, gfp, 1 << (order + PAGE_SHIFT));
101-
}
102-
10387
/**
10488
* iommu_alloc_pages_sz - Allocate a zeroed page of a given size from
10589
* specific NUMA node

0 commit comments

Comments
 (0)