| /kernel/linux/linux-6.6/drivers/iommu/arm/arm-smmu/ |
| D | qcom_iommu.c | 1 // SPDX-License-Identifier: GPL-2.0-only 3 * IOMMU API for QCOM secure IOMMUs. Somewhat based on arm-smmu.c 13 #include <linux/dma-mapping.h> 17 #include <linux/io-64-nonatomic-hi-lo.h> 18 #include <linux/io-pgtable.h> 33 #include "arm-smmu.h" 54 struct qcom_iommu_ctx *ctxs[]; /* indexed by asid */ 62 u8 asid; /* asid and ctx bank # are 1:1 */ member 86 if (!fwspec || fwspec->ops != &qcom_iommu_ops) in to_iommu() 92 static struct qcom_iommu_ctx * to_ctx(struct qcom_iommu_domain *d, unsigned asid) in to_ctx() argument [all …]
|
| /kernel/linux/linux-5.10/drivers/misc/habanalabs/common/ |
| D | context.c | 1 // SPDX-License-Identifier: GPL-2.0 4 * Copyright 2016-2019 HabanaLabs, Ltd. 12 static void hl_ctx_fini(struct hl_ctx *ctx) in hl_ctx_fini() argument 14 struct hl_device *hdev = ctx->hdev; in hl_ctx_fini() 26 for (i = 0 ; i < hdev->asic_prop.max_pending_cs ; i++) in hl_ctx_fini() 27 hl_fence_put(ctx->cs_pending[i]); in hl_ctx_fini() 29 kfree(ctx->cs_pending); in hl_ctx_fini() 31 if (ctx->asid != HL_KERNEL_ASID_ID) { in hl_ctx_fini() 32 dev_dbg(hdev->dev, "closing user context %d\n", ctx->asid); in hl_ctx_fini() 40 if ((hdev->in_debug) && (hdev->compute_ctx == ctx)) in hl_ctx_fini() [all …]
|
| D | command_submission.c | 1 // SPDX-License-Identifier: GPL-2.0 4 * Copyright 2016-2019 HabanaLabs, Ltd. 18 struct hl_ctx *ctx, u64 timeout_us, u64 seq); 25 struct hl_device *hdev = hw_sob->hdev; in hl_sob_reset() 27 hdev->asic_funcs->reset_sob(hdev, hw_sob); in hl_sob_reset() 34 struct hl_device *hdev = hw_sob->hdev; in hl_sob_reset_error() 36 dev_crit(hdev->dev, in hl_sob_reset_error() 38 hw_sob->q_idx, hw_sob->sob_id); in hl_sob_reset_error() 47 struct hl_device *hdev = hl_cs_cmpl->hdev; in hl_fence_release() 52 if (fence->error == -EBUSY) in hl_fence_release() [all …]
|
| D | mmu_v1.c | 1 // SPDX-License-Identifier: GPL-2.0 4 * Copyright 2016-2019 HabanaLabs, Ltd. 14 static inline u64 get_phys_addr(struct hl_ctx *ctx, u64 shadow_addr); 16 static struct pgt_info *get_pgt_info(struct hl_ctx *ctx, u64 hop_addr) in get_pgt_info() argument 20 hash_for_each_possible(ctx->mmu_shadow_hash, pgt_info, node, in get_pgt_info() 22 if (hop_addr == pgt_info->shadow_addr) in get_pgt_info() 28 static void _free_hop(struct hl_ctx *ctx, struct pgt_info *pgt_info) in _free_hop() argument 30 struct hl_device *hdev = ctx->hdev; in _free_hop() 32 gen_pool_free(hdev->mmu_priv.mmu_pgt_pool, pgt_info->phys_addr, in _free_hop() 33 hdev->asic_prop.mmu_hop_table_size); in _free_hop() [all …]
|
| D | memory.c | 1 // SPDX-License-Identifier: GPL-2.0 4 * Copyright 2016-2019 HabanaLabs, Ltd. 29 * two chunks - one to return as result and a remainder to stay in the list. 42 * alloc_device_memory - allocate device memory 44 * @ctx : current context 49 * - Allocate the requested size rounded up to 2MB pages 50 * - Return unique handle 52 static int alloc_device_memory(struct hl_ctx *ctx, struct hl_mem_in *args, in alloc_device_memory() argument 55 struct hl_device *hdev = ctx->hdev; in alloc_device_memory() 56 struct hl_vm *vm = &hdev->vm; in alloc_device_memory() [all …]
|
| D | debugfs.c | 1 // SPDX-License-Identifier: GPL-2.0 4 * Copyright 2016-2019 HabanaLabs, Ltd. 28 return -EBUSY; in hl_debugfs_i2c_read() 38 rc = hdev->asic_funcs->send_cpu_message(hdev, (u32 *) &pkt, sizeof(pkt), in hl_debugfs_i2c_read() 42 dev_err(hdev->dev, "Failed to read from I2C, error %d\n", rc); in hl_debugfs_i2c_read() 54 return -EBUSY; in hl_debugfs_i2c_write() 65 rc = hdev->asic_funcs->send_cpu_message(hdev, (u32 *) &pkt, sizeof(pkt), in hl_debugfs_i2c_write() 69 dev_err(hdev->dev, "Failed to write to I2C, error %d\n", rc); in hl_debugfs_i2c_write() 89 rc = hdev->asic_funcs->send_cpu_message(hdev, (u32 *) &pkt, sizeof(pkt), in hl_debugfs_led_set() 93 dev_err(hdev->dev, "Failed to set LED %d, error %d\n", led, rc); in hl_debugfs_led_set() [all …]
|
| D | habanalabs.h | 1 /* SPDX-License-Identifier: GPL-2.0 3 * Copyright 2016-2019 HabanaLabs, Ltd. 18 #include <linux/dma-direction.h> 26 * bits[63:62] - Encode mmap type 27 * bits[45:0] - mmap offset value 32 #define HL_MMAP_TYPE_SHIFT (62 - PAGE_SHIFT) 76 #define IS_POWER_OF_2(n) (n != 0 && ((n & (n - 1)) == 0)) 84 * struct pgt_info - MMU hop page info. 85 * @node: hash linked-list node for the pgts shadow hash of pgts. 88 * @ctx: pointer to the owner ctx. [all …]
|
| /kernel/linux/linux-6.6/drivers/accel/habanalabs/common/ |
| D | context.c | 1 // SPDX-License-Identifier: GPL-2.0 4 * Copyright 2016-2021 HabanaLabs, Ltd. 15 struct hl_encaps_signals_mgr *mgr = &handle->ctx->sig_mgr; in encaps_handle_do_release() 18 hw_sob_put(handle->hw_sob); in encaps_handle_do_release() 20 spin_lock(&mgr->lock); in encaps_handle_do_release() 21 idr_remove(&mgr->handles, handle->id); in encaps_handle_do_release() 22 spin_unlock(&mgr->lock); in encaps_handle_do_release() 25 hl_ctx_put(handle->ctx); in encaps_handle_do_release() 56 spin_lock_init(&mgr->lock); in hl_encaps_sig_mgr_init() 57 idr_init(&mgr->handles); in hl_encaps_sig_mgr_init() [all …]
|
| D | memory.c | 1 // SPDX-License-Identifier: GPL-2.0 4 * Copyright 2016-2022 HabanaLabs, Ltd. 15 #include <linux/pci-p2pdma.h> 21 /* use small pages for supporting non-pow2 (32M/40M/48M) DRAM phys page sizes */ 31 struct asic_fixed_properties *prop = &hdev->asic_prop; in set_alloc_page_size() 38 if (prop->supports_user_set_page_size && args->alloc.page_size) { in set_alloc_page_size() 39 psize = args->alloc.page_size; in set_alloc_page_size() 42 dev_err(hdev->dev, "user page size (%#llx) is not power of 2\n", psize); in set_alloc_page_size() 43 return -EINVAL; in set_alloc_page_size() 46 psize = prop->device_mem_alloc_default_page_size; in set_alloc_page_size() [all …]
|
| D | debugfs.c | 1 // SPDX-License-Identifier: GPL-2.0 4 * Copyright 2016-2021 HabanaLabs, Ltd. 30 return -EBUSY; in hl_debugfs_i2c_read() 33 dev_err(hdev->dev, "I2C transaction length %u, exceeds maximum of %u\n", in hl_debugfs_i2c_read() 35 return -EINVAL; in hl_debugfs_i2c_read() 47 rc = hdev->asic_funcs->send_cpu_message(hdev, (u32 *) &pkt, sizeof(pkt), in hl_debugfs_i2c_read() 50 dev_err(hdev->dev, "Failed to read from I2C, error %d\n", rc); in hl_debugfs_i2c_read() 62 return -EBUSY; in hl_debugfs_i2c_write() 65 dev_err(hdev->dev, "I2C transaction length %u, exceeds maximum of %u\n", in hl_debugfs_i2c_write() 67 return -EINVAL; in hl_debugfs_i2c_write() [all …]
|
| D | command_submission.c | 1 // SPDX-License-Identifier: GPL-2.0 4 * Copyright 2016-2021 HabanaLabs, Ltd. 23 * enum hl_cs_wait_status - cs wait status 35 static int _hl_cs_wait_ioctl(struct hl_device *hdev, struct hl_ctx *ctx, u64 timeout_us, u64 seq, 48 * push outcome - store a recent CS outcome in the store in hl_push_cs_outcome() 49 * pop outcome - retrieve a SPECIFIC (by seq) CS outcome from the store in hl_push_cs_outcome() 51 * It has a pre-allocated amount of nodes, each node stores in hl_push_cs_outcome() 66 spin_lock_irqsave(&outcome_store->db_lock, flags); in hl_push_cs_outcome() 68 if (list_empty(&outcome_store->free_list)) { in hl_push_cs_outcome() 69 node = list_last_entry(&outcome_store->used_list, in hl_push_cs_outcome() [all …]
|
| D | habanalabs.h | 1 /* SPDX-License-Identifier: GPL-2.0 3 * Copyright 2016-2022 HabanaLabs, Ltd. 19 #include <linux/dma-direction.h> 28 #include <linux/io-64-nonatomic-lo-hi.h> 30 #include <linux/dma-buf.h> 42 * bits[63:59] - Encode mmap type 43 * bits[45:0] - mmap offset value 48 #define HL_MMAP_TYPE_SHIFT (59 - PAGE_SHIFT) 107 * enum hl_mmu_page_table_location - mmu page table location 108 * @MMU_DR_PGT: page-table is located on device DRAM. [all …]
|
| /kernel/linux/linux-5.10/drivers/iommu/arm/arm-smmu/ |
| D | qcom_iommu.c | 1 // SPDX-License-Identifier: GPL-2.0-only 3 * IOMMU API for QCOM secure IOMMUs. Somewhat based on arm-smmu.c 13 #include <linux/dma-iommu.h> 14 #include <linux/dma-mapping.h> 18 #include <linux/io-64-nonatomic-hi-lo.h> 19 #include <linux/io-pgtable.h> 36 #include "arm-smmu.h" 57 struct qcom_iommu_ctx *ctxs[]; /* indexed by asid-1 */ 64 u8 asid; /* asid and ctx bank # are 1:1 */ member 88 if (!fwspec || fwspec->ops != &qcom_iommu_ops) in to_iommu() [all …]
|
| /kernel/linux/linux-5.10/arch/mips/mm/ |
| D | context.c | 1 // SPDX-License-Identifier: GPL-2.0 24 u64 asid; in get_new_mmu_context() local 34 asid = asid_cache(cpu); in get_new_mmu_context() 36 if (!((asid += cpu_asid_inc()) & cpu_asid_mask(&cpu_data[cpu]))) { in get_new_mmu_context() 39 local_flush_tlb_all(); /* start new asid cycle */ in get_new_mmu_context() 42 set_cpu_context(cpu, mm, asid); in get_new_mmu_context() 43 asid_cache(cpu) = asid; in get_new_mmu_context() 58 /* Check if our ASID is of an older version and thus invalid */ in check_mmu_context() 94 * context-switch in flush_context() 146 * We had a valid MMID in a previous life, so try to re-use in get_new_mmid() [all …]
|
| /kernel/linux/linux-6.6/arch/mips/mm/ |
| D | context.c | 1 // SPDX-License-Identifier: GPL-2.0 24 u64 asid; in get_new_mmu_context() local 34 asid = asid_cache(cpu); in get_new_mmu_context() 36 if (!((asid += cpu_asid_inc()) & cpu_asid_mask(&cpu_data[cpu]))) { in get_new_mmu_context() 39 local_flush_tlb_all(); /* start new asid cycle */ in get_new_mmu_context() 42 set_cpu_context(cpu, mm, asid); in get_new_mmu_context() 43 asid_cache(cpu) = asid; in get_new_mmu_context() 58 /* Check if our ASID is of an older version and thus invalid */ in check_mmu_context() 94 * context-switch in flush_context() 146 * We had a valid MMID in a previous life, so try to re-use in get_new_mmid() [all …]
|
| /kernel/linux/linux-6.6/drivers/vhost/ |
| D | vdpa.c | 1 // SPDX-License-Identifier: GPL-2.0 3 * Copyright (C) 2018-2020 Intel Corporation. 70 u64 last, u32 asid); 76 return as->id; in iotlb_to_asid() 79 static struct vhost_vdpa_as *asid_to_as(struct vhost_vdpa *v, u32 asid) in asid_to_as() argument 81 struct hlist_head *head = &v->as[asid % VHOST_VDPA_IOTLB_BUCKETS]; in asid_to_as() 85 if (as->id == asid) in asid_to_as() 91 static struct vhost_iotlb *asid_to_iotlb(struct vhost_vdpa *v, u32 asid) in asid_to_iotlb() argument 93 struct vhost_vdpa_as *as = asid_to_as(v, asid); in asid_to_iotlb() 98 return &as->iotlb; in asid_to_iotlb() [all …]
|
| /kernel/linux/linux-6.6/arch/mips/include/asm/ |
| D | mmu_context.h | 26 #include <asm-generic/mm_hooks.h> 80 * allow the kernel to create wired entries with the MMID of current->active_mm 92 * as a software asid extension. 98 return ~(u64)(asid_mask | (asid_mask - 1)); in asid_version_mask() 109 return atomic64_read(&mm->context.mmid); in cpu_context() 111 return mm->context.asid[cpu]; in cpu_context() 115 struct mm_struct *mm, u64 ctx) in set_cpu_context() argument 118 atomic64_set(&mm->context.mmid, ctx); in set_cpu_context() 120 mm->context.asid[cpu] = ctx; in set_cpu_context() 148 mm->context.bd_emupage_allocmap = NULL; in init_new_context() [all …]
|
| /kernel/linux/linux-5.10/arch/mips/include/asm/ |
| D | mmu_context.h | 26 #include <asm-generic/mm_hooks.h> 80 * allow the kernel to create wired entries with the MMID of current->active_mm 92 * as a software asid extension. 98 return ~(u64)(asid_mask | (asid_mask - 1)); in asid_version_mask() 109 return atomic64_read(&mm->context.mmid); in cpu_context() 111 return mm->context.asid[cpu]; in cpu_context() 115 struct mm_struct *mm, u64 ctx) in set_cpu_context() argument 118 atomic64_set(&mm->context.mmid, ctx); in set_cpu_context() 120 mm->context.asid[cpu] = ctx; in set_cpu_context() 151 mm->context.bd_emupage_allocmap = NULL; in init_new_context() [all …]
|
| /kernel/linux/linux-6.6/drivers/accel/habanalabs/common/mmu/ |
| D | mmu.c | 1 // SPDX-License-Identifier: GPL-2.0 4 * Copyright 2016-2022 HabanaLabs, Ltd. 15 * hl_mmu_get_funcs() - get MMU functions structure 25 return &hdev->mmu_func[pgt_residency]; in hl_mmu_get_funcs() 30 struct asic_fixed_properties *prop = &hdev->asic_prop; in hl_is_dram_va() 32 return hl_mem_area_inside_range(virt_addr, prop->dmmu.page_size, in hl_is_dram_va() 33 prop->dmmu.start_addr, in hl_is_dram_va() 34 prop->dmmu.end_addr); in hl_is_dram_va() 38 * hl_mmu_init() - initialize the MMU module. 41 * Return: 0 for success, non-zero for failure. [all …]
|
| D | mmu_v1.c | 1 // SPDX-License-Identifier: GPL-2.0 4 * Copyright 2016-2019 HabanaLabs, Ltd. 15 static inline u64 get_phys_addr(struct hl_ctx *ctx, u64 shadow_addr); 17 static struct pgt_info *get_pgt_info(struct hl_ctx *ctx, u64 hop_addr) in get_pgt_info() argument 21 hash_for_each_possible(ctx->mmu_shadow_hash, pgt_info, node, in get_pgt_info() 23 if (hop_addr == pgt_info->shadow_addr) in get_pgt_info() 29 static void _free_hop(struct hl_ctx *ctx, struct pgt_info *pgt_info) in _free_hop() argument 31 struct hl_device *hdev = ctx->hdev; in _free_hop() 33 gen_pool_free(hdev->mmu_priv.dr.mmu_pgt_pool, pgt_info->phys_addr, in _free_hop() 34 hdev->asic_prop.mmu_hop_table_size); in _free_hop() [all …]
|
| D | mmu_v2_hr.c | 1 // SPDX-License-Identifier: GPL-2.0 4 * Copyright 2020-2022 HabanaLabs, Ltd. 13 static struct pgt_info *hl_mmu_v2_hr_get_pgt_info(struct hl_ctx *ctx, u64 phys_hop_addr) in hl_mmu_v2_hr_get_pgt_info() argument 17 hash_for_each_possible(ctx->hr_mmu_phys_hash, pgt_info, node, in hl_mmu_v2_hr_get_pgt_info() 19 if (phys_hop_addr == pgt_info->phys_addr) in hl_mmu_v2_hr_get_pgt_info() 25 static void hl_mmu_v2_hr_add_pgt_info(struct hl_ctx *ctx, struct pgt_info *pgt_info, in hl_mmu_v2_hr_add_pgt_info() argument 28 hash_add(ctx->hr_mmu_phys_hash, &pgt_info->node, phys_addr); in hl_mmu_v2_hr_add_pgt_info() 31 static struct pgt_info *hl_mmu_v2_hr_get_hop0_pgt_info(struct hl_ctx *ctx) in hl_mmu_v2_hr_get_hop0_pgt_info() argument 33 return &ctx->hdev->mmu_priv.hr.mmu_asid_hop0[ctx->asid]; in hl_mmu_v2_hr_get_hop0_pgt_info() 37 * hl_mmu_v2_hr_init() - initialize the MMU module. [all …]
|
| /kernel/linux/linux-6.6/arch/m68k/include/asm/ |
| D | mmu_context.h | 1 /* SPDX-License-Identifier: GPL-2.0 */ 5 #include <asm-generic/mm_hooks.h> 30 mm_context_t ctx; in get_mmu_context() local 32 if (mm->context != NO_CONTEXT) in get_mmu_context() 38 ctx = next_mmu_context; in get_mmu_context() 39 while (test_and_set_bit(ctx, context_map)) { in get_mmu_context() 40 ctx = find_next_zero_bit(context_map, LAST_CONTEXT+1, ctx); in get_mmu_context() 41 if (ctx > LAST_CONTEXT) in get_mmu_context() 42 ctx = 0; in get_mmu_context() 44 next_mmu_context = (ctx + 1) & LAST_CONTEXT; in get_mmu_context() [all …]
|
| /kernel/linux/linux-5.10/arch/m68k/include/asm/ |
| D | mmu_context.h | 1 /* SPDX-License-Identifier: GPL-2.0 */ 5 #include <asm-generic/mm_hooks.h> 34 mm_context_t ctx; in get_mmu_context() local 36 if (mm->context != NO_CONTEXT) in get_mmu_context() 42 ctx = next_mmu_context; in get_mmu_context() 43 while (test_and_set_bit(ctx, context_map)) { in get_mmu_context() 44 ctx = find_next_zero_bit(context_map, LAST_CONTEXT+1, ctx); in get_mmu_context() 45 if (ctx > LAST_CONTEXT) in get_mmu_context() 46 ctx = 0; in get_mmu_context() 48 next_mmu_context = (ctx + 1) & LAST_CONTEXT; in get_mmu_context() [all …]
|
| /kernel/linux/linux-6.6/drivers/accel/habanalabs/gaudi/ |
| D | gaudi.c | 1 // SPDX-License-Identifier: GPL-2.0 4 * Copyright 2016-2022 HabanaLabs, Ltd. 27 * - Range registers 28 * - MMU 31 * - Range registers (protect the first 512MB) 34 * - Range registers 35 * - Protection bits 40 * - DMA is not secured. 41 * - PQ and CQ are secured. 42 * - CP is secured: The driver needs to parse CB but WREG should be allowed [all …]
|
| /kernel/linux/linux-6.6/Documentation/devicetree/bindings/iommu/ |
| D | qcom,iommu.yaml | 1 # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 3 --- 5 $schema: http://devicetree.org/meta-schemas/core.yaml# 10 - Konrad Dybcio <konrad.dybcio@linaro.org> 13 Qualcomm "B" family devices which are not compatible with arm-smmu have 16 to non-secure vs secure interrupt line. 21 - items: 22 - enum: 23 - qcom,msm8916-iommu 24 - qcom,msm8953-iommu [all …]
|