[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFC v2 1/2] arm,smmu: switch to using iommu_fwspec functions


  • To: Stefano Stabellini <sstabellini@xxxxxxxxxx>
  • From: Brian Woods <brian.woods@xxxxxxxxxx>
  • Date: Fri, 24 Jul 2020 03:10:31 -0700
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.60.83) smtp.rcpttodomain=epam.com smtp.mailfrom=xilinx.com; dmarc=bestguesspass action=none header.from=xilinx.com; dkim=none (message not signed); arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=CUonZA9j8i16PCdI0fzT8Z9CmO63uN/yPps7RE191vo=; b=EZJ425/ZG2ZGVngMhLZxgz7lJwRtOI4sl5mFDE9rOyXXS8i+2jP6UTb+fvm1QqHutBaNL5AzBEAWJy24FdxhlSgeE/IXupJOStP5NHNr+Wx/HjcR/RsIpgnbVLrRDy0NSWOcE5VIFB+mPG1skHkKpEOHUcmtL8oHsdczqIX0eXAXYosP+O+x1b6u1hQuucanFpWPQJsvdVI+cuC4OkcWY+KKXCln3Y+oxJxf7Wl77vcUpW1cRErnQTrs9MzCLq53n4dG2QpGI69KaXOcRnWfUmailYVUCwS1HIk79HT413Uet26JQVOorKPg7Zae3NbaDOnS0zrExF3GZK+4qYJ36Q==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Kx1/02qUC4E/3GSyLlGDtHa/zTynoHHlol+h+Kc0qVjqNEQ99CrzccpEbxC5vxzispwrR4/kJOP+hmQbVcxaql4eM3eQ2P/En2ag9eW5rc5YQPqj3r5YqhDHfXVHg2fx1D29HQZzJri9nX8JvmxcwFgc+21yCzHRACZJI/0BgY+J8suin0aOoKx7cWjB+B9oylVSvOnfeQiA4sOvr3kXWsOs6mssKUVFYuM8qehFWJifH8uuhgBPUVPKzae5Uum5zKTZp0UV5tVayH1ZJMilvx0X+P6d2TbJK8SyoUb5r88a8PJ0jcug6OJ1et/xKIRD1O6C9HCehdA7ZFoFcL30sg==
  • Cc: Brian Woods <brian.woods@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Fri, 24 Jul 2020 10:11:12 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Wed, Jul 22, 2020 at 09:47:43AM -0700, Stefano Stabellini wrote:
> On Tue, 21 Jul 2020, Brian Woods wrote:
> > Modify the smmu driver so that it uses the iommu_fwspec helper
> > functions.  This means both ARM IOMMU drivers will both use the
> > iommu_fwspec helper functions.
> > 
> > Signed-off-by: Brian Woods <brian.woods@xxxxxxxxxx>
> 
> [...]
> 
> > @@ -1924,14 +1924,21 @@ static int arm_smmu_add_device(struct device *dev)
> >                     ret = -ENOMEM;
> >                     goto out_put_group;
> >             }
> > +           cfg->fwspec = kzalloc(sizeof(struct iommu_fwspec), GFP_KERNEL);
> > +           if (!cfg->fwspec) {
> > +                   kfree(cfg);
> > +                   ret = -ENOMEM;
> > +                   goto out_put_group;
> > +           }
> > +           iommu_fwspec_init(dev, smmu->dev);
> 
> Normally the fwspec structure is initialized in
> xen/drivers/passthrough/device_tree.c:iommu_add_dt_device. However here
> we are trying to use it with the legacy bindings, that of course don't
> initialize in iommu_add_dt_device because they are different.
> 
> So I imagine this is the reason why we have to initialize iommu_fwspec here
> indepdendently from iommu_add_dt_device.
> 
> However, why are we allocating the struct iommu_fwspec twice?
> 
> We are calling kzalloc, then iommu_fwspec_init is calling xzalloc.
> 
> Similarly, we are storing the pointer to struct iommu_fwspec in
> cfg->fwspec but actually there is already a pointer to struct
> iommu_fwspec in struct device (the one set by dev_iommu_fwspec_set.)
> 
> Do we actually need both?

Sorry for taking so long.

Hrm, I've been looking for why I created two fwspecs and I'm not sure
why... It's pretty late, but later this morning I'll try some things
and try and remove it.

Brian



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.