Remove unneeded iommu_group_get() and add missing iommu_group_put(),
correcting IOMMU group refcount. This is a minor correction / cleanup that
doesn't really fix anything because Tegra's IOMMU driver are built-in and
hence groups refcounting can't hold IOMMU driver from unloading.
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
static int tegra_dc_init(struct host1x_client *client)
{
struct drm_device *drm = dev_get_drvdata(client->parent);
static int tegra_dc_init(struct host1x_client *client)
{
struct drm_device *drm = dev_get_drvdata(client->parent);
- struct iommu_group *group = iommu_group_get(client->dev);
unsigned long flags = HOST1X_SYNCPT_CLIENT_MANAGED;
struct tegra_dc *dc = host1x_client_to_dc(client);
struct tegra_drm *tegra = drm->dev_private;
unsigned long flags = HOST1X_SYNCPT_CLIENT_MANAGED;
struct tegra_dc *dc = host1x_client_to_dc(client);
struct tegra_drm *tegra = drm->dev_private;
if (!dc->syncpt)
dev_warn(dc->dev, "failed to allocate syncpoint\n");
if (!dc->syncpt)
dev_warn(dc->dev, "failed to allocate syncpoint\n");
- if (group && tegra->domain) {
- if (group != tegra->group) {
- err = iommu_attach_group(tegra->domain, group);
+ if (tegra->domain) {
+ dc->group = iommu_group_get(client->dev);
+
+ if (dc->group && dc->group != tegra->group) {
+ err = iommu_attach_group(tegra->domain, dc->group);
if (err < 0) {
dev_err(dc->dev,
"failed to attach to domain: %d\n",
err);
if (err < 0) {
dev_err(dc->dev,
"failed to attach to domain: %d\n",
err);
+ iommu_group_put(dc->group);
+ tegra->group = dc->group;
-
- dc->domain = tegra->domain;
if (!IS_ERR(primary))
drm_plane_cleanup(primary);
if (!IS_ERR(primary))
drm_plane_cleanup(primary);
- if (group && dc->domain) {
- if (group == tegra->group) {
- iommu_detach_group(dc->domain, group);
+ if (dc->group) {
+ if (dc->group == tegra->group) {
+ iommu_detach_group(tegra->domain, dc->group);
+ iommu_group_put(dc->group);
static int tegra_dc_exit(struct host1x_client *client)
{
struct drm_device *drm = dev_get_drvdata(client->parent);
static int tegra_dc_exit(struct host1x_client *client)
{
struct drm_device *drm = dev_get_drvdata(client->parent);
- struct iommu_group *group = iommu_group_get(client->dev);
struct tegra_dc *dc = host1x_client_to_dc(client);
struct tegra_drm *tegra = drm->dev_private;
int err;
struct tegra_dc *dc = host1x_client_to_dc(client);
struct tegra_drm *tegra = drm->dev_private;
int err;
- if (group && dc->domain) {
- if (group == tegra->group) {
- iommu_detach_group(dc->domain, group);
+ if (dc->group) {
+ if (dc->group == tegra->group) {
+ iommu_detach_group(tegra->domain, dc->group);
+ iommu_group_put(dc->group);
}
host1x_syncpt_free(dc->syncpt);
}
host1x_syncpt_free(dc->syncpt);
const struct tegra_dc_soc_info *soc;
const struct tegra_dc_soc_info *soc;
- struct iommu_domain *domain;
+ struct iommu_group *group;
};
static inline struct tegra_dc *
};
static inline struct tegra_dc *