Skip to content

Commit fffaed1

Browse files
Jacob Panjoergroedel
authored andcommitted
iommu/ioasid: Rename INVALID_IOASID
INVALID_IOASID and IOMMU_PASID_INVALID are duplicated. Rename INVALID_IOASID and consolidate since we are moving away from IOASID infrastructure. Reviewed-by: Dave Jiang <dave.jiang@intel.com> Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> Reviewed-by: Kevin Tian <kevin.tian@intel.com> Reviewed-by: Lu Baolu <baolu.lu@linux.intel.com> Signed-off-by: Jacob Pan <jacob.jun.pan@linux.intel.com> Link: https://lore.kernel.org/r/20230322200803.869130-7-jacob.jun.pan@linux.intel.com Signed-off-by: Joerg Roedel <jroedel@suse.de>
1 parent 1a14bf0 commit fffaed1

12 files changed

Lines changed: 19 additions & 17 deletions

File tree

Documentation/x86/sva.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ process share the same page tables, thus the same MSR value.
107107
PASID Life Cycle Management
108108
===========================
109109

110-
PASID is initialized as INVALID_IOASID (-1) when a process is created.
110+
PASID is initialized as IOMMU_PASID_INVALID (-1) when a process is created.
111111

112112
Only processes that access SVA-capable devices need to have a PASID
113113
allocated. This allocation happens when a process opens/binds an SVA-capable

arch/x86/kernel/traps.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
#include <linux/io.h>
4141
#include <linux/hardirq.h>
4242
#include <linux/atomic.h>
43-
#include <linux/ioasid.h>
43+
#include <linux/iommu.h>
4444

4545
#include <asm/stacktrace.h>
4646
#include <asm/processor.h>

drivers/dma/idxd/device.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1194,7 +1194,7 @@ static void idxd_device_set_perm_entry(struct idxd_device *idxd,
11941194
{
11951195
union msix_perm mperm;
11961196

1197-
if (ie->pasid == INVALID_IOASID)
1197+
if (ie->pasid == IOMMU_PASID_INVALID)
11981198
return;
11991199

12001200
mperm.bits = 0;
@@ -1224,7 +1224,7 @@ void idxd_wq_free_irq(struct idxd_wq *wq)
12241224
idxd_device_clear_perm_entry(idxd, ie);
12251225
ie->vector = -1;
12261226
ie->int_handle = INVALID_INT_HANDLE;
1227-
ie->pasid = INVALID_IOASID;
1227+
ie->pasid = IOMMU_PASID_INVALID;
12281228
}
12291229

12301230
int idxd_wq_request_irq(struct idxd_wq *wq)
@@ -1240,7 +1240,7 @@ int idxd_wq_request_irq(struct idxd_wq *wq)
12401240

12411241
ie = &wq->ie;
12421242
ie->vector = pci_irq_vector(pdev, ie->id);
1243-
ie->pasid = device_pasid_enabled(idxd) ? idxd->pasid : INVALID_IOASID;
1243+
ie->pasid = device_pasid_enabled(idxd) ? idxd->pasid : IOMMU_PASID_INVALID;
12441244
idxd_device_set_perm_entry(idxd, ie);
12451245

12461246
rc = request_threaded_irq(ie->vector, NULL, idxd_wq_thread, 0, "idxd-portal", ie);
@@ -1265,7 +1265,7 @@ int idxd_wq_request_irq(struct idxd_wq *wq)
12651265
free_irq(ie->vector, ie);
12661266
err_irq:
12671267
idxd_device_clear_perm_entry(idxd, ie);
1268-
ie->pasid = INVALID_IOASID;
1268+
ie->pasid = IOMMU_PASID_INVALID;
12691269
return rc;
12701270
}
12711271

drivers/dma/idxd/idxd.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <linux/ioasid.h>
1414
#include <linux/bitmap.h>
1515
#include <linux/perf_event.h>
16+
#include <linux/iommu.h>
1617
#include <uapi/linux/idxd.h>
1718
#include "registers.h"
1819

drivers/dma/idxd/init.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ static int idxd_setup_interrupts(struct idxd_device *idxd)
105105
ie = idxd_get_ie(idxd, msix_idx);
106106
ie->id = msix_idx;
107107
ie->int_handle = INVALID_INT_HANDLE;
108-
ie->pasid = INVALID_IOASID;
108+
ie->pasid = IOMMU_PASID_INVALID;
109109

110110
spin_lock_init(&ie->list_lock);
111111
init_llist_head(&ie->pending_llist);

drivers/dma/idxd/irq.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ static void idxd_int_handle_revoke_drain(struct idxd_irq_entry *ie)
8080
desc.opcode = DSA_OPCODE_DRAIN;
8181
desc.priv = 1;
8282

83-
if (ie->pasid != INVALID_IOASID)
83+
if (ie->pasid != IOMMU_PASID_INVALID)
8484
desc.pasid = ie->pasid;
8585
desc.int_handle = ie->int_handle;
8686
portal = idxd_wq_portal_addr(wq);

drivers/iommu/intel/dmar.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1958,7 +1958,7 @@ static int dmar_fault_do_one(struct intel_iommu *iommu, int type,
19581958
return 0;
19591959
}
19601960

1961-
if (pasid == INVALID_IOASID)
1961+
if (pasid == IOMMU_PASID_INVALID)
19621962
pr_err("[%s NO_PASID] Request device [%02x:%02x.%d] fault addr 0x%llx [fault reason 0x%02x] %s\n",
19631963
type ? "DMA Read" : "DMA Write",
19641964
source_id >> 8, PCI_SLOT(source_id & 0xFF),
@@ -2039,7 +2039,7 @@ irqreturn_t dmar_fault(int irq, void *dev_id)
20392039
if (!ratelimited)
20402040
/* Using pasid -1 if pasid is not present */
20412041
dmar_fault_do_one(iommu, type, fault_reason,
2042-
pasid_present ? pasid : INVALID_IOASID,
2042+
pasid_present ? pasid : IOMMU_PASID_INVALID,
20432043
source_id, guest_addr);
20442044

20452045
fault_index++;

drivers/iommu/intel/iommu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -876,7 +876,7 @@ void dmar_fault_dump_ptes(struct intel_iommu *iommu, u16 source_id,
876876
return;
877877
}
878878
/* For request-without-pasid, get the pasid from context entry */
879-
if (intel_iommu_sm && pasid == INVALID_IOASID)
879+
if (intel_iommu_sm && pasid == IOMMU_PASID_INVALID)
880880
pasid = PASID_RID2PASID;
881881

882882
dir_index = pasid >> PASID_PDE_SHIFT;

drivers/iommu/intel/svm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ static int pasid_to_svm_sdev(struct device *dev, unsigned int pasid,
273273
if (WARN_ON(!mutex_is_locked(&pasid_mutex)))
274274
return -EINVAL;
275275

276-
if (pasid == INVALID_IOASID || pasid >= PASID_MAX)
276+
if (pasid == IOMMU_PASID_INVALID || pasid >= PASID_MAX)
277277
return -EINVAL;
278278

279279
svm = pasid_private_find(pasid);

include/linux/ioasid.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include <linux/iommu.h>
88

99
typedef unsigned int ioasid_t;
10+
#define INVALID_IOASID ((ioasid_t)-1)
1011
typedef ioasid_t (*ioasid_alloc_fn_t)(ioasid_t min, ioasid_t max, void *data);
1112
typedef void (*ioasid_free_fn_t)(ioasid_t ioasid, void *data);
1213

0 commit comments

Comments
 (0)