1 /* SPDX-License-Identifier: GPL-2.0 */
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>
10 #ifndef __INTEL_PASID_H
11 #define __INTEL_PASID_H
14 #define PASID_MAX 0x20000
20 /* The representative of a 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 */