mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-26 04:25:27 +08:00
0bbeb01a4f
In scalable mode, pasid structure is a two level table with a pasid directory table and a pasid table. Any pasid entry can be identified by a pasid value in below way. 1 9 6 5 0 .-----------------------.-------. | PASID | | '-----------------------'-------' .-------------. | | | | | | | | | | | | | .-----------. | .-------------. | | | |----->| PASID Entry | | | | | '-------------' | | | |Plus | | | .-----------. | | | |---->| DIR Entry |-------->| | | '-----------' '-------------' .---------. |Plus | | | Context | | | | | Entry |------->| | '---------' '-----------' This changes the pasid table APIs to support scalable mode PASID directory and PASID table. It also adds a helper to get the PASID table entry according to the pasid value. Cc: Ashok Raj <ashok.raj@intel.com> Cc: Jacob Pan <jacob.jun.pan@linux.intel.com> Cc: Kevin Tian <kevin.tian@intel.com> Signed-off-by: Sanjay Kumar <sanjay.k.kumar@intel.com> Signed-off-by: Liu Yi L <yi.l.liu@intel.com> Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com> Reviewed-by: Ashok Raj <ashok.raj@intel.com> Signed-off-by: Joerg Roedel <jroedel@suse.de>
48 lines
1.3 KiB
C
48 lines
1.3 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
/*
|
|
* intel-pasid.h - PASID idr, table and entry header
|
|
*
|
|
* Copyright (C) 2018 Intel Corporation
|
|
*
|
|
* Author: Lu Baolu <baolu.lu@linux.intel.com>
|
|
*/
|
|
|
|
#ifndef __INTEL_PASID_H
|
|
#define __INTEL_PASID_H
|
|
|
|
#define PASID_MIN 0x1
|
|
#define PASID_MAX 0x100000
|
|
#define PASID_PTE_MASK 0x3F
|
|
#define PASID_PTE_PRESENT 1
|
|
#define PDE_PFN_MASK PAGE_MASK
|
|
#define PASID_PDE_SHIFT 6
|
|
|
|
struct pasid_dir_entry {
|
|
u64 val;
|
|
};
|
|
|
|
struct pasid_entry {
|
|
u64 val[8];
|
|
};
|
|
|
|
/* The representative of a PASID table */
|
|
struct pasid_table {
|
|
void *table; /* pasid table pointer */
|
|
int order; /* page order of pasid table */
|
|
int max_pasid; /* max pasid */
|
|
struct list_head dev; /* device list */
|
|
};
|
|
|
|
extern u32 intel_pasid_max_id;
|
|
int intel_pasid_alloc_id(void *ptr, int start, int end, gfp_t gfp);
|
|
void intel_pasid_free_id(int pasid);
|
|
void *intel_pasid_lookup_id(int pasid);
|
|
int intel_pasid_alloc_table(struct device *dev);
|
|
void intel_pasid_free_table(struct device *dev);
|
|
struct pasid_table *intel_pasid_get_table(struct device *dev);
|
|
int intel_pasid_get_dev_max_id(struct device *dev);
|
|
struct pasid_entry *intel_pasid_get_entry(struct device *dev, int pasid);
|
|
void intel_pasid_clear_entry(struct device *dev, int pasid);
|
|
|
|
#endif /* __INTEL_PASID_H */
|