/* TLB invalidation function which is called from the mapping functions. It invalidates a single PTE if the range to flush is within a single page. Otherwise it flushes the whole TLB of the IOMMU.  */
static void __iommu_flush_pages(struct protection_domain *domain, u64 address, size_t size, int pde)
/* TLB invalidation function which is called from the mapping functions. It invalidates a single PTE if the range to flush is within a single page. Otherwise it flushes the whole TLB of the IOMMU.  */
static void __iommu_flush_pages(struct protection_domain *domain, u64 address, size_t size, int pde)
{
	int s = 0, i;
	unsigned long pages = iommu_num_pages(address, size, PAGE_SIZE);
	address &= PAGE_MASK;
	if (pages > 1) {
		address = CMD_INV_IOMMU_ALL_PAGES_ADDRESS;
		s = 1;
	}
	for (i = 0; i < amd_iommus_present; ++i) {
		if (!domain->dev_iommu[i])
			continue;
		iommu_queue_inv_iommu_pages(amd_iommus[i], address,
					    domain->id, pde, s);
	}
	return;
}