> > > And it crashes with an ,,Unable to handle kernel paging request at
> > > e4414007`` in the ncr53c8xx (3.0i) driver, if I apply the following patch.
> > > So is the idea about what it should look like wrong, or is it the ncr53c8xx
> > > driver?
> > For DMAing from devices, drivers call virt_to_bus() that provides the
> > address devices have to use to hit the right memory location from the bus.
> > Being wrong is harder then being right for that, but obviously a bug is
> > always possible.
> > > -#define __io_virt(x) ((void *)(PAGE_OFFSET | (unsigned long)(x)))
> > > -#define __io_phys(x) ((unsigned long)(x) & ~PAGE_OFFSET)
> > > +#define __io_virt(x) ((void *)(PAGE_OFFSET + (unsigned long)(x)))
> > > +#define __io_phys(x) ((unsigned long)(x) - PAGE_OFFSET)
> > Only the __io_phys(x) macro should be involved in virt_to_bus().
> > The previous versions of the macros left result unchanged if they are
> > called more than once, but your versions will break. So probably
> > such a bug exists somewhere.
> > BTW, what was wrong with previous macro versions?
> > (Sorry, if I just missed your initial posting. Will search it).
> Hi Gerard,
> Imagine a PAGE_OFFSET of 0x789abcde. The macros obiously give different
> results then. OK, nobody will do this, but maybe 0x70000000 and maybe some IO
> remapped addresses larger than 0x10000000 might appear. Or even 0x7f000000
> and IO mapped adresses larger then 0x01000000. See, what I mean?
> I'd say that the version with plus and minus is cleaner.
The current x86/io.h requires high bits to be set to 1 in PAGE_OFFSET. I
just missed that 0x7000000 didn't match this condition. When the high bit
condition is met, then the current implementation is more robust against
bug. The change just broke readX/writeX implementation for remapped
addresses and its author should also have proposed to change these ones.
I agree that the plus/minus implementation seems cleaner (when it is
> BTW, the initial posting was not by me ...
> The discussion was about accessing io-space. It changed to why we can't
> change PAGE_OFFSET to an arbitrary value. (We should be INMHO.)
> How did you find this posting. I don't belive you read all in linux-scsi
> and/or linux-kernel. Do you grep through your mailbox? Does your mailreader
> do that for you? procmail? (Just curious ...)
In fact, I didn't follow this starting thread. Just the ncr driver seemed
to be involved in the discussion and I looked into the kernel in order to
understand what was the actual problem. Yes, I donnot read all the
linux-kernel/scsi postings due to lack of time. If you have some advice
about the fastest tools to more or less read interesting parts of 300
articles in 2 hours, let me know.
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to email@example.com
Please read the FAQ at http://www.tux.org/lkml/