Re: [PATCH] x86, aperture: Check for GART before accessing GART registers

Aravind Gopalakrishnan
2015-04-06T23:25:40Z

On 4/2/2015 1:19 PM, Ingo Molnar wrote:

>
>> + if (amd_gart_present())
>> amd_northbridges.flags |= AMD_NB_GART;
>>
>> /*
>> diff --git a/arch/x86/kernel/aperture_64.c b/arch/x86/kernel/aperture_64.c
>> index 76164e173a24..1cb170b06853 100644
>> --- a/arch/x86/kernel/aperture_64.c
>> +++ b/arch/x86/kernel/aperture_64.c
>> @@ -262,7 +262,7 @@ void __init early_gart_iommu_check(void)
>> u64 aper_base = 0, last_aper_base = 0;
>> int aper_enabled = 0, last_aper_enabled = 0, last_valid = 0;
>>
>> - if (!early_pci_allowed())
>> + if (!early_pci_allowed() || !amd_gart_present())
>> return;
>>
>> /* This is mostly duplicate of iommu_hole_init */
>> @@ -356,7 +356,7 @@ int __init gart_iommu_hole_init(void)
>> int i, node;
>>
>> if (gart_iommu_aperture_disabled || !fix_aperture ||
>> - !early_pci_allowed())
>> + !early_pci_allowed() || !amd_gart_present())
>> return -ENODEV;
> So what happens if !early_pci_allowed() but the GART is present? We'll
> set amd_northbridges.flags |= AMD_NB_GART, but won't run any of the
> setup code in aperture_64.c, right? Is that a valid setup?
>

It might be a valid setup. But it would work correctly only if BIOS did
the right thing with setting up aperture space.

If !early_pci_allowed() and BIOS did not setup aperture correctly, that
would have caused problems already.
But it has not been an issue so far right?

Thanks,
-Aravind.