All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joerg Roedel <joerg.roedel@amd.com>
To: Cho KyongHo <pullip.cho@samsung.com>
Cc: linux-arm-kernel@lists.infradead.org,
	linux-samsung-soc@vger.kernel.org,
	iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org,
	'Kukjin Kim' <kgene.kim@samsung.com>,
	'Subash Patel' <subash.ramaswamy@linaro.org>,
	'Younglak Kim' <younglak1004.kim@samsung.com>,
	'Kyungmin Park' <kyungmin.park@samsung.com>,
	'Sanghyun Lee' <sanghyun75.lee@samsung.com>
Subject: Re: [PATCH v11 3/3] iommu/exynos: Add iommu driver for Exynos Platforms
Date: Mon, 12 Mar 2012 16:01:56 +0100	[thread overview]
Message-ID: <20120312150156.GF18973@amd.com> (raw)
In-Reply-To: <017a01ccfdee$4e5e7a00$eb1b6e00$%cho@samsung.com>

On Fri, Mar 09, 2012 at 09:15:24PM +0900, Cho KyongHo wrote:
> +/* We does not consider super section mapping (16MB) */
> +struct iommu_client {
> +	struct list_head node;
> +	struct device *dev;
> +};
> +
> +struct exynos_iommu_domain {
> +	struct list_head clients; /* list of iommu_client */
> +	unsigned long *pgtable; /* lv1 page table, 16KB */
> +	short *lv2entcnt; /* free lv2 entry counter for each section */
> +	spinlock_t lock; /* lock for this structure and attached iommu_client */
> +	spinlock_t pgtablelock; /* lock for modifying page table @ pgtable */
> +};
> +
> +struct sysmmu_drvdata {
> +	struct device *sysmmu;
> +	char *dbgname;
> +	int nsfrs;
> +	void __iomem **sfrbases;
> +	struct clk *clk[2];
> +	int activations;
> +	rwlock_t lock;
> +	struct iommu_domain *domain;
> +	sysmmu_fault_handler_t fault_handler;
> +	unsigned long pgtable;
> +	struct iommu_client client;
> +};

Is there any reason why 'struct iommu_client' is a seperate data
structure? Otherwise it can be merged with 'truct sysmmu_drvdata'.

> +static void exynos_iommu_domain_destroy(struct iommu_domain *domain)
> +{
> +	struct exynos_iommu_domain *priv = domain->priv;
> +	struct list_head *pos, *n;
> +	unsigned long flags;
> +	int i;
> +
> +	WARN_ON(!list_empty(&priv->clients));
> +
> +	spin_lock_irqsave(&priv->lock, flags);
> +
> +	list_for_each_safe(pos, n, &priv->clients) {
> +		struct iommu_client *client;
> +
> +		client = list_entry(pos, struct iommu_client, node);
> +		exynos_sysmmu_disable(client->dev);
> +		kfree(client);
> +	}

Why this kfree here? Aren't all iommu_clients just a part of another
data-structre?


-- 
AMD Operating System Research Center

Advanced Micro Devices GmbH Einsteinring 24 85609 Dornach
General Managers: Alberto Bozzo
Registration: Dornach, Landkr. Muenchen; Registerger. Muenchen, HRB Nr. 43632

WARNING: multiple messages have this Message-ID (diff)
From: joerg.roedel@amd.com (Joerg Roedel)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v11 3/3] iommu/exynos: Add iommu driver for Exynos Platforms
Date: Mon, 12 Mar 2012 16:01:56 +0100	[thread overview]
Message-ID: <20120312150156.GF18973@amd.com> (raw)
In-Reply-To: <017a01ccfdee$4e5e7a00$eb1b6e00$%cho@samsung.com>

On Fri, Mar 09, 2012 at 09:15:24PM +0900, Cho KyongHo wrote:
> +/* We does not consider super section mapping (16MB) */
> +struct iommu_client {
> +	struct list_head node;
> +	struct device *dev;
> +};
> +
> +struct exynos_iommu_domain {
> +	struct list_head clients; /* list of iommu_client */
> +	unsigned long *pgtable; /* lv1 page table, 16KB */
> +	short *lv2entcnt; /* free lv2 entry counter for each section */
> +	spinlock_t lock; /* lock for this structure and attached iommu_client */
> +	spinlock_t pgtablelock; /* lock for modifying page table @ pgtable */
> +};
> +
> +struct sysmmu_drvdata {
> +	struct device *sysmmu;
> +	char *dbgname;
> +	int nsfrs;
> +	void __iomem **sfrbases;
> +	struct clk *clk[2];
> +	int activations;
> +	rwlock_t lock;
> +	struct iommu_domain *domain;
> +	sysmmu_fault_handler_t fault_handler;
> +	unsigned long pgtable;
> +	struct iommu_client client;
> +};

Is there any reason why 'struct iommu_client' is a seperate data
structure? Otherwise it can be merged with 'truct sysmmu_drvdata'.

> +static void exynos_iommu_domain_destroy(struct iommu_domain *domain)
> +{
> +	struct exynos_iommu_domain *priv = domain->priv;
> +	struct list_head *pos, *n;
> +	unsigned long flags;
> +	int i;
> +
> +	WARN_ON(!list_empty(&priv->clients));
> +
> +	spin_lock_irqsave(&priv->lock, flags);
> +
> +	list_for_each_safe(pos, n, &priv->clients) {
> +		struct iommu_client *client;
> +
> +		client = list_entry(pos, struct iommu_client, node);
> +		exynos_sysmmu_disable(client->dev);
> +		kfree(client);
> +	}

Why this kfree here? Aren't all iommu_clients just a part of another
data-structre?


-- 
AMD Operating System Research Center

Advanced Micro Devices GmbH Einsteinring 24 85609 Dornach
General Managers: Alberto Bozzo
Registration: Dornach, Landkr. Muenchen; Registerger. Muenchen, HRB Nr. 43632

WARNING: multiple messages have this Message-ID (diff)
From: Joerg Roedel <joerg.roedel@amd.com>
To: Cho KyongHo <pullip.cho@samsung.com>
Cc: <linux-arm-kernel@lists.infradead.org>,
	<linux-samsung-soc@vger.kernel.org>,
	<iommu@lists.linux-foundation.org>,
	<linux-kernel@vger.kernel.org>,
	"'Kukjin Kim'" <kgene.kim@samsung.com>,
	"'Subash Patel'" <subash.ramaswamy@linaro.org>,
	"'Younglak Kim'" <younglak1004.kim@samsung.com>,
	"'Kyungmin Park'" <kyungmin.park@samsung.com>,
	"'Sanghyun Lee'" <sanghyun75.lee@samsung.com>
Subject: Re: [PATCH v11 3/3] iommu/exynos: Add iommu driver for Exynos Platforms
Date: Mon, 12 Mar 2012 16:01:56 +0100	[thread overview]
Message-ID: <20120312150156.GF18973@amd.com> (raw)
In-Reply-To: <017a01ccfdee$4e5e7a00$eb1b6e00$%cho@samsung.com>

On Fri, Mar 09, 2012 at 09:15:24PM +0900, Cho KyongHo wrote:
> +/* We does not consider super section mapping (16MB) */
> +struct iommu_client {
> +	struct list_head node;
> +	struct device *dev;
> +};
> +
> +struct exynos_iommu_domain {
> +	struct list_head clients; /* list of iommu_client */
> +	unsigned long *pgtable; /* lv1 page table, 16KB */
> +	short *lv2entcnt; /* free lv2 entry counter for each section */
> +	spinlock_t lock; /* lock for this structure and attached iommu_client */
> +	spinlock_t pgtablelock; /* lock for modifying page table @ pgtable */
> +};
> +
> +struct sysmmu_drvdata {
> +	struct device *sysmmu;
> +	char *dbgname;
> +	int nsfrs;
> +	void __iomem **sfrbases;
> +	struct clk *clk[2];
> +	int activations;
> +	rwlock_t lock;
> +	struct iommu_domain *domain;
> +	sysmmu_fault_handler_t fault_handler;
> +	unsigned long pgtable;
> +	struct iommu_client client;
> +};

Is there any reason why 'struct iommu_client' is a seperate data
structure? Otherwise it can be merged with 'truct sysmmu_drvdata'.

> +static void exynos_iommu_domain_destroy(struct iommu_domain *domain)
> +{
> +	struct exynos_iommu_domain *priv = domain->priv;
> +	struct list_head *pos, *n;
> +	unsigned long flags;
> +	int i;
> +
> +	WARN_ON(!list_empty(&priv->clients));
> +
> +	spin_lock_irqsave(&priv->lock, flags);
> +
> +	list_for_each_safe(pos, n, &priv->clients) {
> +		struct iommu_client *client;
> +
> +		client = list_entry(pos, struct iommu_client, node);
> +		exynos_sysmmu_disable(client->dev);
> +		kfree(client);
> +	}

Why this kfree here? Aren't all iommu_clients just a part of another
data-structre?


-- 
AMD Operating System Research Center

Advanced Micro Devices GmbH Einsteinring 24 85609 Dornach
General Managers: Alberto Bozzo
Registration: Dornach, Landkr. Muenchen; Registerger. Muenchen, HRB Nr. 43632


  reply	other threads:[~2012-03-12 15:01 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-09 12:15 [PATCH v11 3/3] iommu/exynos: Add iommu driver for Exynos Platforms Cho KyongHo
2012-03-09 12:15 ` Cho KyongHo
2012-03-09 12:15 ` Cho KyongHo
2012-03-12 15:01 ` Joerg Roedel [this message]
2012-03-12 15:01   ` Joerg Roedel
2012-03-12 15:01   ` Joerg Roedel
     [not found]   ` <20120312150156.GF18973-5C7GfCeVMHo@public.gmane.org>
2012-03-13  8:50     ` KyongHo Cho
2012-03-13  8:50       ` KyongHo Cho
2012-03-13  8:50       ` KyongHo Cho
     [not found]       ` <CAHQjnOOCQb4G1aeFB0FQVBstXpaXmahnQO8+FoinPcQNZEieGg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-03-13 10:00         ` Joerg Roedel
2012-03-13 10:00           ` Joerg Roedel
2012-03-13 10:00           ` Joerg Roedel
2012-03-13 16:38           ` KyongHo Cho
2012-03-13 16:38             ` KyongHo Cho

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=20120312150156.GF18973@amd.com \
    --to=joerg.roedel@amd.com \
    --cc=iommu@lists.linux-foundation.org \
    --cc=kgene.kim@samsung.com \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=pullip.cho@samsung.com \
    --cc=sanghyun75.lee@samsung.com \
    --cc=subash.ramaswamy@linaro.org \
    --cc=younglak1004.kim@samsung.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.