From: Stefano Stabellini <sstabellini@kernel.org>
To: Brian Woods <brian.woods@xilinx.com>
Cc: xen-devel <xen-devel@lists.xenproject.org>,
Stefano Stabellini <sstabellini@kernel.org>,
Julien Grall <julien@xen.org>,
Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>
Subject: Re: [RFC v2 1/2] arm,smmu: switch to using iommu_fwspec functions
Date: Wed, 22 Jul 2020 09:47:43 -0700 (PDT) [thread overview]
Message-ID: <alpine.DEB.2.21.2007220938020.17562@sstabellini-ThinkPad-T480s> (raw)
In-Reply-To: <1595390431-24805-2-git-send-email-brian.woods@xilinx.com>
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@xilinx.com>
[...]
> @@ -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?
next prev parent reply other threads:[~2020-07-22 16:48 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-22 4:00 [RFC v2 0/2] Generic SMMU Bindings Brian Woods
2020-07-22 4:00 ` [RFC v2 1/2] arm,smmu: switch to using iommu_fwspec functions Brian Woods
2020-07-22 16:47 ` Stefano Stabellini [this message]
2020-07-24 10:10 ` Brian Woods
2020-07-29 21:08 ` Julien Grall
2020-07-22 4:00 ` [RFC v2 2/2] arm,smmu: add support for generic DT bindings Brian Woods
2020-07-29 21:37 ` Julien Grall
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.DEB.2.21.2007220938020.17562@sstabellini-ThinkPad-T480s \
--to=sstabellini@kernel.org \
--cc=Volodymyr_Babchuk@epam.com \
--cc=brian.woods@xilinx.com \
--cc=julien@xen.org \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).