lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 7 Jan 2022 08:35:34 +0800
From:   Lu Baolu <baolu.lu@...ux.intel.com>
To:     Jason Gunthorpe <jgg@...dia.com>
Cc:     baolu.lu@...ux.intel.com, Joerg Roedel <joro@...tes.org>,
        Alex Williamson <alex.williamson@...hat.com>,
        Robin Murphy <robin.murphy@....com>,
        Christoph Hellwig <hch@...radead.org>,
        Kevin Tian <kevin.tian@...el.com>,
        Ashok Raj <ashok.raj@...el.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Bjorn Helgaas <bhelgaas@...gle.com>,
        Will Deacon <will@...nel.org>,
        Dan Williams <dan.j.williams@...el.com>, rafael@...nel.org,
        Diana Craciun <diana.craciun@....nxp.com>,
        Cornelia Huck <cohuck@...hat.com>,
        Eric Auger <eric.auger@...hat.com>,
        Liu Yi L <yi.l.liu@...el.com>,
        Jacob jun Pan <jacob.jun.pan@...el.com>,
        Chaitanya Kulkarni <kch@...dia.com>,
        Stuart Yoder <stuyoder@...il.com>,
        Laurentiu Tudor <laurentiu.tudor@....com>,
        Thierry Reding <thierry.reding@...il.com>,
        David Airlie <airlied@...ux.ie>,
        Daniel Vetter <daniel@...ll.ch>,
        Jonathan Hunter <jonathanh@...dia.com>,
        Li Yang <leoyang.li@....com>,
        Dmitry Osipenko <digetx@...il.com>,
        iommu@...ts.linux-foundation.org, linux-pci@...r.kernel.org,
        kvm@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v1 6/8] gpu/host1x: Use iommu_attach/detach_device()

On 1/6/22 11:35 PM, Jason Gunthorpe wrote:
> On Thu, Jan 06, 2022 at 10:20:51AM +0800, Lu Baolu wrote:
>> Ordinary drivers should use iommu_attach/detach_device() for domain
>> attaching and detaching.
>>
>> Signed-off-by: Lu Baolu <baolu.lu@...ux.intel.com>
>>   drivers/gpu/host1x/dev.c | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/host1x/dev.c b/drivers/gpu/host1x/dev.c
>> index fbb6447b8659..6e08cb6202cc 100644
>> +++ b/drivers/gpu/host1x/dev.c
>> @@ -265,7 +265,7 @@ static struct iommu_domain *host1x_iommu_attach(struct host1x *host)
>>   			goto put_cache;
>>   		}
>>   
>> -		err = iommu_attach_group(host->domain, host->group);
>> +		err = iommu_attach_device(host->domain, host->dev);
>>   		if (err) {
>>   			if (err == -ENODEV)
>>   				err = 0;
>> @@ -335,7 +335,7 @@ static void host1x_iommu_exit(struct host1x *host)
>>   {
>>   	if (host->domain) {
>>   		put_iova_domain(&host->iova);
>> -		iommu_detach_group(host->domain, host->group);
>> +		iommu_detach_device(host->domain, host->dev);
>>   
>>   		iommu_domain_free(host->domain);
>>   		host->domain = NULL;
> 
> Shouldn't this add the flag to tegra_host1x_driver ?

This is called for a single driver. The call trace looks like below:

static struct platform_driver tegra_host1x_driver = {
         .driver = {
                 .name = "tegra-host1x",
                 .of_match_table = host1x_of_match,
         },
         .probe = host1x_probe,
         .remove = host1x_remove,
};

host1x_probe(dev)
->host1x_iommu_init(host)	//host is a wrapper of dev
-->host1x_iommu_attach(host)
---->iommu_group_get(host->dev)
      iommu_domain_alloc(&platform_bus_type)
      iommu_attach_group(domain, group);

It seems that the existing code only works for singleton group.

> 
> And do like we did in the other tegra stuff and switch to the dma api
> when !host1x_wants_iommu() ?
> 
> Jason
> 

Best regards,
baolu

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ