Commit c7b6bac9 authored by Fenghua Yu's avatar Fenghua Yu Committed by Borislav Petkov

drm, iommu: Change type of pasid to u32

PASID is defined as a few different types in iommu including "int",
"u32", and "unsigned int". To be consistent and to match with uapi
definitions, define PASID and its variations (e.g. max PASID) as "u32".
"u32" is also shorter and a little more explicit than "unsigned int".

No PASID type change in uapi although it defines PASID as __u64 in
some places.
Suggested-by: default avatarThomas Gleixner <tglx@linutronix.de>
Signed-off-by: default avatarFenghua Yu <fenghua.yu@intel.com>
Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
Reviewed-by: default avatarTony Luck <tony.luck@intel.com>
Reviewed-by: default avatarLu Baolu <baolu.lu@linux.intel.com>
Acked-by: default avatarFelix Kuehling <Felix.Kuehling@amd.com>
Acked-by: default avatarJoerg Roedel <jroedel@suse.de>
Link: https://lkml.kernel.org/r/1600187413-163670-2-git-send-email-fenghua.yu@intel.com
parent 856deb86
...@@ -207,11 +207,11 @@ uint8_t amdgpu_amdkfd_get_xgmi_hops_count(struct kgd_dev *dst, struct kgd_dev *s ...@@ -207,11 +207,11 @@ uint8_t amdgpu_amdkfd_get_xgmi_hops_count(struct kgd_dev *dst, struct kgd_dev *s
}) })
/* GPUVM API */ /* GPUVM API */
int amdgpu_amdkfd_gpuvm_create_process_vm(struct kgd_dev *kgd, unsigned int pasid, int amdgpu_amdkfd_gpuvm_create_process_vm(struct kgd_dev *kgd, u32 pasid,
void **vm, void **process_info, void **vm, void **process_info,
struct dma_fence **ef); struct dma_fence **ef);
int amdgpu_amdkfd_gpuvm_acquire_process_vm(struct kgd_dev *kgd, int amdgpu_amdkfd_gpuvm_acquire_process_vm(struct kgd_dev *kgd,
struct file *filp, unsigned int pasid, struct file *filp, u32 pasid,
void **vm, void **process_info, void **vm, void **process_info,
struct dma_fence **ef); struct dma_fence **ef);
void amdgpu_amdkfd_gpuvm_destroy_cb(struct amdgpu_device *adev, void amdgpu_amdkfd_gpuvm_destroy_cb(struct amdgpu_device *adev,
......
...@@ -105,7 +105,7 @@ static void kgd_program_sh_mem_settings(struct kgd_dev *kgd, uint32_t vmid, ...@@ -105,7 +105,7 @@ static void kgd_program_sh_mem_settings(struct kgd_dev *kgd, uint32_t vmid,
unlock_srbm(kgd); unlock_srbm(kgd);
} }
static int kgd_set_pasid_vmid_mapping(struct kgd_dev *kgd, unsigned int pasid, static int kgd_set_pasid_vmid_mapping(struct kgd_dev *kgd, u32 pasid,
unsigned int vmid) unsigned int vmid)
{ {
struct amdgpu_device *adev = get_amdgpu_device(kgd); struct amdgpu_device *adev = get_amdgpu_device(kgd);
......
...@@ -139,7 +139,7 @@ static void kgd_program_sh_mem_settings(struct kgd_dev *kgd, uint32_t vmid, ...@@ -139,7 +139,7 @@ static void kgd_program_sh_mem_settings(struct kgd_dev *kgd, uint32_t vmid,
unlock_srbm(kgd); unlock_srbm(kgd);
} }
static int kgd_set_pasid_vmid_mapping(struct kgd_dev *kgd, unsigned int pasid, static int kgd_set_pasid_vmid_mapping(struct kgd_dev *kgd, u32 pasid,
unsigned int vmid) unsigned int vmid)
{ {
struct amdgpu_device *adev = get_amdgpu_device(kgd); struct amdgpu_device *adev = get_amdgpu_device(kgd);
......
...@@ -96,7 +96,7 @@ static void kgd_program_sh_mem_settings(struct kgd_dev *kgd, uint32_t vmid, ...@@ -96,7 +96,7 @@ static void kgd_program_sh_mem_settings(struct kgd_dev *kgd, uint32_t vmid,
unlock_srbm(kgd); unlock_srbm(kgd);
} }
static int kgd_set_pasid_vmid_mapping(struct kgd_dev *kgd, unsigned int pasid, static int kgd_set_pasid_vmid_mapping(struct kgd_dev *kgd, u32 pasid,
unsigned int vmid) unsigned int vmid)
{ {
struct amdgpu_device *adev = get_amdgpu_device(kgd); struct amdgpu_device *adev = get_amdgpu_device(kgd);
......
...@@ -110,7 +110,7 @@ void kgd_gfx_v9_program_sh_mem_settings(struct kgd_dev *kgd, uint32_t vmid, ...@@ -110,7 +110,7 @@ void kgd_gfx_v9_program_sh_mem_settings(struct kgd_dev *kgd, uint32_t vmid,
unlock_srbm(kgd); unlock_srbm(kgd);
} }
int kgd_gfx_v9_set_pasid_vmid_mapping(struct kgd_dev *kgd, unsigned int pasid, int kgd_gfx_v9_set_pasid_vmid_mapping(struct kgd_dev *kgd, u32 pasid,
unsigned int vmid) unsigned int vmid)
{ {
struct amdgpu_device *adev = get_amdgpu_device(kgd); struct amdgpu_device *adev = get_amdgpu_device(kgd);
......
...@@ -26,7 +26,7 @@ void kgd_gfx_v9_program_sh_mem_settings(struct kgd_dev *kgd, uint32_t vmid, ...@@ -26,7 +26,7 @@ void kgd_gfx_v9_program_sh_mem_settings(struct kgd_dev *kgd, uint32_t vmid,
uint32_t sh_mem_config, uint32_t sh_mem_config,
uint32_t sh_mem_ape1_base, uint32_t sh_mem_ape1_limit, uint32_t sh_mem_ape1_base, uint32_t sh_mem_ape1_limit,
uint32_t sh_mem_bases); uint32_t sh_mem_bases);
int kgd_gfx_v9_set_pasid_vmid_mapping(struct kgd_dev *kgd, unsigned int pasid, int kgd_gfx_v9_set_pasid_vmid_mapping(struct kgd_dev *kgd, u32 pasid,
unsigned int vmid); unsigned int vmid);
int kgd_gfx_v9_init_interrupts(struct kgd_dev *kgd, uint32_t pipe_id); int kgd_gfx_v9_init_interrupts(struct kgd_dev *kgd, uint32_t pipe_id);
int kgd_gfx_v9_hqd_load(struct kgd_dev *kgd, void *mqd, uint32_t pipe_id, int kgd_gfx_v9_hqd_load(struct kgd_dev *kgd, void *mqd, uint32_t pipe_id,
......
...@@ -992,7 +992,7 @@ static int init_kfd_vm(struct amdgpu_vm *vm, void **process_info, ...@@ -992,7 +992,7 @@ static int init_kfd_vm(struct amdgpu_vm *vm, void **process_info,
return ret; return ret;
} }
int amdgpu_amdkfd_gpuvm_create_process_vm(struct kgd_dev *kgd, unsigned int pasid, int amdgpu_amdkfd_gpuvm_create_process_vm(struct kgd_dev *kgd, u32 pasid,
void **vm, void **process_info, void **vm, void **process_info,
struct dma_fence **ef) struct dma_fence **ef)
{ {
...@@ -1028,7 +1028,7 @@ int amdgpu_amdkfd_gpuvm_create_process_vm(struct kgd_dev *kgd, unsigned int pasi ...@@ -1028,7 +1028,7 @@ int amdgpu_amdkfd_gpuvm_create_process_vm(struct kgd_dev *kgd, unsigned int pasi
} }
int amdgpu_amdkfd_gpuvm_acquire_process_vm(struct kgd_dev *kgd, int amdgpu_amdkfd_gpuvm_acquire_process_vm(struct kgd_dev *kgd,
struct file *filp, unsigned int pasid, struct file *filp, u32 pasid,
void **vm, void **process_info, void **vm, void **process_info,
struct dma_fence **ef) struct dma_fence **ef)
{ {
......
...@@ -43,7 +43,7 @@ static DEFINE_IDA(amdgpu_pasid_ida); ...@@ -43,7 +43,7 @@ static DEFINE_IDA(amdgpu_pasid_ida);
/* Helper to free pasid from a fence callback */ /* Helper to free pasid from a fence callback */
struct amdgpu_pasid_cb { struct amdgpu_pasid_cb {
struct dma_fence_cb cb; struct dma_fence_cb cb;
unsigned int pasid; u32 pasid;
}; };
/** /**
...@@ -79,7 +79,7 @@ int amdgpu_pasid_alloc(unsigned int bits) ...@@ -79,7 +79,7 @@ int amdgpu_pasid_alloc(unsigned int bits)
* amdgpu_pasid_free - Free a PASID * amdgpu_pasid_free - Free a PASID
* @pasid: PASID to free * @pasid: PASID to free
*/ */
void amdgpu_pasid_free(unsigned int pasid) void amdgpu_pasid_free(u32 pasid)
{ {
trace_amdgpu_pasid_freed(pasid); trace_amdgpu_pasid_freed(pasid);
ida_simple_remove(&amdgpu_pasid_ida, pasid); ida_simple_remove(&amdgpu_pasid_ida, pasid);
...@@ -105,7 +105,7 @@ static void amdgpu_pasid_free_cb(struct dma_fence *fence, ...@@ -105,7 +105,7 @@ static void amdgpu_pasid_free_cb(struct dma_fence *fence,
* Free the pasid only after all the fences in resv are signaled. * Free the pasid only after all the fences in resv are signaled.
*/ */
void amdgpu_pasid_free_delayed(struct dma_resv *resv, void amdgpu_pasid_free_delayed(struct dma_resv *resv,
unsigned int pasid) u32 pasid)
{ {
struct dma_fence *fence, **fences; struct dma_fence *fence, **fences;
struct amdgpu_pasid_cb *cb; struct amdgpu_pasid_cb *cb;
......
...@@ -71,9 +71,9 @@ struct amdgpu_vmid_mgr { ...@@ -71,9 +71,9 @@ struct amdgpu_vmid_mgr {
}; };
int amdgpu_pasid_alloc(unsigned int bits); int amdgpu_pasid_alloc(unsigned int bits);
void amdgpu_pasid_free(unsigned int pasid); void amdgpu_pasid_free(u32 pasid);
void amdgpu_pasid_free_delayed(struct dma_resv *resv, void amdgpu_pasid_free_delayed(struct dma_resv *resv,
unsigned int pasid); u32 pasid);
bool amdgpu_vmid_had_gpu_reset(struct amdgpu_device *adev, bool amdgpu_vmid_had_gpu_reset(struct amdgpu_device *adev,
struct amdgpu_vmid *id); struct amdgpu_vmid *id);
......
...@@ -1084,7 +1084,7 @@ void amdgpu_driver_postclose_kms(struct drm_device *dev, ...@@ -1084,7 +1084,7 @@ void amdgpu_driver_postclose_kms(struct drm_device *dev,
struct amdgpu_fpriv *fpriv = file_priv->driver_priv; struct amdgpu_fpriv *fpriv = file_priv->driver_priv;
struct amdgpu_bo_list *list; struct amdgpu_bo_list *list;
struct amdgpu_bo *pd; struct amdgpu_bo *pd;
unsigned int pasid; u32 pasid;
int handle; int handle;
if (!fpriv) if (!fpriv)
......
...@@ -2785,7 +2785,7 @@ long amdgpu_vm_wait_idle(struct amdgpu_vm *vm, long timeout) ...@@ -2785,7 +2785,7 @@ long amdgpu_vm_wait_idle(struct amdgpu_vm *vm, long timeout)
* 0 for success, error for failure. * 0 for success, error for failure.
*/ */
int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm, int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm,
int vm_context, unsigned int pasid) int vm_context, u32 pasid)
{ {
struct amdgpu_bo_param bp; struct amdgpu_bo_param bp;
struct amdgpu_bo *root; struct amdgpu_bo *root;
...@@ -2956,7 +2956,7 @@ static int amdgpu_vm_check_clean_reserved(struct amdgpu_device *adev, ...@@ -2956,7 +2956,7 @@ static int amdgpu_vm_check_clean_reserved(struct amdgpu_device *adev,
* 0 for success, -errno for errors. * 0 for success, -errno for errors.
*/ */
int amdgpu_vm_make_compute(struct amdgpu_device *adev, struct amdgpu_vm *vm, int amdgpu_vm_make_compute(struct amdgpu_device *adev, struct amdgpu_vm *vm,
unsigned int pasid) u32 pasid)
{ {
bool pte_support_ats = (adev->asic_type == CHIP_RAVEN); bool pte_support_ats = (adev->asic_type == CHIP_RAVEN);
int r; int r;
...@@ -3254,7 +3254,7 @@ int amdgpu_vm_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) ...@@ -3254,7 +3254,7 @@ int amdgpu_vm_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
* @pasid: PASID identifier for VM * @pasid: PASID identifier for VM
* @task_info: task_info to fill. * @task_info: task_info to fill.
*/ */
void amdgpu_vm_get_task_info(struct amdgpu_device *adev, unsigned int pasid, void amdgpu_vm_get_task_info(struct amdgpu_device *adev, u32 pasid,
struct amdgpu_task_info *task_info) struct amdgpu_task_info *task_info)
{ {
struct amdgpu_vm *vm; struct amdgpu_vm *vm;
...@@ -3298,7 +3298,7 @@ void amdgpu_vm_set_task_info(struct amdgpu_vm *vm) ...@@ -3298,7 +3298,7 @@ void amdgpu_vm_set_task_info(struct amdgpu_vm *vm)
* Try to gracefully handle a VM fault. Return true if the fault was handled and * Try to gracefully handle a VM fault. Return true if the fault was handled and
* shouldn't be reported any more. * shouldn't be reported any more.
*/ */
bool amdgpu_vm_handle_fault(struct amdgpu_device *adev, unsigned int pasid, bool amdgpu_vm_handle_fault(struct amdgpu_device *adev, u32 pasid,
uint64_t addr) uint64_t addr)
{ {
struct amdgpu_bo *root; struct amdgpu_bo *root;
......
...@@ -372,8 +372,8 @@ void amdgpu_vm_manager_fini(struct amdgpu_device *adev); ...@@ -372,8 +372,8 @@ void amdgpu_vm_manager_fini(struct amdgpu_device *adev);
long amdgpu_vm_wait_idle(struct amdgpu_vm *vm, long timeout); long amdgpu_vm_wait_idle(struct amdgpu_vm *vm, long timeout);
int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm, int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm,
int vm_context, unsigned int pasid); int vm_context, u32 pasid);
int amdgpu_vm_make_compute(struct amdgpu_device *adev, struct amdgpu_vm *vm, unsigned int pasid); int amdgpu_vm_make_compute(struct amdgpu_device *adev, struct amdgpu_vm *vm, u32 pasid);
void amdgpu_vm_release_compute(struct amdgpu_device *adev, struct amdgpu_vm *vm); void amdgpu_vm_release_compute(struct amdgpu_device *adev, struct amdgpu_vm *vm);
void amdgpu_vm_fini(struct amdgpu_device *adev, struct amdgpu_vm *vm); void amdgpu_vm_fini(struct amdgpu_device *adev, struct amdgpu_vm *vm);
void amdgpu_vm_get_pd_bo(struct amdgpu_vm *vm, void amdgpu_vm_get_pd_bo(struct amdgpu_vm *vm,
...@@ -430,9 +430,9 @@ bool amdgpu_vm_need_pipeline_sync(struct amdgpu_ring *ring, ...@@ -430,9 +430,9 @@ bool amdgpu_vm_need_pipeline_sync(struct amdgpu_ring *ring,
struct amdgpu_job *job); struct amdgpu_job *job);
void amdgpu_vm_check_compute_bug(struct amdgpu_device *adev); void amdgpu_vm_check_compute_bug(struct amdgpu_device *adev);
void amdgpu_vm_get_task_info(struct amdgpu_device *adev, unsigned int pasid, void amdgpu_vm_get_task_info(struct amdgpu_device *adev, u32 pasid,
struct amdgpu_task_info *task_info); struct amdgpu_task_info *task_info);
bool amdgpu_vm_handle_fault(struct amdgpu_device *adev, unsigned int pasid, bool amdgpu_vm_handle_fault(struct amdgpu_device *adev, u32 pasid,
uint64_t addr); uint64_t addr);
void amdgpu_vm_set_task_info(struct amdgpu_vm *vm); void amdgpu_vm_set_task_info(struct amdgpu_vm *vm);
......
...@@ -91,7 +91,7 @@ static void cik_event_interrupt_wq(struct kfd_dev *dev, ...@@ -91,7 +91,7 @@ static void cik_event_interrupt_wq(struct kfd_dev *dev,
(const struct cik_ih_ring_entry *)ih_ring_entry; (const struct cik_ih_ring_entry *)ih_ring_entry;
uint32_t context_id = ihre->data & 0xfffffff; uint32_t context_id = ihre->data & 0xfffffff;
unsigned int vmid = (ihre->ring_id & 0x0000ff00) >> 8; unsigned int vmid = (ihre->ring_id & 0x0000ff00) >> 8;
unsigned int pasid = (ihre->ring_id & 0xffff0000) >> 16; u32 pasid = (ihre->ring_id & 0xffff0000) >> 16;
if (pasid == 0) if (pasid == 0)
return; return;
......
...@@ -45,7 +45,7 @@ static void dbgdev_address_watch_disable_nodiq(struct kfd_dev *dev) ...@@ -45,7 +45,7 @@ static void dbgdev_address_watch_disable_nodiq(struct kfd_dev *dev)
} }
static int dbgdev_diq_submit_ib(struct kfd_dbgdev *dbgdev, static int dbgdev_diq_submit_ib(struct kfd_dbgdev *dbgdev,
unsigned int pasid, uint64_t vmid0_address, u32 pasid, uint64_t vmid0_address,
uint32_t *packet_buff, size_t size_in_bytes) uint32_t *packet_buff, size_t size_in_bytes)
{ {
struct pm4__release_mem *rm_packet; struct pm4__release_mem *rm_packet;
......
...@@ -275,7 +275,7 @@ struct kfd_dbgdev { ...@@ -275,7 +275,7 @@ struct kfd_dbgdev {
}; };
struct kfd_dbgmgr { struct kfd_dbgmgr {
unsigned int pasid; u32 pasid;
struct kfd_dev *dev; struct kfd_dev *dev;
struct kfd_dbgdev *dbgdev; struct kfd_dbgdev *dbgdev;
}; };
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
#define CIK_HPD_EOP_BYTES (1U << CIK_HPD_EOP_BYTES_LOG2) #define CIK_HPD_EOP_BYTES (1U << CIK_HPD_EOP_BYTES_LOG2)
static int set_pasid_vmid_mapping(struct device_queue_manager *dqm, static int set_pasid_vmid_mapping(struct device_queue_manager *dqm,
unsigned int pasid, unsigned int vmid); u32 pasid, unsigned int vmid);
static int execute_queues_cpsch(struct device_queue_manager *dqm, static int execute_queues_cpsch(struct device_queue_manager *dqm,
enum kfd_unmap_queues_filter filter, enum kfd_unmap_queues_filter filter,
...@@ -948,7 +948,7 @@ static int unregister_process(struct device_queue_manager *dqm, ...@@ -948,7 +948,7 @@ static int unregister_process(struct device_queue_manager *dqm,
} }
static int static int
set_pasid_vmid_mapping(struct device_queue_manager *dqm, unsigned int pasid, set_pasid_vmid_mapping(struct device_queue_manager *dqm, u32 pasid,
unsigned int vmid) unsigned int vmid)
{ {
return dqm->dev->kfd2kgd->set_pasid_vmid_mapping( return dqm->dev->kfd2kgd->set_pasid_vmid_mapping(
...@@ -1979,8 +1979,7 @@ void device_queue_manager_uninit(struct device_queue_manager *dqm) ...@@ -1979,8 +1979,7 @@ void device_queue_manager_uninit(struct device_queue_manager *dqm)
kfree(dqm); kfree(dqm);
} }
int kfd_process_vm_fault(struct device_queue_manager *dqm, int kfd_process_vm_fault(struct device_queue_manager *dqm, u32 pasid)
unsigned int pasid)
{ {
struct kfd_process_device *pdd; struct kfd_process_device *pdd;
struct kfd_process *p = kfd_lookup_process_by_pasid(pasid); struct kfd_process *p = kfd_lookup_process_by_pasid(pasid);
......
...@@ -460,7 +460,7 @@ static void set_event_from_interrupt(struct kfd_process *p, ...@@ -460,7 +460,7 @@ static void set_event_from_interrupt(struct kfd_process *p,
} }
} }
void kfd_signal_event_interrupt(unsigned int pasid, uint32_t partial_id, void kfd_signal_event_interrupt(u32 pasid, uint32_t partial_id,
uint32_t valid_id_bits) uint32_t valid_id_bits)
{ {
struct kfd_event *ev = NULL; struct kfd_event *ev = NULL;
...@@ -872,7 +872,7 @@ static void lookup_events_by_type_and_signal(struct kfd_process *p, ...@@ -872,7 +872,7 @@ static void lookup_events_by_type_and_signal(struct kfd_process *p,
} }
#ifdef KFD_SUPPORT_IOMMU_V2 #ifdef KFD_SUPPORT_IOMMU_V2
void kfd_signal_iommu_event(struct kfd_dev *dev, unsigned int pasid, void kfd_signal_iommu_event(struct kfd_dev *dev, u32 pasid,
unsigned long address, bool is_write_requested, unsigned long address, bool is_write_requested,
bool is_execute_requested) bool is_execute_requested)
{ {
...@@ -950,7 +950,7 @@ void kfd_signal_iommu_event(struct kfd_dev *dev, unsigned int pasid, ...@@ -950,7 +950,7 @@ void kfd_signal_iommu_event(struct kfd_dev *dev, unsigned int pasid,
} }
#endif /* KFD_SUPPORT_IOMMU_V2 */ #endif /* KFD_SUPPORT_IOMMU_V2 */
void kfd_signal_hw_exception_event(unsigned int pasid) void kfd_signal_hw_exception_event(u32 pasid)
{ {
/* /*
* Because we are called from arbitrary context (workqueue) as opposed * Because we are called from arbitrary context (workqueue) as opposed
...@@ -971,7 +971,7 @@ void kfd_signal_hw_exception_event(unsigned int pasid) ...@@ -971,7 +971,7 @@ void kfd_signal_hw_exception_event(unsigned int pasid)
kfd_unref_process(p); kfd_unref_process(p);
} }
void kfd_signal_vm_fault_event(struct kfd_dev *dev, unsigned int pasid, void kfd_signal_vm_fault_event(struct kfd_dev *dev, u32 pasid,
struct kfd_vm_fault_info *info) struct kfd_vm_fault_info *info)
{ {
struct kfd_event *ev; struct kfd_event *ev;
......
...@@ -79,7 +79,7 @@ struct kfd_event { ...@@ -79,7 +79,7 @@ struct kfd_event {
#define KFD_EVENT_TYPE_DEBUG 5 #define KFD_EVENT_TYPE_DEBUG 5
#define KFD_EVENT_TYPE_MEMORY 8 #define KFD_EVENT_TYPE_MEMORY 8
extern void kfd_signal_event_interrupt(unsigned int pasid, uint32_t partial_id, extern void kfd_signal_event_interrupt(u32 pasid, uint32_t partial_id,
uint32_t valid_id_bits); uint32_t valid_id_bits);
#endif #endif
...@@ -139,7 +139,7 @@ void kfd_iommu_unbind_process(struct kfd_process *p) ...@@ -139,7 +139,7 @@ void kfd_iommu_unbind_process(struct kfd_process *p)
} }
/* Callback for process shutdown invoked by the IOMMU driver */ /* Callback for process shutdown invoked by the IOMMU driver */
static void iommu_pasid_shutdown_callback(struct pci_dev *pdev, int pasid) static void iommu_pasid_shutdown_callback(struct pci_dev *pdev, u32 pasid)
{ {
struct kfd_dev *dev = kfd_device_by_pci_dev(pdev); struct kfd_dev *dev = kfd_device_by_pci_dev(pdev);
struct kfd_process *p; struct kfd_process *p;
...@@ -185,7 +185,7 @@ static void iommu_pasid_shutdown_callback(struct pci_dev *pdev, int pasid) ...@@ -185,7 +185,7 @@ static void iommu_pasid_shutdown_callback(struct pci_dev *pdev, int pasid)
} }
/* This function called by IOMMU driver on PPR failure */ /* This function called by IOMMU driver on PPR failure */
static int iommu_invalid_ppr_cb(struct pci_dev *pdev, int pasid, static int iommu_invalid_ppr_cb(struct pci_dev *pdev, u32 pasid,
unsigned long address, u16 flags) unsigned long address, u16 flags)
{ {
struct kfd_dev *dev; struct kfd_dev *dev;
......
...@@ -51,7 +51,7 @@ unsigned int kfd_get_pasid_limit(void) ...@@ -51,7 +51,7 @@ unsigned int kfd_get_pasid_limit(void)
return 1U << pasid_bits; return 1U << pasid_bits;
} }
unsigned int kfd_pasid_alloc(void) u32 kfd_pasid_alloc(void)
{ {
int r = amdgpu_pasid_alloc(pasid_bits); int r = amdgpu_pasid_alloc(pasid_bits);
...@@ -63,7 +63,7 @@ unsigned int kfd_pasid_alloc(void) ...@@ -63,7 +63,7 @@ unsigned int kfd_pasid_alloc(void)
return 0; return 0;
} }
void kfd_pasid_free(unsigned int pasid) void kfd_pasid_free(u32 pasid)
{ {
amdgpu_pasid_free(pasid); amdgpu_pasid_free(pasid);
} }
...@@ -723,7 +723,7 @@ struct kfd_process { ...@@ -723,7 +723,7 @@ struct kfd_process {
/* We want to receive a notification when the mm_struct is destroyed */ /* We want to receive a notification when the mm_struct is destroyed */
struct mmu_notifier mmu_notifier; struct mmu_notifier mmu_notifier;
uint16_t pasid; u32 pasid;
unsigned int doorbell_index; unsigned int doorbell_index;
/* /*
...@@ -800,7 +800,7 @@ int kfd_process_create_wq(void); ...@@ -800,7 +800,7 @@ int kfd_process_create_wq(void);
void kfd_process_destroy_wq(void); void kfd_process_destroy_wq(void);
struct kfd_process *kfd_create_process(struct file *filep); struct kfd_process *kfd_create_process(struct file *filep);
struct kfd_process *kfd_get_process(const struct task_struct *); struct kfd_process *kfd_get_process(const struct task_struct *);
struct kfd_process *kfd_lookup_process_by_pasid(unsigned int pasid); struct kfd_process *kfd_lookup_process_by_pasid(u32 pasid);
struct kfd_process *kfd_lookup_process_by_mm(const struct mm_struct *mm); struct kfd_process *kfd_lookup_process_by_mm(const struct mm_struct *mm);
void kfd_unref_process(struct kfd_process *p); void kfd_unref_process(struct kfd_process *p);
int kfd_process_evict_queues(struct kfd_process *p); int kfd_process_evict_queues(struct kfd_process *p);
...@@ -841,8 +841,8 @@ int kfd_pasid_init(void); ...@@ -841,8 +841,8 @@ int kfd_pasid_init(void);
void kfd_pasid_exit(void); void kfd_pasid_exit(void);
bool kfd_set_pasid_limit(unsigned int new_limit); bool kfd_set_pasid_limit(unsigned int new_limit);
unsigned int kfd_get_pasid_limit(void); unsigned int kfd_get_pasid_limit(void);
unsigned int kfd_pasid_alloc(void); u32 kfd_pasid_alloc(void);
void kfd_pasid_free(unsigned int pasid); void kfd_pasid_free(u32 pasid);
/* Doorbells */ /* Doorbells */
size_t kfd_doorbell_process_slice(struct kfd_dev *kfd); size_t kfd_doorbell_process_slice(struct kfd_dev *kfd);
...@@ -927,7 +927,7 @@ void device_queue_manager_uninit(struct device_queue_manager *dqm); ...@@ -927,7 +927,7 @@ void device_queue_manager_uninit(struct device_queue_manager *dqm);
struct kernel_queue *kernel_queue_init(struct kfd_dev *dev, struct kernel_queue *kernel_queue_init(struct kfd_dev *dev,
enum kfd_queue_type type); enum kfd_queue_type type);
void kernel_queue_uninit(struct kernel_queue *kq, bool hanging); void kernel_queue_uninit(struct kernel_queue *kq, bool hanging);
int kfd_process_vm_fault(struct device_queue_manager *dqm, unsigned int pasid); int kfd_process_vm_fault(struct device_queue_manager *dqm, u32 pasid);
/* Process Queue Manager */ /* Process Queue Manager */
struct process_queue_node { struct process_queue_node {
...@@ -1049,12 +1049,12 @@ int kfd_wait_on_events(struct kfd_process *p, ...@@ -1049,12 +1049,12 @@ int kfd_wait_on_events(struct kfd_process *p,
uint32_t num_events, void __user *data, uint32_t num_events, void __user *data,
bool all, uint32_t user_timeout_ms, bool all, uint32_t user_timeout_ms,
uint32_t *wait_result); uint32_t *wait_result);
void kfd_signal_event_interrupt(unsigned int pasid, uint32_t partial_id, void kfd_signal_event_interrupt(u32 pasid, uint32_t partial_id,
uint32_t valid_id_bits); uint32_t valid_id_bits);
void kfd_signal_iommu_event(struct kfd_dev *dev, void kfd_signal_iommu_event(struct kfd_dev *dev,
unsigned int pasid, unsigned long address, u32 pasid, unsigned long address,
bool is_write_requested, bool is_execute_requested); bool is_write_requested, bool is_execute_requested);
void kfd_signal_hw_exception_event(unsigned int pasid); void kfd_signal_hw_exception_event(u32 pasid);
int kfd_set_event(struct kfd_process *p, uint32_t event_id); int kfd_set_event(struct kfd_process *p, uint32_t event_id);
int kfd_reset_event(struct kfd_process *p, uint32_t event_id); int kfd_reset_event(struct kfd_process *p, uint32_t event_id);
int kfd_event_page_set(struct kfd_process *p, void *kernel_address, int kfd_event_page_set(struct kfd_process *p, void *kernel_address,
...@@ -1065,7 +1065,7 @@ int kfd_event_create(struct file *devkfd, struct kfd_process *p, ...@@ -1065,7 +1065,7 @@ int kfd_event_create(struct file *devkfd, struct kfd_process *p,
uint64_t *event_page_offset, uint32_t *event_slot_index); uint64_t *event_page_offset, uint32_t *event_slot_index);
int kfd_event_destroy(struct kfd_process *p, uint32_t event_id); int kfd_event_destroy(struct kfd_process *p, uint32_t event_id);
void kfd_signal_vm_fault_event(struct kfd_dev *dev, unsigned int pasid, void kfd_signal_vm_fault_event(struct kfd_dev *dev, u32 pasid,
struct kfd_vm_fault_info *info); struct kfd_vm_fault_info *info);
void kfd_signal_reset_event(struct kfd_dev *dev); void kfd_signal_reset_event(struct kfd_dev *dev);
......
...@@ -1306,7 +1306,7 @@ void kfd_process_device_remove_obj_handle(struct kfd_process_device *pdd, ...@@ -1306,7 +1306,7 @@ void kfd_process_device_remove_obj_handle(struct kfd_process_device *pdd,
} }
/* This increments the process->ref counter. */ /* This increments the process->ref counter. */
struct kfd_process *kfd_lookup_process_by_pasid(unsigned int pasid) struct kfd_process *kfd_lookup_process_by_pasid(u32 pasid)
{ {
struct kfd_process *p, *ret_p = NULL; struct kfd_process *p, *ret_p = NULL;
unsigned int temp; unsigned int temp;
......
...@@ -226,7 +226,7 @@ struct kfd2kgd_calls { ...@@ -226,7 +226,7 @@ struct kfd2kgd_calls {
uint32_t sh_mem_config, uint32_t sh_mem_ape1_base, uint32_t sh_mem_config, uint32_t sh_mem_ape1_base,
uint32_t sh_mem_ape1_limit, uint32_t sh_mem_bases); uint32_t sh_mem_ape1_limit, uint32_t sh_mem_bases);
int (*set_pasid_vmid_mapping)(struct kgd_dev *kgd, unsigned int pasid, int (*set_pasid_vmid_mapping)(struct kgd_dev *kgd, u32 pasid,
unsigned int vmid); unsigned int vmid);
int (*init_interrupts)(struct kgd_dev *kgd, uint32_t pipe_id); int (*init_interrupts)(struct kgd_dev *kgd, uint32_t pipe_id);
......
...@@ -45,12 +45,12 @@ extern int amd_iommu_register_ppr_notifier(struct notifier_block *nb); ...@@ -45,12 +45,12 @@ extern int amd_iommu_register_ppr_notifier(struct notifier_block *nb);
extern int amd_iommu_unregister_ppr_notifier(struct notifier_block *nb); extern int amd_iommu_unregister_ppr_notifier(struct notifier_block *nb);
extern void amd_iommu_domain_direct_map(struct iommu_domain *dom); extern void amd_iommu_domain_direct_map(struct iommu_domain *dom);
extern int amd_iommu_domain_enable_v2(struct iommu_domain *dom, int pasids); extern int amd_iommu_domain_enable_v2(struct iommu_domain *dom, int pasids);
extern int amd_iommu_flush_page(struct iommu_domain *dom, int pasid, extern int amd_iommu_flush_page(struct iommu_domain *dom, u32 pasid,
u64 address); u64 address);
extern int amd_iommu_flush_tlb(struct iommu_domain *dom, int pasid); extern int amd_iommu_flush_tlb(struct iommu_domain *dom, u32 pasid);
extern int amd_iommu_domain_set_gcr3(struct iommu_domain *dom, int pasid, extern int amd_iommu_domain_set_gcr3(struct iommu_domain *dom, u32 pasid,
unsigned long cr3); unsigned long cr3);
extern int amd_iommu_domain_clear_gcr3(struct iommu_domain *dom, int pasid); extern int amd_iommu_domain_clear_gcr3(struct iommu_domain *dom, u32 pasid);
extern struct iommu_domain *amd_iommu_get_v2_domain(struct pci_dev *pdev); extern struct iommu_domain *amd_iommu_get_v2_domain(struct pci_dev *pdev);
#ifdef CONFIG_IRQ_REMAP #ifdef CONFIG_IRQ_REMAP
...@@ -66,7 +66,7 @@ static inline int amd_iommu_create_irq_domain(struct amd_iommu *iommu) ...@@ -66,7 +66,7 @@ static inline int amd_iommu_create_irq_domain(struct amd_iommu *iommu)
#define PPR_INVALID 0x1 #define PPR_INVALID 0x1
#define PPR_FAILURE 0xf #define PPR_FAILURE 0xf
extern int amd_iommu_complete_ppr(struct pci_dev *pdev, int pasid, extern int amd_iommu_complete_ppr(struct pci_dev *pdev, u32 pasid,
int status, int tag); int status, int tag);
static inline bool is_rd890_iommu(struct pci_dev *pdev) static inline bool is_rd890_iommu(struct pci_dev *pdev)
......
...@@ -513,10 +513,11 @@ static void amd_iommu_report_page_fault(u16 devid, u16 domain_id, ...@@ -513,10 +513,11 @@ static void amd_iommu_report_page_fault(u16 devid, u16 domain_id,
static void iommu_print_event(struct amd_iommu *iommu, void *__evt) static void iommu_print_event(struct amd_iommu *iommu, void *__evt)
{ {
struct device *dev = iommu->iommu.dev; struct device *dev = iommu->iommu.dev;
int type, devid, pasid, flags, tag; int type, devid, flags, tag;
volatile u32 *event = __evt; volatile u32 *event = __evt;
int count = 0; int count = 0;
u64 address; u64 address;
u32 pasid;
retry: retry:
type = (event[1] >> EVENT_TYPE_SHIFT) & EVENT_TYPE_MASK; type = (event[1] >> EVENT_TYPE_SHIFT) & EVENT_TYPE_MASK;
...@@ -909,7 +910,7 @@ static void build_inv_iotlb_pages(struct iommu_cmd *cmd, u16 devid, int qdep, ...@@ -909,7 +910,7 @@ static void build_inv_iotlb_pages(struct iommu_cmd *cmd, u16 devid, int qdep,
cmd->data[2] |= CMD_INV_IOMMU_PAGES_SIZE_MASK; cmd->data[2] |= CMD_INV_IOMMU_PAGES_SIZE_MASK;
} }
static void build_inv_iommu_pasid(struct iommu_cmd *cmd, u16 domid, int pasid, static void build_inv_iommu_pasid(struct iommu_cmd *cmd, u16 domid, u32 pasid,
u64 address, bool size) u64 address, bool size)
{ {
memset(cmd, 0, sizeof(*cmd)); memset(cmd, 0, sizeof(*cmd));
...@@ -927,7 +928,7 @@ static void build_inv_iommu_pasid(struct iommu_cmd *cmd, u16 domid, int pasid, ...@@ -927,7 +928,7 @@ static void build_inv_iommu_pasid(struct iommu_cmd *cmd, u16 domid, int pasid,
CMD_SET_TYPE(cmd, CMD_INV_IOMMU_PAGES); CMD_SET_TYPE(cmd, CMD_INV_IOMMU_PAGES);
} }
static void build_inv_iotlb_pasid(struct iommu_cmd *cmd, u16 devid, int pasid, static void build_inv_iotlb_pasid(struct iommu_cmd *cmd, u16 devid, u32 pasid,
int qdep, u64 address, bool size) int qdep, u64 address, bool size)
{ {
memset(cmd, 0, sizeof(*cmd)); memset(cmd, 0, sizeof(*cmd));
...@@ -947,7 +948,7 @@ static void build_inv_iotlb_pasid(struct iommu_cmd *cmd, u16 devid, int pasid, ...@@ -947,7 +948,7 @@ static void build_inv_iotlb_pasid(struct iommu_cmd *cmd, u16 devid, int pasid,
CMD_SET_TYPE(cmd, CMD_INV_IOTLB_PAGES); CMD_SET_TYPE(cmd, CMD_INV_IOTLB_PAGES);
} }
static void build_complete_ppr(struct iommu_cmd *cmd, u16 devid, int pasid, static void build_complete_ppr(struct iommu_cmd *cmd, u16 devid, u32 pasid,
int status, int tag, bool gn) int status, int tag, bool gn)
{ {
memset(cmd, 0, sizeof(*cmd)); memset(cmd, 0, sizeof(*cmd));
...@@ -2786,7 +2787,7 @@ int amd_iommu_domain_enable_v2(struct iommu_domain *dom, int pasids) ...@@ -2786,7 +2787,7 @@ int amd_iommu_domain_enable_v2(struct iommu_domain *dom, int pasids)
} }
EXPORT_SYMBOL(amd_iommu_domain_enable_v2); EXPORT_SYMBOL(amd_iommu_domain_enable_v2);
static int __flush_pasid(struct protection_domain *domain, int pasid, static int __flush_pasid(struct protection_domain *domain, u32 pasid,
u64 address, bool size) u64 address, bool size)
{ {
struct iommu_dev_data *dev_data; struct iommu_dev_data *dev_data;
...@@ -2847,13 +2848,13 @@ static int __flush_pasid(struct protection_domain *domain, int pasid, ...@@ -2847,13 +2848,13 @@ static int __flush_pasid(struct protection_domain *domain, int pasid,
return ret; return ret;
} }
static int __amd_iommu_flush_page(struct protection_domain *domain, int pasid, static int __amd_iommu_flush_page(struct protection_domain *domain, u32 pasid,
u64 address) u64 address)
{ {
return __flush_pasid(domain, pasid, address, false); return __flush_pasid(domain, pasid, address, false);
} }
int amd_iommu_flush_page(struct iommu_domain *dom, int pasid, int amd_iommu_flush_page(struct iommu_domain *dom, u32 pasid,
u64 address) u64 address)
{ {
struct protection_domain *domain = to_pdomain(dom); struct protection_domain *domain = to_pdomain(dom);
...@@ -2868,13 +2869,13 @@ int amd_iommu_flush_page(struct iommu_domain *dom, int pasid, ...@@ -2868,13 +2869,13 @@ int amd_iommu_flush_page(struct iommu_domain *dom, int pasid,
} }
EXPORT_SYMBOL(amd_iommu_flush_page); EXPORT_SYMBOL(amd_iommu_flush_page);
static int __amd_iommu_flush_tlb(struct protection_domain *domain, int pasid) static int __amd_iommu_flush_tlb(struct protection_domain *domain, u32 pasid)
{ {
return __flush_pasid(domain, pasid, CMD_INV_IOMMU_ALL_PAGES_ADDRESS, return __flush_pasid(domain, pasid, CMD_INV_IOMMU_ALL_PAGES_ADDRESS,
true); true);
} }
int amd_iommu_flush_tlb(struct iommu_domain *dom, int pasid) int amd_iommu_flush_tlb(struct iommu_domain *dom, u32 pasid)
{ {
struct protection_domain *domain = to_pdomain(dom); struct protection_domain *domain = to_pdomain(dom);
unsigned long flags; unsigned long flags;
...@@ -2888,7 +2889,7 @@ int amd_iommu_flush_tlb(struct iommu_domain *dom, int pasid) ...@@ -2888,7 +2889,7 @@ int amd_iommu_flush_tlb(struct iommu_domain *dom, int pasid)
} }
EXPORT_SYMBOL(amd_iommu_flush_tlb); EXPORT_SYMBOL(amd_iommu_flush_tlb);
static u64 *__get_gcr3_pte(u64 *root, int level, int pasid, bool alloc) static u64 *__get_gcr3_pte(u64 *root, int level, u32 pasid, bool alloc)
{ {
int index; int index;
u64 *pte; u64 *pte;
...@@ -2920,7 +2921,7 @@ static u64 *__get_gcr3_pte(u64 *root, int level, int pasid, bool alloc) ...@@ -2920,7 +2921,7 @@ static u64 *__get_gcr3_pte(u64 *root, int level, int pasid, bool alloc)
return pte; return pte;
} }
static int __set_gcr3(struct protection_domain *domain, int pasid, static int __set_gcr3(struct protection_domain *domain, u32 pasid,
unsigned long cr3) unsigned long cr3)
{ {
struct domain_pgtable pgtable; struct domain_pgtable pgtable;
...@@ -2939,7 +2940,7 @@ static int __set_gcr3(struct protection_domain *domain, int pasid, ...@@ -2939,7 +2940,7 @@ static int __set_gcr3(struct protection_domain *domain, int pasid,
return __amd_iommu_flush_tlb(domain, pasid); return __amd_iommu_flush_tlb(domain, pasid);
} }
static int __clear_gcr3(struct protection_domain *domain, int pasid) static int __clear_gcr3(struct protection_domain *domain, u32 pasid)
{ {
struct domain_pgtable pgtable; struct domain_pgtable pgtable;
u64 *pte; u64 *pte;
...@@ -2957,7 +2958,7 @@ static int __clear_gcr3(struct protection_domain *domain, int pasid) ...@@ -2957,7 +2958,7 @@ static int __clear_gcr3(struct protection_domain *domain, int pasid)
return __amd_iommu_flush_tlb(domain, pasid); return __amd_iommu_flush_tlb(domain, pasid);
} }
int amd_iommu_domain_set_gcr3(struct iommu_domain *dom, int pasid, int amd_iommu_domain_set_gcr3(struct iommu_domain *dom, u32 pasid,
unsigned long cr3) unsigned long cr3)
{ {
struct protection_domain *domain = to_pdomain(dom); struct protection_domain *domain = to_pdomain(dom);
...@@ -2972,7 +2973,7 @@ int amd_iommu_domain_set_gcr3(struct iommu_domain *dom, int pasid, ...@@ -2972,7 +2973,7 @@ int amd_iommu_domain_set_gcr3(struct iommu_domain *dom, int pasid,
} }
EXPORT_SYMBOL(amd_iommu_domain_set_gcr3); EXPORT_SYMBOL(amd_iommu_domain_set_gcr3);
int amd_iommu_domain_clear_gcr3(struct iommu_domain *dom, int pasid) int amd_iommu_domain_clear_gcr3(struct iommu_domain *dom, u32 pasid)
{ {
struct protection_domain *domain = to_pdomain(dom); struct protection_domain *domain = to_pdomain(dom);
unsigned long flags; unsigned long flags;
...@@ -2986,7 +2987,7 @@ int amd_iommu_domain_clear_gcr3(struct iommu_domain *dom, int pasid) ...@@ -2986,7 +2987,7 @@ int amd_iommu_domain_clear_gcr3(struct iommu_domain *dom, int pasid)
} }
EXPORT_SYMBOL(amd_iommu_domain_clear_gcr3); EXPORT_SYMBOL(amd_iommu_domain_clear_gcr3);
int amd_iommu_complete_ppr(struct pci_dev *pdev, int pasid, int amd_iommu_complete_ppr(struct pci_dev *pdev, u32 pasid,
int status, int tag) int status, int tag)
{ {
struct iommu_dev_data *dev_data; struct iommu_dev_data *dev_data;
......
...@@ -40,7 +40,7 @@ struct pasid_state { ...@@ -40,7 +40,7 @@ struct pasid_state {
struct mmu_notifier mn; /* mmu_notifier handle */ struct mmu_notifier mn; /* mmu_notifier handle */
struct pri_queue pri[PRI_QUEUE_SIZE]; /* PRI tag states */ struct pri_queue pri[PRI_QUEUE_SIZE]; /* PRI tag states */
struct device_state *device_state; /* Link to our device_state */ struct device_state *device_state; /* Link to our device_state */
int pasid; /* PASID index */ u32 pasid; /* PASID index */
bool invalid; /* Used during setup and bool invalid; /* Used during setup and
teardown of the pasid */ teardown of the pasid */
spinlock_t lock; /* Protect pri_queues and spinlock_t lock; /* Protect pri_queues and
...@@ -70,7 +70,7 @@ struct fault { ...@@ -70,7 +70,7 @@ struct fault {
struct mm_struct *mm; struct mm_struct *mm;
u64 address; u64 address;
u16 devid; u16 devid;
u16 pasid; u32 pasid;
u16 tag; u16 tag;
u16 finish; u16 finish;
u16 flags; u16 flags;
...@@ -150,7 +150,7 @@ static void put_device_state(struct device_state *dev_state) ...@@ -150,7 +150,7 @@ static void put_device_state(struct device_state *dev_state)
/* Must be called under dev_state->lock */ /* Must be called under dev_state->lock */
static struct pasid_state **__get_pasid_state_ptr(struct device_state *dev_state, static struct pasid_state **__get_pasid_state_ptr(struct device_state *dev_state,
int pasid, bool alloc) u32 pasid, bool alloc)
{ {
struct pasid_state **root, **ptr; struct pasid_state **root, **ptr;
int level, index; int level, index;
...@@ -184,7 +184,7 @@ static struct pasid_state **__get_pasid_state_ptr(struct device_state *dev_state ...@@ -184,7 +184,7 @@ static struct pasid_state **__get_pasid_state_ptr(struct device_state *dev_state
static int set_pasid_state(struct device_state *dev_state, static int set_pasid_state(struct device_state *dev_state,
struct pasid_state *pasid_state, struct pasid_state *pasid_state,
int pasid) u32 pasid)
{ {
struct pasid_state **ptr; struct pasid_state **ptr;
unsigned long flags; unsigned long flags;
...@@ -211,7 +211,7 @@ static int set_pasid_state(struct device_state *dev_state, ...@@ -211,7 +211,7 @@ static int set_pasid_state(struct device_state *dev_state,
return ret; return ret;
} }
static void clear_pasid_state(struct device_state *dev_state, int pasid) static void clear_pasid_state(struct device_state *dev_state, u32 pasid)
{ {
struct pasid_state **ptr; struct pasid_state **ptr;
unsigned long flags; unsigned long flags;
...@@ -229,7 +229,7 @@ static void clear_pasid_state(struct device_state *dev_state, int pasid) ...@@ -229,7 +229,7 @@ static void clear_pasid_state(struct device_state *dev_state, int pasid)
} }
static struct pasid_state *get_pasid_state(struct device_state *dev_state, static struct pasid_state *get_pasid_state(struct device_state *dev_state,
int pasid) u32 pasid)
{ {
struct pasid_state **ptr, *ret = NULL; struct pasid_state **ptr, *ret = NULL;
unsigned long flags; unsigned long flags;
...@@ -594,7 +594,7 @@ static struct notifier_block ppr_nb = { ...@@ -594,7 +594,7 @@ static struct notifier_block ppr_nb = {
.notifier_call = ppr_notifier, .notifier_call = ppr_notifier,
}; };
int amd_iommu_bind_pasid(struct pci_dev *pdev, int pasid, int amd_iommu_bind_pasid(struct pci_dev *pdev, u32 pasid,
struct task_struct *task) struct task_struct *task)
{ {
struct pasid_state *pasid_state; struct pasid_state *pasid_state;
...@@ -615,7 +615,7 @@ int amd_iommu_bind_pasid(struct pci_dev *pdev, int pasid, ...@@ -615,7 +615,7 @@ int amd_iommu_bind_pasid(struct pci_dev *pdev, int pasid,
return -EINVAL; return -EINVAL;
ret = -EINVAL; ret = -EINVAL;
if (pasid < 0 || pasid >= dev_state->max_pasids) if (pasid >= dev_state->max_pasids)
goto out; goto out;
ret = -ENOMEM; ret = -ENOMEM;
...@@ -679,7 +679,7 @@ int amd_iommu_bind_pasid(struct pci_dev *pdev, int pasid, ...@@ -679,7 +679,7 @@ int amd_iommu_bind_pasid(struct pci_dev *pdev, int pasid,
} }
EXPORT_SYMBOL(amd_iommu_bind_pasid); EXPORT_SYMBOL(amd_iommu_bind_pasid);
void amd_iommu_unbind_pasid(struct pci_dev *pdev, int pasid) void amd_iommu_unbind_pasid(struct pci_dev *pdev, u32 pasid)
{ {
struct pasid_state *pasid_state; struct pasid_state *pasid_state;
struct device_state *dev_state; struct device_state *dev_state;
...@@ -695,7 +695,7 @@ void amd_iommu_unbind_pasid(struct pci_dev *pdev, int pasid) ...@@ -695,7 +695,7 @@ void amd_iommu_unbind_pasid(struct pci_dev *pdev, int pasid)
if (dev_state == NULL) if (dev_state == NULL)
return; return;
if (pasid < 0 || pasid >= dev_state->max_pasids) if (pasid >= dev_state->max_pasids)
goto out; goto out;
pasid_state = get_pasid_state(dev_state, pasid); pasid_state = get_pasid_state(dev_state, pasid);
......
...@@ -1482,7 +1482,7 @@ void qi_flush_dev_iotlb_pasid(struct intel_iommu *iommu, u16 sid, u16 pfsid, ...@@ -1482,7 +1482,7 @@ void qi_flush_dev_iotlb_pasid(struct intel_iommu *iommu, u16 sid, u16 pfsid,
} }
void qi_flush_pasid_cache(struct intel_iommu *iommu, u16 did, void qi_flush_pasid_cache(struct intel_iommu *iommu, u16 did,
u64 granu, int pasid) u64 granu, u32 pasid)
{ {
struct qi_desc desc = {.qw1 = 0, .qw2 = 0, .qw3 = 0}; struct qi_desc desc = {.qw1 = 0, .qw2 = 0, .qw3 = 0};
...@@ -1796,7 +1796,7 @@ void dmar_msi_read(int irq, struct msi_msg *msg) ...@@ -1796,7 +1796,7 @@ void dmar_msi_read(int irq, struct msi_msg *msg)
} }
static int dmar_fault_do_one(struct intel_iommu *iommu, int type, static int dmar_fault_do_one(struct intel_iommu *iommu, int type,
u8 fault_reason, int pasid, u16 source_id, u8 fault_reason, u32 pasid, u16 source_id,
unsigned long long addr) unsigned long long addr)
{ {
const char *reason; const char *reason;
...@@ -1846,7 +1846,8 @@ irqreturn_t dmar_fault(int irq, void *dev_id) ...@@ -1846,7 +1846,8 @@ irqreturn_t dmar_fault(int irq, void *dev_id)
u8 fault_reason; u8 fault_reason;
u16 source_id; u16 source_id;
u64 guest_addr; u64 guest_addr;
int type, pasid; u32 pasid;
int type;
u32 data; u32 data;
bool pasid_present; bool pasid_present;
......
...@@ -2527,7 +2527,7 @@ dmar_search_domain_by_dev_info(int segment, int bus, int devfn) ...@@ -2527,7 +2527,7 @@ dmar_search_domain_by_dev_info(int segment, int bus, int devfn)
static int domain_setup_first_level(struct intel_iommu *iommu, static int domain_setup_first_level(struct intel_iommu *iommu,
struct dmar_domain *domain, struct dmar_domain *domain,
struct device *dev, struct device *dev,
int pasid) u32 pasid)
{ {
int flags = PASID_FLAG_SUPERVISOR_MODE; int flags = PASID_FLAG_SUPERVISOR_MODE;
struct dma_pte *pgd = domain->pgd; struct dma_pte *pgd = domain->pgd;
...@@ -5173,7 +5173,7 @@ static int aux_domain_add_dev(struct dmar_domain *domain, ...@@ -5173,7 +5173,7 @@ static int aux_domain_add_dev(struct dmar_domain *domain,
return -ENODEV; return -ENODEV;
if (domain->default_pasid <= 0) { if (domain->default_pasid <= 0) {
int pasid; u32 pasid;
/* No private data needed for the default pasid */ /* No private data needed for the default pasid */
pasid = ioasid_alloc(NULL, PASID_MIN, pasid = ioasid_alloc(NULL, PASID_MIN,
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
static DEFINE_SPINLOCK(pasid_lock); static DEFINE_SPINLOCK(pasid_lock);
u32 intel_pasid_max_id = PASID_MAX; u32 intel_pasid_max_id = PASID_MAX;
int vcmd_alloc_pasid(struct intel_iommu *iommu, unsigned int *pasid) int vcmd_alloc_pasid(struct intel_iommu *iommu, u32 *pasid)
{ {
unsigned long flags; unsigned long flags;
u8 status_code; u8 status_code;
...@@ -58,7 +58,7 @@ int vcmd_alloc_pasid(struct intel_iommu *iommu, unsigned int *pasid) ...@@ -58,7 +58,7 @@ int vcmd_alloc_pasid(struct intel_iommu *iommu, unsigned int *pasid)
return ret; return ret;
} }
void vcmd_free_pasid(struct intel_iommu *iommu, unsigned int pasid) void vcmd_free_pasid(struct intel_iommu *iommu, u32 pasid)
{ {
unsigned long flags; unsigned long flags;
u8 status_code; u8 status_code;
...@@ -146,7 +146,7 @@ int intel_pasid_alloc_table(struct device *dev) ...@@ -146,7 +146,7 @@ int intel_pasid_alloc_table(struct device *dev)
struct pasid_table *pasid_table; struct pasid_table *pasid_table;
struct pasid_table_opaque data; struct pasid_table_opaque data;
struct page *pages; struct page *pages;
int max_pasid = 0; u32 max_pasid = 0;
int ret, order; int ret, order;
int size; int size;
...@@ -168,7 +168,7 @@ int intel_pasid_alloc_table(struct device *dev) ...@@ -168,7 +168,7 @@ int intel_pasid_alloc_table(struct device *dev)
INIT_LIST_HEAD(&pasid_table->dev); INIT_LIST_HEAD(&pasid_table->dev);
if (info->pasid_supported) if (info->pasid_supported)
max_pasid = min_t(int, pci_max_pasids(to_pci_dev(dev)), max_pasid = min_t(u32, pci_max_pasids(to_pci_dev(dev)),
intel_pasid_max_id); intel_pasid_max_id);
size = max_pasid >> (PASID_PDE_SHIFT - 3); size = max_pasid >> (PASID_PDE_SHIFT - 3);
...@@ -242,7 +242,7 @@ int intel_pasid_get_dev_max_id(struct device *dev) ...@@ -242,7 +242,7 @@ int intel_pasid_get_dev_max_id(struct device *dev)
return info->pasid_table->max_pasid; return info->pasid_table->max_pasid;
} }
struct pasid_entry *intel_pasid_get_entry(struct device *dev, int pasid) struct pasid_entry *intel_pasid_get_entry(struct device *dev, u32 pasid)
{ {
struct device_domain_info *info; struct device_domain_info *info;
struct pasid_table *pasid_table; struct pasid_table *pasid_table;
...@@ -251,8 +251,7 @@ struct pasid_entry *intel_pasid_get_entry(struct device *dev, int pasid) ...@@ -251,8 +251,7 @@ struct pasid_entry *intel_pasid_get_entry(struct device *dev, int pasid)
int dir_index, index; int dir_index, index;
pasid_table = intel_pasid_get_table(dev); pasid_table = intel_pasid_get_table(dev);
if (WARN_ON(!pasid_table || pasid < 0 || if (WARN_ON(!pasid_table || pasid >= intel_pasid_get_dev_max_id(dev)))
pasid >= intel_pasid_get_dev_max_id(dev)))
return NULL; return NULL;
dir = pasid_table->table; dir = pasid_table->table;
...@@ -305,7 +304,7 @@ static inline void pasid_clear_entry_with_fpd(struct pasid_entry *pe) ...@@ -305,7 +304,7 @@ static inline void pasid_clear_entry_with_fpd(struct pasid_entry *pe)
} }
static void static void
intel_pasid_clear_entry(struct device *dev, int pasid, bool fault_ignore) intel_pasid_clear_entry(struct device *dev, u32 pasid, bool fault_ignore)
{ {
struct pasid_entry *pe; struct pasid_entry *pe;
...@@ -444,7 +443,7 @@ pasid_set_eafe(struct pasid_entry *pe) ...@@ -444,7 +443,7 @@ pasid_set_eafe(struct pasid_entry *pe)
static void static void
pasid_cache_invalidation_with_pasid(struct intel_iommu *iommu, pasid_cache_invalidation_with_pasid(struct intel_iommu *iommu,
u16 did, int pasid) u16 did, u32 pasid)
{ {
struct qi_desc desc; struct qi_desc desc;
...@@ -473,7 +472,7 @@ iotlb_invalidation_with_pasid(struct intel_iommu *iommu, u16 did, u32 pasid) ...@@ -473,7 +472,7 @@ iotlb_invalidation_with_pasid(struct intel_iommu *iommu, u16 did, u32 pasid)
static void static void
devtlb_invalidation_with_pasid(struct intel_iommu *iommu, devtlb_invalidation_with_pasid(struct intel_iommu *iommu,
struct device *dev, int pasid) struct device *dev, u32 pasid)
{ {
struct device_domain_info *info; struct device_domain_info *info;
u16 sid, qdep, pfsid; u16 sid, qdep, pfsid;
...@@ -499,7 +498,7 @@ devtlb_invalidation_with_pasid(struct intel_iommu *iommu, ...@@ -499,7 +498,7 @@ devtlb_invalidation_with_pasid(struct intel_iommu *iommu,
} }
void intel_pasid_tear_down_entry(struct intel_iommu *iommu, struct device *dev, void intel_pasid_tear_down_entry(struct intel_iommu *iommu, struct device *dev,
int pasid, bool fault_ignore) u32 pasid, bool fault_ignore)
{ {
struct pasid_entry *pte; struct pasid_entry *pte;
u16 did; u16 did;
...@@ -524,7 +523,7 @@ void intel_pasid_tear_down_entry(struct intel_iommu *iommu, struct device *dev, ...@@ -524,7 +523,7 @@ void intel_pasid_tear_down_entry(struct intel_iommu *iommu, struct device *dev,
static void pasid_flush_caches(struct intel_iommu *iommu, static void pasid_flush_caches(struct intel_iommu *iommu,
struct pasid_entry *pte, struct pasid_entry *pte,
int pasid, u16 did) u32 pasid, u16 did)
{ {
if (!ecap_coherent(iommu->ecap)) if (!ecap_coherent(iommu->ecap))
clflush_cache_range(pte, sizeof(*pte)); clflush_cache_range(pte, sizeof(*pte));
...@@ -543,7 +542,7 @@ static void pasid_flush_caches(struct intel_iommu *iommu, ...@@ -543,7 +542,7 @@ static void pasid_flush_caches(struct intel_iommu *iommu,
*/ */
int intel_pasid_setup_first_level(struct intel_iommu *iommu, int intel_pasid_setup_first_level(struct intel_iommu *iommu,
struct device *dev, pgd_t *pgd, struct device *dev, pgd_t *pgd,
int pasid, u16 did, int flags) u32 pasid, u16 did, int flags)
{ {
struct pasid_entry *pte; struct pasid_entry *pte;
...@@ -616,7 +615,7 @@ static inline int iommu_skip_agaw(struct dmar_domain *domain, ...@@ -616,7 +615,7 @@ static inline int iommu_skip_agaw(struct dmar_domain *domain,
*/ */
int intel_pasid_setup_second_level(struct intel_iommu *iommu, int intel_pasid_setup_second_level(struct intel_iommu *iommu,
struct dmar_domain *domain, struct dmar_domain *domain,
struct device *dev, int pasid) struct device *dev, u32 pasid)
{ {
struct pasid_entry *pte; struct pasid_entry *pte;
struct dma_pte *pgd; struct dma_pte *pgd;
...@@ -674,7 +673,7 @@ int intel_pasid_setup_second_level(struct intel_iommu *iommu, ...@@ -674,7 +673,7 @@ int intel_pasid_setup_second_level(struct intel_iommu *iommu,
*/ */
int intel_pasid_setup_pass_through(struct intel_iommu *iommu, int intel_pasid_setup_pass_through(struct intel_iommu *iommu,
struct dmar_domain *domain, struct dmar_domain *domain,
struct device *dev, int pasid) struct device *dev, u32 pasid)
{ {
u16 did = FLPT_DEFAULT_DID; u16 did = FLPT_DEFAULT_DID;
struct pasid_entry *pte; struct pasid_entry *pte;
...@@ -760,7 +759,7 @@ intel_pasid_setup_bind_data(struct intel_iommu *iommu, struct pasid_entry *pte, ...@@ -760,7 +759,7 @@ intel_pasid_setup_bind_data(struct intel_iommu *iommu, struct pasid_entry *pte,
* @addr_width: Address width of the first level (guest) * @addr_width: Address width of the first level (guest)
*/ */
int intel_pasid_setup_nested(struct intel_iommu *iommu, struct device *dev, int intel_pasid_setup_nested(struct intel_iommu *iommu, struct device *dev,
pgd_t *gpgd, int pasid, pgd_t *gpgd, u32 pasid,
struct iommu_gpasid_bind_data_vtd *pasid_data, struct iommu_gpasid_bind_data_vtd *pasid_data,
struct dmar_domain *domain, int addr_width) struct dmar_domain *domain, int addr_width)
{ {
......
...@@ -72,7 +72,7 @@ struct pasid_entry { ...@@ -72,7 +72,7 @@ struct pasid_entry {
struct pasid_table { struct pasid_table {
void *table; /* pasid table pointer */ void *table; /* pasid table pointer */
int order; /* page order of pasid table */ int order; /* page order of pasid table */
int max_pasid; /* max pasid */ u32 max_pasid; /* max pasid */
struct list_head dev; /* device list */ struct list_head dev; /* device list */
}; };
...@@ -98,31 +98,31 @@ static inline bool pasid_pte_is_present(struct pasid_entry *pte) ...@@ -98,31 +98,31 @@ static inline bool pasid_pte_is_present(struct pasid_entry *pte)
return READ_ONCE(pte->val[0]) & PASID_PTE_PRESENT; return READ_ONCE(pte->val[0]) & PASID_PTE_PRESENT;
} }
extern u32 intel_pasid_max_id; extern unsigned int intel_pasid_max_id;
int intel_pasid_alloc_id(void *ptr, int start, int end, gfp_t gfp); int intel_pasid_alloc_id(void *ptr, int start, int end, gfp_t gfp);
void intel_pasid_free_id(int pasid); void intel_pasid_free_id(u32 pasid);
void *intel_pasid_lookup_id(int pasid); void *intel_pasid_lookup_id(u32 pasid);
int intel_pasid_alloc_table(struct device *dev); int intel_pasid_alloc_table(struct device *dev);
void intel_pasid_free_table(struct device *dev); void intel_pasid_free_table(struct device *dev);
struct pasid_table *intel_pasid_get_table(struct device *dev); struct pasid_table *intel_pasid_get_table(struct device *dev);
int intel_pasid_get_dev_max_id(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); struct pasid_entry *intel_pasid_get_entry(struct device *dev, u32 pasid);
int intel_pasid_setup_first_level(struct intel_iommu *iommu, int intel_pasid_setup_first_level(struct intel_iommu *iommu,
struct device *dev, pgd_t *pgd, struct device *dev, pgd_t *pgd,
int pasid, u16 did, int flags); u32 pasid, u16 did, int flags);
int intel_pasid_setup_second_level(struct intel_iommu *iommu, int intel_pasid_setup_second_level(struct intel_iommu *iommu,
struct dmar_domain *domain, struct dmar_domain *domain,
struct device *dev, int pasid); struct device *dev, u32 pasid);
int intel_pasid_setup_pass_through(struct intel_iommu *iommu, int intel_pasid_setup_pass_through(struct intel_iommu *iommu,
struct dmar_domain *domain, struct dmar_domain *domain,
struct device *dev, int pasid); struct device *dev, u32 pasid);
int intel_pasid_setup_nested(struct intel_iommu *iommu, int intel_pasid_setup_nested(struct intel_iommu *iommu,
struct device *dev, pgd_t *pgd, int pasid, struct device *dev, pgd_t *pgd, u32 pasid,
struct iommu_gpasid_bind_data_vtd *pasid_data, struct iommu_gpasid_bind_data_vtd *pasid_data,
struct dmar_domain *domain, int addr_width); struct dmar_domain *domain, int addr_width);
void intel_pasid_tear_down_entry(struct intel_iommu *iommu, void intel_pasid_tear_down_entry(struct intel_iommu *iommu,
struct device *dev, int pasid, struct device *dev, u32 pasid,
bool fault_ignore); bool fault_ignore);
int vcmd_alloc_pasid(struct intel_iommu *iommu, unsigned int *pasid); int vcmd_alloc_pasid(struct intel_iommu *iommu, u32 *pasid);
void vcmd_free_pasid(struct intel_iommu *iommu, unsigned int pasid); void vcmd_free_pasid(struct intel_iommu *iommu, u32 pasid);
#endif /* __INTEL_PASID_H */ #endif /* __INTEL_PASID_H */
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
#include "pasid.h" #include "pasid.h"
static irqreturn_t prq_event_thread(int irq, void *d); static irqreturn_t prq_event_thread(int irq, void *d);
static void intel_svm_drain_prq(struct device *dev, int pasid); static void intel_svm_drain_prq(struct device *dev, u32 pasid);
#define PRQ_ORDER 0 #define PRQ_ORDER 0
...@@ -399,7 +399,7 @@ int intel_svm_bind_gpasid(struct iommu_domain *domain, struct device *dev, ...@@ -399,7 +399,7 @@ int intel_svm_bind_gpasid(struct iommu_domain *domain, struct device *dev,
return ret; return ret;
} }
int intel_svm_unbind_gpasid(struct device *dev, int pasid) int intel_svm_unbind_gpasid(struct device *dev, u32 pasid)
{ {
struct intel_iommu *iommu = device_to_iommu(dev, NULL, NULL); struct intel_iommu *iommu = device_to_iommu(dev, NULL, NULL);
struct intel_svm_dev *sdev; struct intel_svm_dev *sdev;
...@@ -620,7 +620,7 @@ intel_svm_bind_mm(struct device *dev, int flags, struct svm_dev_ops *ops, ...@@ -620,7 +620,7 @@ intel_svm_bind_mm(struct device *dev, int flags, struct svm_dev_ops *ops,
} }
/* Caller must hold pasid_mutex */ /* Caller must hold pasid_mutex */
static int intel_svm_unbind_mm(struct device *dev, int pasid) static int intel_svm_unbind_mm(struct device *dev, u32 pasid)
{ {
struct intel_svm_dev *sdev; struct intel_svm_dev *sdev;
struct intel_iommu *iommu; struct intel_iommu *iommu;
...@@ -739,7 +739,7 @@ static bool is_canonical_address(u64 addr) ...@@ -739,7 +739,7 @@ static bool is_canonical_address(u64 addr)
* described in VT-d spec CH7.10 to drain all page requests and page * described in VT-d spec CH7.10 to drain all page requests and page
* responses pending in the hardware. * responses pending in the hardware.
*/ */
static void intel_svm_drain_prq(struct device *dev, int pasid) static void intel_svm_drain_prq(struct device *dev, u32 pasid)
{ {
struct device_domain_info *info; struct device_domain_info *info;
struct dmar_domain *domain; struct dmar_domain *domain;
...@@ -1067,10 +1067,10 @@ void intel_svm_unbind(struct iommu_sva *sva) ...@@ -1067,10 +1067,10 @@ void intel_svm_unbind(struct iommu_sva *sva)
mutex_unlock(&pasid_mutex); mutex_unlock(&pasid_mutex);
} }
int intel_svm_get_pasid(struct iommu_sva *sva) u32 intel_svm_get_pasid(struct iommu_sva *sva)
{ {
struct intel_svm_dev *sdev; struct intel_svm_dev *sdev;
int pasid; u32 pasid;
mutex_lock(&pasid_mutex); mutex_lock(&pasid_mutex);
sdev = to_intel_svm_dev(sva); sdev = to_intel_svm_dev(sva);
......
...@@ -2839,7 +2839,7 @@ void iommu_sva_unbind_device(struct iommu_sva *handle) ...@@ -2839,7 +2839,7 @@ void iommu_sva_unbind_device(struct iommu_sva *handle)
} }
EXPORT_SYMBOL_GPL(iommu_sva_unbind_device); EXPORT_SYMBOL_GPL(iommu_sva_unbind_device);
int iommu_sva_get_pasid(struct iommu_sva *handle) u32 iommu_sva_get_pasid(struct iommu_sva *handle)
{ {
const struct iommu_ops *ops = handle->dev->bus->iommu_ops; const struct iommu_ops *ops = handle->dev->bus->iommu_ops;
......
...@@ -93,7 +93,7 @@ static long uacce_fops_compat_ioctl(struct file *filep, ...@@ -93,7 +93,7 @@ static long uacce_fops_compat_ioctl(struct file *filep,
static int uacce_bind_queue(struct uacce_device *uacce, struct uacce_queue *q) static int uacce_bind_queue(struct uacce_device *uacce, struct uacce_queue *q)
{ {
int pasid; u32 pasid;
struct iommu_sva *handle; struct iommu_sva *handle;
if (!(uacce->flags & UACCE_DEV_SVA)) if (!(uacce->flags & UACCE_DEV_SVA))
......
...@@ -76,7 +76,7 @@ extern void amd_iommu_free_device(struct pci_dev *pdev); ...@@ -76,7 +76,7 @@ extern void amd_iommu_free_device(struct pci_dev *pdev);
* *
* The function returns 0 on success or a negative value on error. * The function returns 0 on success or a negative value on error.
*/ */
extern int amd_iommu_bind_pasid(struct pci_dev *pdev, int pasid, extern int amd_iommu_bind_pasid(struct pci_dev *pdev, u32 pasid,
struct task_struct *task); struct task_struct *task);
/** /**
...@@ -88,7 +88,7 @@ extern int amd_iommu_bind_pasid(struct pci_dev *pdev, int pasid, ...@@ -88,7 +88,7 @@ extern int amd_iommu_bind_pasid(struct pci_dev *pdev, int pasid,
* When this function returns the device is no longer using the PASID * When this function returns the device is no longer using the PASID
* and the PASID is no longer bound to its task. * and the PASID is no longer bound to its task.
*/ */
extern void amd_iommu_unbind_pasid(struct pci_dev *pdev, int pasid); extern void amd_iommu_unbind_pasid(struct pci_dev *pdev, u32 pasid);
/** /**
* amd_iommu_set_invalid_ppr_cb() - Register a call-back for failed * amd_iommu_set_invalid_ppr_cb() - Register a call-back for failed
...@@ -114,7 +114,7 @@ extern void amd_iommu_unbind_pasid(struct pci_dev *pdev, int pasid); ...@@ -114,7 +114,7 @@ extern void amd_iommu_unbind_pasid(struct pci_dev *pdev, int pasid);
#define AMD_IOMMU_INV_PRI_RSP_FAIL 2 #define AMD_IOMMU_INV_PRI_RSP_FAIL 2
typedef int (*amd_iommu_invalid_ppr_cb)(struct pci_dev *pdev, typedef int (*amd_iommu_invalid_ppr_cb)(struct pci_dev *pdev,
int pasid, u32 pasid,
unsigned long address, unsigned long address,
u16); u16);
...@@ -166,7 +166,7 @@ extern int amd_iommu_device_info(struct pci_dev *pdev, ...@@ -166,7 +166,7 @@ extern int amd_iommu_device_info(struct pci_dev *pdev,
* @cb: The call-back function * @cb: The call-back function
*/ */
typedef void (*amd_iommu_invalidate_ctx)(struct pci_dev *pdev, int pasid); typedef void (*amd_iommu_invalidate_ctx)(struct pci_dev *pdev, u32 pasid);
extern int amd_iommu_set_invalidate_ctx_cb(struct pci_dev *pdev, extern int amd_iommu_set_invalidate_ctx_cb(struct pci_dev *pdev,
amd_iommu_invalidate_ctx cb); amd_iommu_invalidate_ctx cb);
......
...@@ -549,7 +549,7 @@ struct dmar_domain { ...@@ -549,7 +549,7 @@ struct dmar_domain {
2 == 1GiB, 3 == 512GiB, 4 == 1TiB */ 2 == 1GiB, 3 == 512GiB, 4 == 1TiB */
u64 max_addr; /* maximum mapped address */ u64 max_addr; /* maximum mapped address */
int default_pasid; /* u32 default_pasid; /*
* The default pasid used for non-SVM * The default pasid used for non-SVM
* traffic on mediated devices. * traffic on mediated devices.
*/ */
...@@ -708,7 +708,7 @@ void qi_flush_dev_iotlb_pasid(struct intel_iommu *iommu, u16 sid, u16 pfsid, ...@@ -708,7 +708,7 @@ void qi_flush_dev_iotlb_pasid(struct intel_iommu *iommu, u16 sid, u16 pfsid,
u32 pasid, u16 qdep, u64 addr, u32 pasid, u16 qdep, u64 addr,
unsigned int size_order); unsigned int size_order);
void qi_flush_pasid_cache(struct intel_iommu *iommu, u16 did, u64 granu, void qi_flush_pasid_cache(struct intel_iommu *iommu, u16 did, u64 granu,
int pasid); u32 pasid);
int qi_submit_sync(struct intel_iommu *iommu, struct qi_desc *desc, int qi_submit_sync(struct intel_iommu *iommu, struct qi_desc *desc,
unsigned int count, unsigned long options); unsigned int count, unsigned long options);
...@@ -737,11 +737,11 @@ extern int intel_svm_enable_prq(struct intel_iommu *iommu); ...@@ -737,11 +737,11 @@ extern int intel_svm_enable_prq(struct intel_iommu *iommu);
extern int intel_svm_finish_prq(struct intel_iommu *iommu); extern int intel_svm_finish_prq(struct intel_iommu *iommu);
int intel_svm_bind_gpasid(struct iommu_domain *domain, struct device *dev, int intel_svm_bind_gpasid(struct iommu_domain *domain, struct device *dev,
struct iommu_gpasid_bind_data *data); struct iommu_gpasid_bind_data *data);
int intel_svm_unbind_gpasid(struct device *dev, int pasid); int intel_svm_unbind_gpasid(struct device *dev, u32 pasid);
struct iommu_sva *intel_svm_bind(struct device *dev, struct mm_struct *mm, struct iommu_sva *intel_svm_bind(struct device *dev, struct mm_struct *mm,
void *drvdata); void *drvdata);
void intel_svm_unbind(struct iommu_sva *handle); void intel_svm_unbind(struct iommu_sva *handle);
int intel_svm_get_pasid(struct iommu_sva *handle); u32 intel_svm_get_pasid(struct iommu_sva *handle);
int intel_svm_page_response(struct device *dev, struct iommu_fault_event *evt, int intel_svm_page_response(struct device *dev, struct iommu_fault_event *evt,
struct iommu_page_response *msg); struct iommu_page_response *msg);
...@@ -753,7 +753,7 @@ struct intel_svm_dev { ...@@ -753,7 +753,7 @@ struct intel_svm_dev {
struct device *dev; struct device *dev;
struct svm_dev_ops *ops; struct svm_dev_ops *ops;
struct iommu_sva sva; struct iommu_sva sva;
int pasid; u32 pasid;
int users; int users;
u16 did; u16 did;
u16 dev_iotlb:1; u16 dev_iotlb:1;
...@@ -766,7 +766,7 @@ struct intel_svm { ...@@ -766,7 +766,7 @@ struct intel_svm {
struct intel_iommu *iommu; struct intel_iommu *iommu;
int flags; int flags;
int pasid; u32 pasid;
int gpasid; /* In case that guest PASID is different from host PASID */ int gpasid; /* In case that guest PASID is different from host PASID */
struct list_head devs; struct list_head devs;
struct list_head list; struct list_head list;
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
struct device; struct device;
struct svm_dev_ops { struct svm_dev_ops {
void (*fault_cb)(struct device *dev, int pasid, u64 address, void (*fault_cb)(struct device *dev, u32 pasid, u64 address,
void *private, int rwxp, int response); void *private, int rwxp, int response);
}; };
......
...@@ -286,7 +286,7 @@ struct iommu_ops { ...@@ -286,7 +286,7 @@ struct iommu_ops {
struct iommu_sva *(*sva_bind)(struct device *dev, struct mm_struct *mm, struct iommu_sva *(*sva_bind)(struct device *dev, struct mm_struct *mm,
void *drvdata); void *drvdata);
void (*sva_unbind)(struct iommu_sva *handle); void (*sva_unbind)(struct iommu_sva *handle);
int (*sva_get_pasid)(struct iommu_sva *handle); u32 (*sva_get_pasid)(struct iommu_sva *handle);
int (*page_response)(struct device *dev, int (*page_response)(struct device *dev,
struct iommu_fault_event *evt, struct iommu_fault_event *evt,
...@@ -296,7 +296,7 @@ struct iommu_ops { ...@@ -296,7 +296,7 @@ struct iommu_ops {
int (*sva_bind_gpasid)(struct iommu_domain *domain, int (*sva_bind_gpasid)(struct iommu_domain *domain,
struct device *dev, struct iommu_gpasid_bind_data *data); struct device *dev, struct iommu_gpasid_bind_data *data);
int (*sva_unbind_gpasid)(struct device *dev, int pasid); int (*sva_unbind_gpasid)(struct device *dev, u32 pasid);
int (*def_domain_type)(struct device *dev); int (*def_domain_type)(struct device *dev);
...@@ -634,7 +634,7 @@ struct iommu_sva *iommu_sva_bind_device(struct device *dev, ...@@ -634,7 +634,7 @@ struct iommu_sva *iommu_sva_bind_device(struct device *dev,
struct mm_struct *mm, struct mm_struct *mm,
void *drvdata); void *drvdata);
void iommu_sva_unbind_device(struct iommu_sva *handle); void iommu_sva_unbind_device(struct iommu_sva *handle);
int iommu_sva_get_pasid(struct iommu_sva *handle); u32 iommu_sva_get_pasid(struct iommu_sva *handle);
#else /* CONFIG_IOMMU_API */ #else /* CONFIG_IOMMU_API */
...@@ -1027,7 +1027,7 @@ static inline void iommu_sva_unbind_device(struct iommu_sva *handle) ...@@ -1027,7 +1027,7 @@ static inline void iommu_sva_unbind_device(struct iommu_sva *handle)
{ {
} }
static inline int iommu_sva_get_pasid(struct iommu_sva *handle) static inline u32 iommu_sva_get_pasid(struct iommu_sva *handle)
{ {
return IOMMU_PASID_INVALID; return IOMMU_PASID_INVALID;
} }
...@@ -1046,7 +1046,7 @@ static inline int iommu_sva_bind_gpasid(struct iommu_domain *domain, ...@@ -1046,7 +1046,7 @@ static inline int iommu_sva_bind_gpasid(struct iommu_domain *domain,
} }
static inline int iommu_sva_unbind_gpasid(struct iommu_domain *domain, static inline int iommu_sva_unbind_gpasid(struct iommu_domain *domain,
struct device *dev, int pasid) struct device *dev, u32 pasid)
{ {
return -ENODEV; return -ENODEV;
} }
......
...@@ -81,7 +81,7 @@ struct uacce_queue { ...@@ -81,7 +81,7 @@ struct uacce_queue {
struct list_head list; struct list_head list;
struct uacce_qfile_region *qfrs[UACCE_MAX_REGION]; struct uacce_qfile_region *qfrs[UACCE_MAX_REGION];
enum uacce_q_state state; enum uacce_q_state state;
int pasid; u32 pasid;
struct iommu_sva *handle; struct iommu_sva *handle;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment