Merge tag 'for-gkh' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma
[linux/fpc-iii.git] / drivers / iommu / intel-pasid.h
blob1fb5e12b029ac717379ec74544c83254ea0c0259
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3 * intel-pasid.h - PASID idr, table and entry header
5 * Copyright (C) 2018 Intel Corporation
7 * Author: Lu Baolu <baolu.lu@linux.intel.com>
8 */
10 #ifndef __INTEL_PASID_H
11 #define __INTEL_PASID_H
13 #define PASID_MIN 0x1
14 #define PASID_MAX 0x20000
16 struct pasid_entry {
17 u64 val;
20 /* The representative of a PASID table */
21 struct pasid_table {
22 void *table; /* pasid table pointer */
23 int order; /* page order of pasid table */
24 int max_pasid; /* max pasid */
25 struct list_head dev; /* device list */
28 extern u32 intel_pasid_max_id;
29 int intel_pasid_alloc_id(void *ptr, int start, int end, gfp_t gfp);
30 void intel_pasid_free_id(int pasid);
31 void *intel_pasid_lookup_id(int pasid);
32 int intel_pasid_alloc_table(struct device *dev);
33 void intel_pasid_free_table(struct device *dev);
34 struct pasid_table *intel_pasid_get_table(struct device *dev);
35 int intel_pasid_get_dev_max_id(struct device *dev);
36 struct pasid_entry *intel_pasid_get_entry(struct device *dev, int pasid);
37 void intel_pasid_clear_entry(struct device *dev, int pasid);
39 #endif /* __INTEL_PASID_H */