From: Christoph Hellwig <hch@infradead.org>
To: Ian Pratt <Ian.Pratt@cl.cam.ac.uk>
Cc: linux-kernel@vger.kernel.org, Steven.Hand@cl.cam.ac.uk,
Christian.Limpach@cl.cam.ac.uk, Keir.Fraser@cl.cam.ac.uk,
akpm@osdl.org
Subject: Re: [4/6] Xen VMM #4: HAS_ARCH_DEV_MEM
Date: Wed, 8 Dec 2004 10:44:42 +0000 [thread overview]
Message-ID: <20041208104442.GB29779@infradead.org> (raw)
In-Reply-To: <E1CbwHQ-0006Zf-00@mta1.cl.cam.ac.uk>
On Wed, Dec 08, 2004 at 07:30:31AM +0000, Ian Pratt wrote:
>
> This patch adds ARCH_HAS_DEV_MEM, enabling per-architecture
> implementations of /dev/mem and thus avoids a number of messy
> #ifdef's. Although the mmap case can be solved easily be simply using
> io_remap_page_range instead of remap_pfn_range on all architecutres,
> we need to support read/write of /dev/mem in order for dmidecode etc
> to work. These changes are more messy, and we believe warrant making
> /dev/mem arch specific, which also cleans up uncached_access too.
>
> Signed-off-by: ian.pratt@cl.cam.ac.uk
>
> ---
>
>
> diff -Nurp pristine-linux-2.6.10-rc3/drivers/char/mem.c tmp-linux-2.6.10-rc3-xen.patch/drivers/char/mem.c
> --- pristine-linux-2.6.10-rc3/drivers/char/mem.c 2004-12-03 21:53:47.000000000 +0000
> +++ tmp-linux-2.6.10-rc3-xen.patch/drivers/char/mem.c 2004-12-08 00:52:40.000000000 +0000
> @@ -143,7 +143,7 @@ static ssize_t do_write_mem(void *p, uns
> return written;
> }
>
> -
> +#ifndef ARCH_HAS_DEV_MEM
> /*
> * This funcion reads the *physical* memory. The f_pos points directly to the
> * memory location.
> @@ -189,8 +189,9 @@ static ssize_t write_mem(struct file * f
> return -EFAULT;
> return do_write_mem(__va(p), p, buf, count, ppos);
> }
> +#endif
>
> -static int mmap_mem(struct file * file, struct vm_area_struct * vma)
> +static int mmap_kmem(struct file * file, struct vm_area_struct * vma)
> {
> #ifdef pgprot_noncached
> unsigned long offset = vma->vm_pgoff << PAGE_SHIFT;
> @@ -567,7 +568,7 @@ static int open_port(struct inode * inod
> return capable(CAP_SYS_RAWIO) ? 0 : -EPERM;
> }
>
> -#define mmap_kmem mmap_mem
> +#define mmap_mem mmap_kmem
> #define zero_lseek null_lseek
> #define full_lseek null_lseek
> #define write_zero write_null
> @@ -575,6 +576,7 @@ static int open_port(struct inode * inod
> #define open_mem open_port
> #define open_kmem open_mem
>
> +#ifndef ARCH_HAS_DEV_MEM
> static struct file_operations mem_fops = {
> .llseek = memory_lseek,
> .read = read_mem,
> @@ -582,6 +584,9 @@ static struct file_operations mem_fops =
> .mmap = mmap_mem,
> .open = open_mem,
> };
> +#else
> +extern struct file_operations mem_fops;
> +#endif
Any chance you could put the /dev/mem implementation into a separate
file, ala drivers/char/devmem.c and avoid the ifdefs? ARCH_HAS_DEV_MEM
would have to become a CONFIG option then
next prev parent reply other threads:[~2004-12-08 10:45 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-12-08 7:28 Xen VMM patch set - take 4 Ian Pratt
2004-12-08 7:29 ` [1/6] Xen VMM #4: add ptep_establish_new to make va available Ian Pratt
2004-12-08 10:42 ` Christoph Hellwig
2004-12-08 7:29 ` [2/6] Xen VMM #4: return code for arch_free_page Ian Pratt
2004-12-08 7:30 ` [3/6] Xen VMM #4: runtime disable of VT console Ian Pratt
2004-12-08 12:41 ` David Woodhouse
2004-12-08 7:30 ` [4/6] Xen VMM #4: HAS_ARCH_DEV_MEM Ian Pratt
2004-12-08 10:44 ` Christoph Hellwig [this message]
2004-12-08 7:31 ` [5/6] Xen VMM #4: split free_irq into teardown_irq Ian Pratt
2004-12-08 7:31 ` [6/6] Xen VMM #4: alloc_skb_from_cache Ian Pratt
-- strict thread matches above, loose matches on Subject: below --
2004-12-08 16:35 [4/6] Xen VMM #4: HAS_ARCH_DEV_MEM Ian Pratt
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=20041208104442.GB29779@infradead.org \
--to=hch@infradead.org \
--cc=Christian.Limpach@cl.cam.ac.uk \
--cc=Ian.Pratt@cl.cam.ac.uk \
--cc=Keir.Fraser@cl.cam.ac.uk \
--cc=Steven.Hand@cl.cam.ac.uk \
--cc=akpm@osdl.org \
--cc=linux-kernel@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