[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191217095341.GG8689@8bytes.org>
Date: Tue, 17 Dec 2019 10:53:41 +0100
From: Joerg Roedel <joro@...tes.org>
To: Kai-Heng Feng <kai.heng.feng@...onical.com>
Cc: Christoph Hellwig <hch@...radead.org>,
Alex Deucher <alexander.deucher@....com>,
iommu@...ts.linux-foundation.org,
Kernel development list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2] iommu/amd: Disable IOMMU on Stoney Ridge systems
On Fri, Dec 06, 2019 at 01:57:41PM +0800, Kai-Heng Feng wrote:
> Hi Joerg,
>
> > On Dec 3, 2019, at 01:00, Christoph Hellwig <hch@...radead.org> wrote:
> >
> > On Fri, Nov 29, 2019 at 10:21:54PM +0800, Kai-Heng Feng wrote:
> >> Serious screen flickering when Stoney Ridge outputs to a 4K monitor.
> >>
> >> According to Alex Deucher, IOMMU isn't enabled on Windows, so let's do
> >> the same here to avoid screen flickering on 4K monitor.
> >
> > Disabling the IOMMU entirely seem pretty severe. Isn't it enough to
> > identity map the GPU device?
>
> Ok, there's set_device_exclusion_range() to exclude the device from IOMMU.
> However I don't know how to generate range_start and range_length, which are read from ACPI.
set_device_exclusion_range() is not the solution here. The best is if
the GPU device is put into a passthrough domain at boot, in which it
will be identity mapped. DMA still goes through the IOMMU in this case,
but it only needs to lookup the device-table, page-table walks will not
be done anymore.
The best way to implement this is to put it into the
amd_iommu_add_device() in drivers/iommu/amd_iommu.c. There is this
check:
if (dev_data->iommu_v2)
iommu_request_dm_for_dev(dev);
The iommu_request_dm_for_dev() function causes the device to be identity
mapped. The check can be extended to also check for a device white-list
for devices that need identity mapping.
HTH,
Joerg
Powered by blists - more mailing lists