From: Andi Kleen Date: Sat, 25 Mar 2006 15:29:37 +0000 (+0100) Subject: [PATCH] x86_64: Use cpu_relax in poll loop in GART IOMMU X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=85f9eebccde51e24896f31383f5b70776362e1a6;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git [PATCH] x86_64: Use cpu_relax in poll loop in GART IOMMU The code waits for the GART to clear the TLB flush bit. Use cpu_relax in this time to allow hypervisors to yield the CPU in this time. Signed-off-by: Andi Kleen Signed-off-by: Linus Torvalds --- diff --git a/arch/x86_64/kernel/pci-gart.c b/arch/x86_64/kernel/pci-gart.c index 0c3f052ba6ce..ebd125e968be 100644 --- a/arch/x86_64/kernel/pci-gart.c +++ b/arch/x86_64/kernel/pci-gart.c @@ -148,9 +148,12 @@ static void flush_gart(struct device *dev) if (!northbridges[i]) continue; /* Make sure the hardware actually executed the flush. */ - do { + for (;;) { pci_read_config_dword(northbridges[i], 0x9c, &w); - } while (w & 1); + if (!(w & 1)) + break; + cpu_relax(); + } } if (!flushed) printk("nothing to flush?\n");