From: joerg.roedel@amd.com (Joerg Roedel)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 2/2] [RFC] ARM: IOMMU: Tegra30: iommu_ops for SMMU driver
Date: Fri, 16 Dec 2011 16:39:04 +0100 [thread overview]
Message-ID: <20111216153904.GC29877@amd.com> (raw)
In-Reply-To: <1323954690-7000-3-git-send-email-hdoyu@nvidia.com>
On Thu, Dec 15, 2011 at 03:11:30PM +0200, Hiroshi DOYU wrote:
> +static int smmu_iommu_attach_dev(struct iommu_domain *domain,
> + struct device *dev)
> +{
> + struct smmu_as *as = domain->priv;
> + struct smmu_client *client, *c;
> + u32 map;
> + int err;
> +
> + client = kmalloc(sizeof(*c), GFP_KERNEL);
> + if (!client)
> + return -ENOMEM;
> + client->dev = dev;
> + client->as = as;
> + map = (unsigned long)dev->platform_data;
> + if (!map)
> + return -EINVAL;
> +
> + err = smmu_client_enable_hwgrp(client, map);
> + if (err)
> + goto err_hwgrp;
> +
> + spin_lock(&as->client_lock);
> + list_for_each_entry(c, &as->client, list) {
> + if (c->dev == dev) {
> + pr_err("%s is already attached\n", dev_name(dev));
> + err = -EINVAL;
> + goto err_client;
> + }
> + }
> + list_add(&client->list, &as->client);
> + spin_unlock(&as->client_lock);
> +
> + /*
> + * Reserve "page zero" for AVP vectors using a common dummy
> + * page.
> + */
> + if (map & HWG_AVPC) {
> + struct page *page;
> +
> + page = as->smmu->avp_vector_page;
> + __smmu_iommu_map_pfn(as, 0, page_to_pfn(page));
> +
> + pr_info("Reserve \"page zero\" for AVP vectors using a common dummy\n");
> + }
> +
> + pr_debug("Attached %s\n", dev_name(dev));
> + return 0;
> +err_client:
> + smmu_client_disable_hwgrp(client);
> + spin_unlock(&as->client_lock);
> +err_hwgrp:
> + kfree(client);
> + return err;
> +}
Hmm, I have a question about that. Reading the code it looks like your
SMMU exists per pheripheral device and the SMMU hardware supports
multiple address spaces per device, right? The domains are implemented
for one address-space. So is it right that a device can have multiple
address-spaces? If so, what kind of devices do you bind to the domains
then. I doesn't make sense to bind whole peripheral devices in this
case.
Joerg
--
AMD Operating System Research Center
Advanced Micro Devices GmbH Einsteinring 24 85609 Dornach
General Managers: Alberto Bozzo, Andrew Bowd
Registration: Dornach, Landkr. Muenchen; Registerger. Muenchen, HRB Nr. 43632
next prev parent reply other threads:[~2011-12-16 15:39 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1323954690-7000-1-git-send-email-hdoyu@nvidia.com>
2011-12-15 13:11 ` [PATCH v2 2/2] [RFC] ARM: IOMMU: Tegra30: iommu_ops for SMMU driver Hiroshi DOYU
2011-12-16 15:39 ` Joerg Roedel [this message]
2011-12-17 1:03 ` Hiroshi Doyu
2011-12-17 1:28 ` Hiroshi Doyu
[not found] ` <1323954690-7000-2-git-send-email-hdoyu@nvidia.com>
[not found] ` <20111216154331.GD29877@amd.com>
2011-12-17 1:15 ` [PATCH v2 1/2] [RFC] ARM: IOMMU: Tegra20: iommu_ops for GART driver Hiroshi Doyu
2011-12-19 6:27 ` Hiroshi Doyu
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=20111216153904.GC29877@amd.com \
--to=joerg.roedel@amd.com \
--cc=linux-arm-kernel@lists.infradead.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).