mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Russell King - ARM Linux <linux@arm.linux.org.uk>
To: Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
Cc: linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.arm.linux.org.uk,
	linux-omap@vger.kernel.org
Subject: Re: [PATCH 4/6] omap iommu: simple virtual address space management
Date: Sat, 17 Jan 2009 16:57:26 +0000	[thread overview]
Message-ID: <20090117165726.GC12341@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <20090116083725.18344.82076.stgit@oreo.research.nokia.com>

On Fri, Jan 16, 2009 at 10:37:25AM +0200, Hiroshi DOYU wrote:
> +static struct iovm_struct *__find_iovm_area(struct iommu *obj, const void *_da)
> +{
> +	struct iovm_struct *tmp;
> +	u32 da = (u32)_da;
...

> +static struct iovm_struct *alloc_iovm_area(struct iommu *obj, void *da,
> +					   size_t bytes, u32 flags)
> +{
> +	struct iovm_struct *new, *tmp;
> +	u32 start, prev_end, alignement;
> +
> +	if (!obj || !bytes)
> +		return ERR_PTR(-EINVAL);
> +
> +	start = (u32)da;
...

> +/* template function for all unmapping */
> +static struct sg_table *unmap_vm_area(struct iommu *obj, const void *da,
> +				      void (*fn)(const void *), u32 flags)
> +{
> +	struct sg_table *sgt = NULL;
> +	struct iovm_struct *area;
> +
> +	BUG_ON(in_interrupt());
> +
> +	if (!IS_ALIGNED((u32)da, PAGE_SIZE)) {
...etc

I've been wondering whether 'void *' is the right type for the device
address, and I've pretty much come to the conclusion that it isn't.
'void *' is a pointer, so one might expect it to point at memory.  It
may point at memory, just not on the host CPU.  So using a pointer
seems wrong to me.

I know that screws up error handling in the code somewhat since you're
using IS_ERR and friends - but have you also considered whether a
valid device address falls within the space used for error values
(iow, small negative numbers)?

Lastly, I'm not entirely sold on the four different interfaces and
whether they're the right approach.  I've not yet seen users of each
of these interfaces so I don't think I can really comment yet - but
I think it's important to have some examples before acking this patch.

  reply	other threads:[~2009-01-17 16:57 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-16  8:37 [PATCH 0/6] arm: omap iommu: add initial support Hiroshi DOYU
2009-01-16  8:37 ` [PATCH 1/6] omap iommu: tlb and pagetable primitives Hiroshi DOYU
2009-01-17 16:06   ` Russell King - ARM Linux
2009-01-17 20:48     ` David Brownell
2009-01-19  9:44       ` Hiroshi DOYU
2009-01-19 21:58         ` Russell King - ARM Linux
2009-01-19 22:42           ` David Brownell
2009-01-26 13:41     ` Hiroshi DOYU
2009-01-27 21:31     ` Hiroshi DOYU
2009-01-16  8:37 ` [PATCH 2/6] omap iommu: omap2 architecture specific functions Hiroshi DOYU
2009-01-16  8:37 ` [PATCH 3/6] omap iommu: omap3 iommu device registration Hiroshi DOYU
2009-01-17 16:21   ` Russell King - ARM Linux
2009-01-27 21:29     ` Hiroshi DOYU
2009-01-28 10:41       ` Russell King - ARM Linux
2009-01-28 11:37         ` Hiroshi DOYU
2009-01-16  8:37 ` [PATCH 4/6] omap iommu: simple virtual address space management Hiroshi DOYU
2009-01-17 16:57   ` Russell King - ARM Linux [this message]
2009-01-27 21:29     ` Hiroshi DOYU
2009-01-16  8:37 ` [PATCH 5/6] omap iommu: entries for Kconfig and Makefile Hiroshi DOYU
2009-01-16  8:37 ` [PATCH 6/6] omap2 " Hiroshi DOYU
2009-01-17 16:59   ` Russell King - ARM Linux
2009-01-22 15:02     ` 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=20090117165726.GC12341@n2100.arm.linux.org.uk \
    --to=linux@arm.linux.org.uk \
    --cc=Hiroshi.DOYU@nokia.com \
    --cc=linux-arm-kernel@lists.arm.linux.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.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

all inboxes | Powered by JetHome®