Skip to content

Commit 7a5fbc9

Browse files
Fenghua Yusuryasaimadhu
authored andcommitted
iommu/ioasid: Introduce a helper to check for valid PASIDs
Define a pasid_valid() helper to check if a given PASID is valid. [ bp: Massage commit message. ] Suggested-by: Ashok Raj <ashok.raj@intel.com> Suggested-by: Jacob Pan <jacob.jun.pan@linux.intel.com> Signed-off-by: Fenghua Yu <fenghua.yu@intel.com> Signed-off-by: Borislav Petkov <bp@suse.de> Reviewed-by: Tony Luck <tony.luck@intel.com> Reviewed-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Lu Baolu <baolu.lu@linux.intel.com> Link: https://lore.kernel.org/r/20220207230254.3342514-4-fenghua.yu@intel.com
1 parent 7a853c2 commit 7a5fbc9

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

include/linux/ioasid.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ void *ioasid_find(struct ioasid_set *set, ioasid_t ioasid,
4141
int ioasid_register_allocator(struct ioasid_allocator_ops *allocator);
4242
void ioasid_unregister_allocator(struct ioasid_allocator_ops *allocator);
4343
int ioasid_set_data(ioasid_t ioasid, void *data);
44+
static inline bool pasid_valid(ioasid_t ioasid)
45+
{
46+
return ioasid != INVALID_IOASID;
47+
}
4448

4549
#else /* !CONFIG_IOASID */
4650
static inline ioasid_t ioasid_alloc(struct ioasid_set *set, ioasid_t min,
@@ -78,5 +82,10 @@ static inline int ioasid_set_data(ioasid_t ioasid, void *data)
7882
return -ENOTSUPP;
7983
}
8084

85+
static inline bool pasid_valid(ioasid_t ioasid)
86+
{
87+
return false;
88+
}
89+
8190
#endif /* CONFIG_IOASID */
8291
#endif /* __LINUX_IOASID_H */

0 commit comments

Comments
 (0)