All of lore.kernel.org
 help / color / mirror / Atom feed
* PCI MMIO issue
@ 2007-03-19 22:40 Stephen Donnelly
  2007-03-20  0:13 ` Haw-Yuan Yang
  0 siblings, 1 reply; 4+ messages in thread
From: Stephen Donnelly @ 2007-03-19 22:40 UTC (permalink / raw)
  To: xen-devel


[-- Attachment #1.1: Type: text/plain, Size: 1100 bytes --]

I posted this to the xen-users list first, they suggested I ask here.

I understood that in a Driver Domain that has access to a (PCI) device,
'native' drivers can be used, but I am having some problems with memory
mapped IO from user space.

I have a PCI device that has a 64kB mmio range at PCI_BAR_0. This address
space contains the registers for the device. My Linux driver provides a char
device that allows read/write/seek, and mmap for this space. In Linux you
can use either read/write/seek to access the space, or memory map it via
mmap and access it directly.

When using the driver in dom0 under Xen 3.0.4, the read/write/seek method
works fine but the mmap does not. None of the related functions return
errors, but the mmap does not appear to access the correct memory. Is there
anything I am missing?

The mmap is performed by a remap_pfn_range() by the driver, and mmap() in
the user space code.

I am running Ubuntu 6.10 AMD64 Server and I built Xen 3.0.4 from source,
including the 2.6.16.33-xen kernel. The driver is running in dom0, no other
domains are present.

Thanks,
Stephen.

[-- Attachment #1.2: Type: text/html, Size: 1181 bytes --]

[-- Attachment #2: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: PCI MMIO issue
  2007-03-19 22:40 PCI MMIO issue Stephen Donnelly
@ 2007-03-20  0:13 ` Haw-Yuan Yang
  2007-03-20  1:43   ` Stephen Donnelly
  0 siblings, 1 reply; 4+ messages in thread
From: Haw-Yuan Yang @ 2007-03-20  0:13 UTC (permalink / raw)
  To: Stephen Donnelly; +Cc: xen-devel


[-- Attachment #1.1: Type: text/plain, Size: 1491 bytes --]

I have the same issue. Keir help me to solve the problem.
Use io_remap_pfn_range() in your mmap handler to map the mmio.

hyang


On 3/19/07, Stephen Donnelly <sfdonnelly@gmail.com> wrote:
>
> I posted this to the xen-users list first, they suggested I ask here.
>
> I understood that in a Driver Domain that has access to a (PCI) device,
> 'native' drivers can be used, but I am having some problems with memory
> mapped IO from user space.
>
> I have a PCI device that has a 64kB mmio range at PCI_BAR_0. This address
> space contains the registers for the device. My Linux driver provides a char
> device that allows read/write/seek, and mmap for this space. In Linux you
> can use either read/write/seek to access the space, or memory map it via
> mmap and access it directly.
>
> When using the driver in dom0 under Xen 3.0.4, the read/write/seek method
> works fine but the mmap does not. None of the related functions return
> errors, but the mmap does not appear to access the correct memory. Is there
> anything I am missing?
>
> The mmap is performed by a remap_pfn_range() by the driver, and mmap() in
> the user space code.
>
> I am running Ubuntu 6.10 AMD64 Server and I built Xen 3.0.4 from source,
> including the 2.6.16.33-xen kernel. The driver is running in dom0, no
> other domains are present.
>
> Thanks,
> Stephen.
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel
>
>

[-- Attachment #1.2: Type: text/html, Size: 2182 bytes --]

[-- Attachment #2: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: PCI MMIO issue
  2007-03-20  0:13 ` Haw-Yuan Yang
@ 2007-03-20  1:43   ` Stephen Donnelly
  2007-03-20  7:01     ` Keir Fraser
  0 siblings, 1 reply; 4+ messages in thread
From: Stephen Donnelly @ 2007-03-20  1:43 UTC (permalink / raw)
  To: Haw-Yuan Yang; +Cc: xen-devel


[-- Attachment #1.1: Type: text/plain, Size: 1911 bytes --]

You are absolutely correct, the code now works fine with mmap. Thank you!

But I don't understand how this change works, since in
include/asm/pgtable.h:

#define io_remap_pfn_range(vma, vaddr, pfn, size, prot)        \
        remap_pfn_range(vma, vaddr, pfn, size, prot)

Stephen.

On 3/20/07, Haw-Yuan Yang <hawyuan@gmail.com> wrote:
>
> I have the same issue. Keir help me to solve the problem.
> Use io_remap_pfn_range() in your mmap handler to map the mmio.
>
> hyang
>
>
> On 3/19/07, Stephen Donnelly <sfdonnelly@gmail.com > wrote:
>
> > I posted this to the xen-users list first, they suggested I ask here.
> >
> > I understood that in a Driver Domain that has access to a (PCI) device,
> > 'native' drivers can be used, but I am having some problems with memory
> > mapped IO from user space.
> >
> > I have a PCI device that has a 64kB mmio range at PCI_BAR_0. This
> > address space contains the registers for the device. My Linux driver
> > provides a char device that allows read/write/seek, and mmap for this space.
> > In Linux you can use either read/write/seek to access the space, or memory
> > map it via mmap and access it directly.
> >
> > When using the driver in dom0 under Xen 3.0.4, the read/write/seek
> > method works fine but the mmap does not. None of the related functions
> > return errors, but the mmap does not appear to access the correct memory. Is
> > there anything I am missing?
> >
> > The mmap is performed by a remap_pfn_range() by the driver, and mmap()
> > in the user space code.
> >
> > I am running Ubuntu 6.10 AMD64 Server and I built Xen 3.0.4 from source,
> > including the 2.6.16.33-xen kernel. The driver is running in dom0, no
> > other domains are present.
> >
> > Thanks,
> > Stephen.
> >
> >
> > _______________________________________________
> > Xen-devel mailing list
> > Xen-devel@lists.xensource.com
> > http://lists.xensource.com/xen-devel
> >
> >
>

[-- Attachment #1.2: Type: text/html, Size: 3018 bytes --]

[-- Attachment #2: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: PCI MMIO issue
  2007-03-20  1:43   ` Stephen Donnelly
@ 2007-03-20  7:01     ` Keir Fraser
  0 siblings, 0 replies; 4+ messages in thread
From: Keir Fraser @ 2007-03-20  7:01 UTC (permalink / raw)
  To: Stephen Donnelly, Haw-Yuan Yang; +Cc: xen-devel


[-- Attachment #1.1: Type: text/plain, Size: 324 bytes --]




On 20/3/07 01:43, "Stephen Donnelly" <sfdonnelly@gmail.com> wrote:

> But I don't understand how this change works, since in include/asm/pgtable.h:
> 
> #define io_remap_pfn_range(vma, vaddr, pfn, size, prot)        \
>         remap_pfn_range(vma, vaddr, pfn, size, prot)

Include/asm/mach-xen/asm/pgtable.h.

 -- Keir


[-- Attachment #1.2: Type: text/html, Size: 856 bytes --]

[-- Attachment #2: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-03-20  7:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-03-19 22:40 PCI MMIO issue Stephen Donnelly
2007-03-20  0:13 ` Haw-Yuan Yang
2007-03-20  1:43   ` Stephen Donnelly
2007-03-20  7:01     ` Keir Fraser

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.