| /linux/arch/csky/mm/ |
| H A D | asid.c | 3 * Generic ASID allocator. 14 #include <asm/asid.h> 21 #define asid2idx(info, asid) (((asid) & ~ASID_MASK(info)) >> (info)->ctxt_shift) argument 27 u64 asid; in flush_context() local 29 /* Update the list of reserved ASIDs and the ASID bitmap. */ in flush_context() 33 asid = atomic64_xchg_relaxed(&active_asid(info, i), 0); in flush_context() 38 * ASID, as this is the only trace we have of in flush_context() 41 if (asid == 0) in flush_context() 42 asid = reserved_asid(info, i); in flush_context() 43 __set_bit(asid2idx(info, asid), info->map); in flush_context() [all …]
|
| /linux/arch/arm/mm/ |
| H A D | context.c | 27 * | process ID | ASID | 32 * The ASID is used to tag entries in the CPU caches and TLBs. 56 u64 context_id, asid; in a15_erratum_get_cpumask() local 65 * running the same ASID as the one being invalidated. in a15_erratum_get_cpumask() 67 asid = per_cpu(active_asids, cpu).counter; in a15_erratum_get_cpumask() 68 if (asid == 0) in a15_erratum_get_cpumask() 69 asid = per_cpu(reserved_asids, cpu); in a15_erratum_get_cpumask() 70 if (context_id == asid) in a15_erratum_get_cpumask() 79 * With LPAE, the ASID and page tables are updated atomicly, so there is 80 * no need for a reserved set of tables (the active ASID tracking prevents [all …]
|
| /linux/arch/arc/include/asm/ |
| H A D | mmu_context.h | 10 * -Major rewrite of Core ASID allocation routine get_new_mmu_context 23 /* ARC ASID Management 25 * MMU tags TLBs with an 8-bit ASID, avoiding need to flush the TLB on 28 * ASID is managed per cpu, so task threads across CPUs can have different 29 * ASID. Global ASID management is needed if hardware supports TLB shootdown 32 * Each task is assigned unique ASID, with a simple round-robin allocator 36 * A new allocation cycle, post rollover, could potentially reassign an ASID 37 * to a different task. Thus the rule is to refresh the ASID in a new cycle. 38 * The 32 bit @asid_cpu (and mm->asid) have 8 bits MMU PID and rest 24 bits 49 #define asid_mm(mm, cpu) mm->context.asid[cpu] [all …]
|
| /linux/arch/xtensa/include/asm/ |
| H A D | mmu_context.h | 38 * NO_CONTEXT is the invalid ASID value that we don't ever assign to 72 unsigned long asid = cpu_asid_cache(cpu); in get_new_mmu_context() local 73 if ((++asid & ASID_MASK) == 0) { in get_new_mmu_context() 75 * Start new asid cycle; continue counting with next in get_new_mmu_context() 79 asid += ASID_USER_FIRST; in get_new_mmu_context() 81 cpu_asid_cache(cpu) = asid; in get_new_mmu_context() 82 mm->context.asid[cpu] = asid; in get_new_mmu_context() 89 * Check if our ASID is of an older version and thus invalid. in get_mmu_context() 93 unsigned long asid = mm->context.asid[cpu]; in get_mmu_context() local 95 if (asid == NO_CONTEXT || in get_mmu_context() [all …]
|
| /linux/arch/riscv/mm/ |
| H A D | tlbflush.c | 23 unsigned long asid) in local_flush_tlb_range_threshold_asid() argument 29 local_flush_tlb_all_asid(asid); in local_flush_tlb_range_threshold_asid() 36 local_sinval_vma(start, asid); in local_flush_tlb_range_threshold_asid() 44 local_flush_tlb_page_asid(start, asid); in local_flush_tlb_range_threshold_asid() 50 unsigned long size, unsigned long stride, unsigned long asid) in local_flush_tlb_range_asid() argument 53 local_flush_tlb_page_asid(start, asid); in local_flush_tlb_range_asid() 55 local_flush_tlb_all_asid(asid); in local_flush_tlb_range_asid() 57 local_flush_tlb_range_threshold_asid(start, size, stride, asid); in local_flush_tlb_range_asid() 82 unsigned long asid; member 92 local_flush_tlb_range_asid(d->start, d->size, d->stride, d->asid); in __ipi_flush_tlb_range_asid() [all …]
|
| H A D | context.c | 68 /* Update the list of reserved ASIDs and the ASID bitmap. */ in __flush_context() 87 /* Mark ASID #0 as used because it is used at boot-time */ in __flush_context() 98 unsigned long asid, ver = atomic_long_read(¤t_version); in __new_context() local 122 * Allocate a free ASID. If we can't find one then increment in __new_context() 125 asid = find_next_zero_bit(context_asid_map, num_asids, cur_idx); in __new_context() 126 if (asid != num_asids) in __new_context() 136 asid = find_next_zero_bit(context_asid_map, num_asids, 1); in __new_context() 139 __set_bit(asid, context_asid_map); in __new_context() 140 cur_idx = asid; in __new_context() 141 return asid | ver; in __new_context() [all …]
|
| /linux/arch/loongarch/include/asm/ |
| H A D | mmu_context.h | 22 * as a software asid extension. 34 #define cpu_context(cpu, mm) ((mm)->context.asid[cpu]) 54 u64 asid = asid_cache(cpu); in get_new_mmu_context() local 56 if (!((++asid) & cpu_asid_mask(&cpu_data[cpu]))) in get_new_mmu_context() 57 *need_flush = true; /* start new asid cycle */ in get_new_mmu_context() 59 cpu_context(cpu, mm) = asid_cache(cpu) = asid; in get_new_mmu_context() 77 static inline void atomic_update_pgd_asid(unsigned long asid, unsigned long pgdl) in atomic_update_pgd_asid() argument 82 : [asid_val] "+r" (asid), [pgdl_val] "+r" (pgdl) in atomic_update_pgd_asid() 94 /* Check if our ASID is of an older version and thus invalid */ in switch_mm_irqs_off() 104 local_flush_tlb_user(); /* Flush tlb after update ASID */ in switch_mm_irqs_off() [all …]
|
| /linux/arch/sh/mm/ |
| H A D | tlbflush_32.c | 21 unsigned long asid; in local_flush_tlb_page() local 24 asid = cpu_asid(cpu, vma->vm_mm); in local_flush_tlb_page() 30 set_asid(asid); in local_flush_tlb_page() 32 local_flush_tlb_one(asid, page); in local_flush_tlb_page() 56 unsigned long asid; in local_flush_tlb_range() local 59 asid = cpu_asid(cpu, mm); in local_flush_tlb_range() 65 set_asid(asid); in local_flush_tlb_range() 68 local_flush_tlb_one(asid, start); in local_flush_tlb_range() 89 unsigned long asid; in local_flush_tlb_kernel_range() local 92 asid = cpu_asid(cpu, &init_mm); in local_flush_tlb_kernel_range() [all …]
|
| /linux/arch/csky/include/asm/ |
| H A D | asid.h | 22 /* Number of ASID allocated by context (shift value) */ 37 * Check the ASID is still valid for the context. If not generate a new ASID. 39 * @pasid: Pointer to the current ASID batch 46 u64 asid, old_active_asid; in asid_check_context() local 48 asid = atomic64_read(pasid); in asid_check_context() 52 * If our active_asid is non-zero and the ASID matches the current in asid_check_context() 60 * - We get a valid ASID back from the cmpxchg, which means the in asid_check_context() 66 !((asid ^ atomic64_read(&info->generation)) >> info->bits) && in asid_check_context() 68 old_active_asid, asid)) in asid_check_context()
|
| /linux/arch/sh/include/asm/ |
| H A D | mmu_context_32.h | 6 static inline void set_asid(unsigned long asid) in set_asid() argument 8 __raw_writel(asid, MMU_PTEAEX); in set_asid() 16 static inline void set_asid(unsigned long asid) in set_asid() argument 25 : "r" (asid), "m" (__m(MMU_PTEH)), in set_asid() 31 unsigned long asid; in get_asid() local 34 : "=r" (asid) in get_asid() 36 asid &= MMU_CONTEXT_ASID_MASK; in get_asid() 37 return asid; in get_asid()
|
| H A D | mmu_context.h | 6 * ASID handling idea taken from MIPS implementation. 22 * (b) ASID (Address Space IDentifier) 33 /* Impossible ASID value, to differentiate from NO_CONTEXT. */ 57 unsigned long asid = asid_cache(cpu); in get_mmu_context() local 60 if (((cpu_context(cpu, mm) ^ asid) & MMU_CONTEXT_VERSION_MASK) == 0) in get_mmu_context() 65 if (!(++asid & MMU_CONTEXT_ASID_MASK)) { in get_mmu_context() 67 * We exhaust ASID of this version. in get_mmu_context() 76 if (!asid) in get_mmu_context() 77 asid = MMU_CONTEXT_FIRST_VERSION; in get_mmu_context() 80 cpu_context(cpu, mm) = asid_cache(cpu) = asid; in get_mmu_context() [all …]
|
| /linux/arch/mips/mm/ |
| H A D | tlb-r4k.c | 261 * much about the ASID. 538 unsigned long long asid:10; member 546 * then global entries, then order by the increasing VPN/ASID and the 569 else if (ea.asid < eb.asid) in r4k_entry_cmp() 571 else if (ea.asid > eb.asid) in r4k_entry_cmp() 597 unsigned long long entryhi, vpn, mask, asid; in r4k_tlb_uniquify_read() local 609 asid = entryhi & cpu_asid_mask(¤t_cpu_data); in r4k_tlb_uniquify_read() 614 tlb_vpns[i].asid = global ? 0 : asid; in r4k_tlb_uniquify_read() 629 * We start at the VPN and ASID values of zero and only assign user 634 * When a VPN/ASID clash is found with a regular entry we increment the [all …]
|
| /linux/arch/riscv/include/asm/ |
| H A D | tlbflush.h | 33 static inline void local_sinval_vma(unsigned long vma, unsigned long asid) in local_sinval_vma() argument 35 if (asid != FLUSH_TLB_NO_ASID) in local_sinval_vma() 36 asm volatile(SINVAL_VMA(%0, %1) : : "r" (vma), "r" (asid) : "memory"); in local_sinval_vma() 46 static inline void local_flush_tlb_all_asid(unsigned long asid) in local_flush_tlb_all_asid() argument 48 if (asid != FLUSH_TLB_NO_ASID) in local_flush_tlb_all_asid() 49 ALT_SFENCE_VMA_ASID(asid); in local_flush_tlb_all_asid() 61 unsigned long asid) in local_flush_tlb_page_asid() argument 63 if (asid != FLUSH_TLB_NO_ASID) in local_flush_tlb_page_asid() 64 ALT_SFENCE_VMA_ADDR_ASID(addr, asid); in local_flush_tlb_page_asid()
|
| /linux/drivers/accel/habanalabs/common/ |
| H A D | asid.c | 20 /* ASID 0 is reserved for the kernel driver and device CPU */ in hl_asid_init() 50 void hl_asid_free(struct hl_device *hdev, unsigned long asid) in hl_asid_free() argument 52 if (asid == HL_KERNEL_ASID_ID || asid >= hdev->asic_prop.max_asid) { in hl_asid_free() 53 dev_crit(hdev->dev, "Invalid ASID %lu", asid); in hl_asid_free() 57 clear_bit(asid, hdev->asid_bitmap); in hl_asid_free()
|
| H A D | context.c | 104 if (ctx->asid != HL_KERNEL_ASID_ID) { in hl_ctx_fini() 105 dev_dbg(hdev->dev, "closing user context, asid=%u\n", ctx->asid); in hl_ctx_fini() 120 hl_asid_free(hdev, ctx->asid); in hl_ctx_fini() 227 ctx->asid = HL_KERNEL_ASID_ID; /* Kernel driver gets ASID 0 */ in hl_ctx_init() 241 ctx->asid = hl_asid_alloc(hdev); in hl_ctx_init() 242 if (!ctx->asid) { in hl_ctx_init() 243 dev_err(hdev->dev, "No free ASID, failed to create context\n"); in hl_ctx_init() 272 dev_dbg(hdev->dev, "create user context, comm=\"%s\", asid=%u\n", in hl_ctx_init() 273 current->comm, ctx->asid); in hl_ctx_init() 283 if (ctx->asid != HL_KERNEL_ASID_ID) in hl_ctx_init() [all …]
|
| /linux/drivers/vhost/ |
| H A D | vdpa.c | 79 u64 last, u32 asid); in iotlb_to_asid() 88 static struct vhost_vdpa_as *asid_to_as(struct vhost_vdpa *v, u32 asid) in asid_to_as() 90 struct hlist_head *head = &v->as[asid % VHOST_VDPA_IOTLB_BUCKETS]; in asid_to_as() 94 if (as->id == asid) in asid_to_as() 100 static struct vhost_iotlb *asid_to_iotlb(struct vhost_vdpa *v, u32 asid) in asid_to_iotlb() 102 struct vhost_vdpa_as *as = asid_to_as(v, asid); in asid_to_iotlb() 110 static struct vhost_vdpa_as *vhost_vdpa_alloc_as(struct vhost_vdpa *v, u32 asid) in vhost_vdpa_alloc_as() 112 struct hlist_head *head = &v->as[asid % VHOST_VDPA_IOTLB_BUCKETS]; in vhost_vdpa_alloc_as() 115 if (asid_to_as(v, asid)) in vhost_vdpa_alloc_as() 118 if (asid > in vhost_vdpa_alloc_as() 85 asid_to_as(struct vhost_vdpa * v,u32 asid) asid_to_as() argument 97 asid_to_iotlb(struct vhost_vdpa * v,u32 asid) asid_to_iotlb() argument 107 vhost_vdpa_alloc_as(struct vhost_vdpa * v,u32 asid) vhost_vdpa_alloc_as() argument 132 vhost_vdpa_find_alloc_as(struct vhost_vdpa * v,u32 asid) vhost_vdpa_find_alloc_as() argument 142 vhost_vdpa_reset_map(struct vhost_vdpa * v,u32 asid) vhost_vdpa_reset_map() argument 151 vhost_vdpa_remove_as(struct vhost_vdpa * v,u32 asid) vhost_vdpa_remove_as() argument 916 vhost_vdpa_general_unmap(struct vhost_vdpa * v,struct vhost_iotlb_map * map,u32 asid) vhost_vdpa_general_unmap() argument 928 vhost_vdpa_pa_unmap(struct vhost_vdpa * v,struct vhost_iotlb * iotlb,u64 start,u64 last,u32 asid) vhost_vdpa_pa_unmap() argument 951 vhost_vdpa_va_unmap(struct vhost_vdpa * v,struct vhost_iotlb * iotlb,u64 start,u64 last,u32 asid) vhost_vdpa_va_unmap() argument 967 vhost_vdpa_iotlb_unmap(struct vhost_vdpa * v,struct vhost_iotlb * iotlb,u64 start,u64 last,u32 asid) vhost_vdpa_iotlb_unmap() argument 1005 u32 asid = iotlb_to_asid(iotlb); vhost_vdpa_map() local 1040 u32 asid = iotlb_to_asid(iotlb); vhost_vdpa_unmap() local 1257 vhost_vdpa_process_iotlb_msg(struct vhost_dev * dev,u32 asid,struct vhost_iotlb_msg * msg) vhost_vdpa_process_iotlb_msg() argument 1404 u32 asid; vhost_vdpa_cleanup() local [all...] |
| /linux/arch/arm64/include/asm/ |
| H A D | tlbflush.h | 50 #define __TLBI_VADDR(addr, asid) \ argument 54 __ta |= (unsigned long)(asid) << 48; \ 179 u16 asid) in __tlbi_level_asid() argument 181 u64 arg = __TLBI_VADDR(addr, asid); in __tlbi_level_asid() 202 * | ASID | TG | SCALE | NUM | TTL | BADDR | 303 * The 'mm' argument identifies the ASID to invalidate. 378 unsigned long asid; in flush_tlb_mm() local 381 asid = __TLBI_VADDR(0, ASID(mm)); in flush_tlb_mm() 382 __tlbi(aside1is, asid); in flush_tlb_mm() 383 __tlbi_user(aside1is, asid); in flush_tlb_mm() [all …]
|
| /linux/tools/perf/pmu-events/arch/riscv/ |
| H A D | riscv-sbi-firmware.json | 75 "PublicDescription": "Sent SFENCE.VMA with ASID request to other HART event", 78 "BriefDescription": "Sent SFENCE.VMA with ASID request to other HART event" 81 "PublicDescription": "Received SFENCE.VMA with ASID request from other HART event", 84 "BriefDescription": "Received SFENCE.VMA with ASID request from other HART event" 123 "PublicDescription": "Sent HFENCE.VVMA with ASID request to other HART event", 126 "BriefDescription": "Sent HFENCE.VVMA with ASID request to other HART event" 129 "PublicDescription": "Received HFENCE.VVMA with ASID request from other HART event", 132 "BriefDescription": "Received HFENCE.VVMA with ASID request from other HART event"
|
| /linux/drivers/gpu/drm/xe/ |
| H A D | xe_trace_bo.h | 96 __field(u32, asid) 106 __entry->asid = xe_vma_vm(vma)->usm.asid; 112 … TP_printk("dev=%s, vma=%p, vm=%p, asid=0x%05x, start=0x%012llx, end=0x%012llx, userptr=0x%012llx", 114 __entry->asid, __entry->start, 195 __field(u32, asid) 202 __entry->asid = vm->usm.asid; 206 TP_printk("dev=%s, vm=%p, asid=0x%05x, vm flags=0x%05x", 207 __get_str(dev), __entry->vm, __entry->asid,
|
| /linux/drivers/vdpa/vdpa_sim/ |
| H A D | vdpa_sim.c | 609 unsigned int asid) in vdpasim_set_group_asid() argument 615 iommu = &vdpasim->iommu[asid]; in vdpasim_set_group_asid() 629 static int vdpasim_set_map(struct vdpa_device *vdpa, unsigned int asid, in vdpasim_set_map() argument 638 if (asid >= vdpasim->dev_attr.nas) in vdpasim_set_map() 643 iommu = &vdpasim->iommu[asid]; in vdpasim_set_map() 645 vdpasim->iommu_pt[asid] = false; in vdpasim_set_map() 663 static int vdpasim_reset_map(struct vdpa_device *vdpa, unsigned int asid) in vdpasim_reset_map() argument 667 if (asid >= vdpasim->dev_attr.nas) in vdpasim_reset_map() 671 if (vdpasim->iommu_pt[asid]) in vdpasim_reset_map() 673 vhost_iotlb_reset(&vdpasim->iommu[asid]); in vdpasim_reset_map() [all …]
|
| /linux/drivers/vdpa/vdpa_user/ |
| H A D | vduse_dev.c | 351 static int vduse_dev_update_iotlb(struct vduse_dev *dev, u32 asid, in vduse_dev_update_iotlb() argument 366 msg.req.iova_v2.asid = asid; in vduse_dev_update_iotlb() 737 unsigned int asid) in vduse_set_group_asid() 748 msg.req.vq_group_asid.asid = asid; in vduse_set_group_asid() 755 dev->groups[group].as = &dev->as[asid]; in vduse_vdpa_get_vq_state() 925 unsigned int asid, in vduse_vdpa_set_map() 931 ret = vduse_domain_set_map(dev->as[asid].domain, iotlb); in vduse_vdpa_set_map() 935 ret = vduse_dev_update_iotlb(dev, asid, in vduse_vdpa_set_map() 731 vduse_set_group_asid(struct vdpa_device * vdpa,unsigned int group,unsigned int asid) vduse_set_group_asid() argument 919 vduse_vdpa_set_map(struct vdpa_device * vdpa,unsigned int asid,struct vhost_iotlb * iotlb) vduse_vdpa_set_map() argument 1313 vduse_dev_dereg_umem(struct vduse_dev * dev,u32 asid,u64 iova,u64 size) vduse_dev_dereg_umem() argument 1346 vduse_dev_reg_umem(struct vduse_dev * dev,u32 asid,u64 iova,u64 uaddr,u64 size) vduse_dev_reg_umem() argument 1433 u32 asid; vduse_dev_iotlb_entry() local 1668 u32 asid; vduse_dev_ioctl() local 1690 u32 asid; vduse_dev_ioctl() local [all...] |
| /linux/drivers/accel/habanalabs/gaudi/ |
| H A D | gaudi.c | 479 static int gaudi_mmu_update_asid_hop0_addr(struct hl_device *hdev, u32 asid, 492 static void gaudi_mmu_prepare(struct hl_device *hdev, u32 asid); 1673 /* We only support a single ASID for the user, so for the sake of optimization, just in gaudi_late_init() 1674 * initialize the ASID one time during device initialization with the fixed value of 1 in gaudi_late_init() 3656 "failed to set hop0 addr for asid %d\n", i); in gaudi_mmu_init() 5865 static int gaudi_context_switch(struct hl_device *hdev, u32 asid) in gaudi_context_switch() argument 5985 * using the compute ctx ASID, if exists. If not, use the kernel ctx in gaudi_debugfs_read_dma() 5986 * ASID in gaudi_debugfs_read_dma() 6024 * using the compute ctx ASID, if exists. If not, use the kernel ctx in gaudi_debugfs_read_dma() 6025 * ASID in gaudi_debugfs_read_dma() [all …]
|
| /linux/include/uapi/linux/ |
| H A D | vduse.h | 13 /* VQ groups and ASID support */ 184 * struct vduse_vq_group_asid - virtqueue group ASID 186 * @asid: Address space ID of the group 190 __u32 asid; member 252 * @asid: Address space ID of the IOVA region 262 __u32 asid; member 277 * @asid: Address space ID of the IOVA region, only if device API version >= 1 288 __u32 asid; /* Only if device API version >= 1 */ member 302 * @asid: address space ID of the IOVA region 313 __u32 asid; member [all …]
|
| /linux/arch/xtensa/mm/ |
| H A D | tlb.c | 58 /* If mm is current, we simply assign the current task a new ASID, thus, 71 mm->context.asid[cpu] = NO_CONTEXT; in local_flush_tlb_mm() 75 mm->context.asid[cpu] = NO_CONTEXT; in local_flush_tlb_mm() 96 if (mm->context.asid[cpu] == NO_CONTEXT) in local_flush_tlb_range() 100 (unsigned long)mm->context.asid[cpu], start, end); in local_flush_tlb_range() 106 set_rasid_register(ASID_INSERT(mm->context.asid[cpu])); in local_flush_tlb_range() 134 if (mm->context.asid[cpu] == NO_CONTEXT) in local_flush_tlb_page() 140 set_rasid_register(ASID_INSERT(mm->context.asid[cpu])); in local_flush_tlb_page() 223 * Check that TLB entries with kernel ASID (1) have kernel VMA (>= TASK_SIZE), 224 * and TLB entries with user ASID (>=4) have VMA < TASK_SIZE.
|
| /linux/arch/mips/lib/ |
| H A D | r3k_dump_tlb.c | 27 unsigned int asid; in dump_tlb() local 31 asid = read_c0_entryhi() & asid_mask; in dump_tlb() 46 (entryhi & asid_mask) == asid)) { in dump_tlb() 52 pr_cont("va=%08lx asid=%08lx" in dump_tlb() 65 write_c0_entryhi(asid); in dump_tlb()
|