Skip to content

Commit

Permalink
iommu/ioasid: Introduce a helper to check for valid PASIDs
Browse files Browse the repository at this point in the history
Define a pasid_valid() helper to check if a given PASID is valid.

  [ bp: Massage commit message. ]

Suggested-by: Ashok Raj <[email protected]>
Suggested-by: Jacob Pan <[email protected]>
Signed-off-by: Fenghua Yu <[email protected]>
Signed-off-by: Borislav Petkov <[email protected]>
Reviewed-by: Tony Luck <[email protected]>
Reviewed-by: Thomas Gleixner <[email protected]>
Reviewed-by: Lu Baolu <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
  • Loading branch information
fyu1 authored and suryasaimadhu committed Feb 14, 2022
1 parent 7a853c2 commit 7a5fbc9
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions include/linux/ioasid.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ void *ioasid_find(struct ioasid_set *set, ioasid_t ioasid,
int ioasid_register_allocator(struct ioasid_allocator_ops *allocator);
void ioasid_unregister_allocator(struct ioasid_allocator_ops *allocator);
int ioasid_set_data(ioasid_t ioasid, void *data);
static inline bool pasid_valid(ioasid_t ioasid)
{
return ioasid != INVALID_IOASID;
}

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

static inline bool pasid_valid(ioasid_t ioasid)
{
return false;
}

#endif /* CONFIG_IOASID */
#endif /* __LINUX_IOASID_H */

0 comments on commit 7a5fbc9

Please sign in to comment.