ioremap() of an mmapped area

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi-

I'm trying to determine if what I'd like to do will cause problems.

We have a PCI device where we can look at a byte of it's memory to
determine what slot our linux based management board is in
(non-prefetchable PCI memory).  The device also does a bunch of other
things beyond the scope of what I'd like to do.

We have a driver for the device that allows a user space process to open
it up, and mmap the memory area for the PCI device so the user space
code can see what slot we're in, and look at whatever else.  BTW the
"slot" I'm talking about has nothing to do with PCI slots -- it's the
slot the entire system is in.  The whole "linux box" is plugged into a
slot in a chassis.

I have another driver and from within that driver, I'd like to be able
to see what slot I'm in.  So I've got code that works where it finds the
PCI device address (it's something like 0xfedfC000) from the PCI config
info and uses ioremap() to map the device address to kernel virtual
memory and I go look at the slot.  Then I iounmap() and go onward doing
my driver's functionality (which doesn't use that PCI device anymore).

My question is, if a user space process has opened the other driver and
mmapped() the same region that my driver ioremaps for a moment, will
there be a conflict?  i.e. will the ioremap I'm doing affect the already
mmapped area?  I'm thinking the kernel virtual memory's mapping to the
PCI device should be independent of the userspace mmapped mapping to the
PCI device and my driver and the userspace code using the other driver
can read the slot info w/o problems if timing is such that the ioremap
in my driver is done at a point where the user space process has the
region mmaped through the other driver.

Is this is a safe assumption?  A quick breeze through do_mmap and
ioremap look like they're independent but I'm not sure as I obviously
don't have complete comprehension of the memory managment stuff.  It
took me a while to realize I had to ioremap that high address to be able
to look at the PCI memory w/o causing a kernel seg fault (unable to
handle paging request).  ioremap fixed that for me nicely.  But I'm
wondering if I should be concerned about coordination between my driver
and the "other" driver.

Thanks for any info,

-Eric Malkowski


--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
IRC Channel:   irc.openprojects.net / #kernelnewbies
Web Page:      http://www.kernelnewbies.org/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux