mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-12 18:56:44 +07:00
be9e6598ae
Pasid table memory allocation could return failure due to memory
shortage. Limit the pasid table size to 1MiB because current 8MiB
contiguous physical memory allocation can be hard to come by. W/o
a PASID table, the device could continue to work with only shared
virtual memory impacted. So, let's go ahead with context mapping
even the memory allocation for pasid table failed.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107783
Fixes: cc580e4126
("iommu/vt-d: Per PCI device pasid table interfaces")
Cc: Ashok Raj <ashok.raj@intel.com>
Cc: Jacob Pan <jacob.jun.pan@linux.intel.com>
Cc: Mika Westerberg <mika.westerberg@linux.intel.com>
Reported-and-tested-by: Pelton Kyle D <kyle.d.pelton@intel.com>
Tested-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
40 lines
1.1 KiB
C
40 lines
1.1 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 0x20000
|
|
|
|
struct pasid_entry {
|
|
u64 val;
|
|
};
|
|
|
|
/* 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 */
|