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

Borislav Petkov
2015-04-08T07:28:01Z

On Tue, Apr 07, 2015 at 03:34:19PM -0500, Aravind Gopalakrishnan wrote:
> On 4/7/2015 9:57 AM, Borislav Petkov wrote:
> >On Tue, Apr 07, 2015 at 09:46:26AM -0500, Aravind Gopalakrishnan wrote:
> >>Okay. I'll do that and correct the typos Ingo pointed out earlier and
> >>resend.
> >Btw, I think you should do the same in early_gart_iommu_check() too.
> >
> >Doing the testing this way would mean that we first are testing for GART
> >hw presence and then do the rest of checks. If no GART hw, the rest of
> >the checks are meaningless.
> >
> >Also, when testing do a "pci=noearly" boot which should make
> >
> > !early_pci_allowed()
> >
> >true and thus test that path too.
> >
>
> Here are results from further testing:
> 1. on platforms with both iommu and gart
> - with pci=noearly, we break out of init routines in aperture_64.c
> early. amd_iommu_init() will run through it's init routine.
> - if amd_iommu_init() fails somewhere, we fall back to
> gart_iommu_init()
> - gart_iommu_init() fails since gart_iommu_aperture is not set.
> - fall back to swiotlb.
> - with amd_iommu=off
> - init routines in aperture_64.c run fine as both amd_gart_present()
> and early_pci_allowed() are true
> - amd_iommu_detect() fails due to command line arg.
> - fall back to gart iommu
> - with pci=noearly and amd_iommu=off
> - break out of aperture_64.c init routines, and amd_iommu_detect()
> fails.
> - fall back to swiotlb
>
> 2. on platform with no gart but iommu present,
> - pci=noearly option is not relevant as we break before that due to
> !amd_gart_present()
> - if amd_iommu_init() fails somewhere, we fall back to swiotlb, else use
> iommu
>
> 3. on platforms with no gart and no iommu
> - use swiotlb regardless of any command line options passed

I don't see anything out of the ordinary but then again I don't know
this code so...

@joro, can you please double-check?

Thanks.

--
Regards/Gruss,
Boris.

ECO tip #101: Trim your mails when you reply.
--