Re: [PATCH] x86-64: disable the GART in shutdown

Muli Ben-Yehuda
2007-06-23T10:39:59Z

On Fri, Jun 22, 2007 at 07:34:59PM -0700, Yinghai Lu wrote:
> [PATCH] x86-64: disable the GART in shutdown
>
> For K8 system: 4G RAM with memory hole remapping enabled, or more than 4G RAM
> installed. when mem is allocated for GART, it will do the memset for clear.
> and for kexec case, the first kernel already enable that, the memset in second
> kernel will cause the system restart. solution will be:
> in second kernel: disable that at first before we try to allocate mem for it.
> or in the first kernel: do disable that before shutdown.
>
> Signed-off-by: Yinghai Lu <yinghai.lu@sun.com>
>

[snip]

> diff --git a/arch/x86_64/kernel/pci-dma.c b/arch/x86_64/kernel/pci-dma.c
> index 9f80aad..64f2ab3 100644
> --- a/arch/x86_64/kernel/pci-dma.c
> +++ b/arch/x86_64/kernel/pci-dma.c
> @@ -322,6 +322,13 @@ static int __init pci_iommu_init(void)
> return 0;
> }
>
> +void pci_iommu_shutdown(void)
> +{
> +#ifdef CONFIG_IOMMU
> + gart_iommu_shutdown();
> +#endif
> +}

I'm going to need exactly the same hook fro Calgary, as well Intel for
VT-d, and AMD for their upcoming IOMMU, etc. How about we do

struct iommu_ops {
struct dma_ops {
...
}
void (*shutdown)(void);
}

And then pci_iommu_shutdown() becomes

if (iommu_ops->shutdown)
iommu_ops->shutdown();

?

Cheers,
Muli