Lines Matching defs:context
171 static inline void context_set_present(struct context_entry *context)
173 context->lo |= 1;
176 static inline void context_set_fault_enable(struct context_entry *context)
178 context->lo &= (((u64)-1) << 2) | 1;
181 static inline void context_set_translation_type(struct context_entry *context,
184 context->lo &= (((u64)-1) << 4) | 3;
185 context->lo |= (value & 3) << 2;
188 static inline void context_set_address_root(struct context_entry *context,
191 context->lo &= ~VTD_PAGE_MASK;
192 context->lo |= value & VTD_PAGE_MASK;
195 static inline void context_set_address_width(struct context_entry *context,
198 context->hi |= value & 7;
201 static inline void context_set_domain_id(struct context_entry *context,
204 context->hi |= (value & ((1 << 16) - 1)) << 8;
207 static inline void context_set_pasid(struct context_entry *context)
209 context->lo |= CONTEXT_PASIDE;
217 static inline void context_clear_entry(struct context_entry *context)
219 context->lo = 0;
220 context->hi = 0;
595 struct context_entry *context;
600 * returning a copied context entry makes no sense.
614 context = phys_to_virt(*entry & VTD_PAGE_MASK);
620 context = alloc_pgtable_page(iommu->node, GFP_ATOMIC);
621 if (!context)
624 __iommu_flush_cache(iommu, (void *)context, CONTEXT_SIZE);
625 phy_addr = virt_to_phys((void *)context);
629 return &context[devfn];
785 struct context_entry *context;
792 context = iommu_context_addr(iommu, i, 0, 0);
793 if (context)
794 free_pgtable_page(context);
799 context = iommu_context_addr(iommu, i, 0x80, 0);
800 if (context)
801 free_pgtable_page(context);
860 /* context entry dump */
863 pr_info("context table entry is not present\n");
867 pr_info("context entry: hi 0x%016llx, low 0x%016llx\n",
883 /* For request-without-pasid, get the pasid from context entry */
1278 pr_warn("%s: Unexpected context-cache invalidation type 0x%llx\n",
1732 /* free context mapping */
1878 * Get the PASID directory size for scalable mode context entry.
1879 * Value of X in the PDTS field of a scalable mode context entry
1895 * Set the RID_PASID field of a scalable mode context entry. The
1900 context_set_sm_rid2pasid(struct context_entry *context, unsigned long pasid)
1902 context->hi |= pasid & ((1 << 20) - 1);
1906 * Set the DTE(Device-TLB Enable) field of a scalable mode context
1909 static inline void context_set_sm_dte(struct context_entry *context)
1911 context->lo |= BIT_ULL(2);
1915 * Set the PRE(Page Request Enable) field of a scalable mode context
1918 static inline void context_set_sm_pre(struct context_entry *context)
1920 context->lo |= BIT_ULL(4);
1923 /* Convert value to context PASID directory size field coding. */
1935 struct context_entry *context;
1941 pr_debug("Set context mapping for %02x:%02x.%d\n",
1946 context = iommu_context_addr(iommu, bus, devfn, 1);
1947 if (!context)
1951 if (context_present(context) && !context_copied(iommu, bus, devfn))
1964 u16 did_old = context_domain_id(context);
1978 context_clear_entry(context);
1985 context->lo = (u64)virt_to_phys(table->table) |
1989 context_set_sm_rid2pasid(context, IOMMU_NO_PASID);
1996 context_set_sm_dte(context);
1998 context_set_sm_pre(context);
2000 context_set_pasid(context);
2005 context_set_domain_id(context, did);
2024 context_set_address_root(context, virt_to_phys(pgd));
2025 context_set_address_width(context, agaw);
2032 context_set_address_width(context, iommu->msagaw);
2035 context_set_translation_type(context, translation);
2038 context_set_fault_enable(context);
2039 context_set_present(context);
2041 clflush_cache_range(context, sizeof(*context));
2288 struct context_entry *context;
2295 context = iommu_context_addr(iommu, bus, devfn, 0);
2296 if (!context) {
2307 did_old = context_domain_id(context);
2310 context_clear_entry(context);
2311 __iommu_flush_cache(iommu, context, sizeof(*context));
2487 dev_err(dev, "Domain context map failed\n");
2647 /* Now copy the context entry */
2718 pr_err("%s: Failed to copy context table for bus %d\n",
2802 * we could share the same root & context tables
2864 * global invalidate context cache
3960 * Clear the page table pointer in context or pasid table entries so that