Re: [PATCH v2 18/19] drivers: mem: Create file to access second half of 64-bit memory

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

 



On Thu, Jan 31, 2019 at 11:47 PM Sascha Hauer <s.hauer@xxxxxxxxxxxxxx> wrote:
>
> On Thu, Jan 31, 2019 at 03:50:28PM +0300, Peter Mamonov wrote:
> > On Thu, Jan 31, 2019 at 01:54:52PM +0300, Peter Mamonov wrote:
> > > Hello, Andrey,
> > >
> > > > In order to allow access to second half of address space on 64-bit
> > > > machines, add code that creates /dev/highmem dedicated for that.
> > > >
> > > > Note that due to maximum file size being limited to MAX_LFS_FILESIZE
> > > > or 0x7fff_ffff_ffff_ffff bytes at addresses 0x7fff_ffff_ffff_ffff and
> > > > 0xffff_ffff_ffff_ffff cannot be access through /dev/mem and
> > > > /dev/hightmem correspondingly.
> > >
> > > Does it imply using `-s /dev/highmem` argument when accessing addresses beyond
> > > MAX_LFS_FILESIZE? That's not very convenient:
> > >
> > >     $ git grep -l /dev/mem
> > >     commands/crc.c
> > >     commands/digest.c
> > >     commands/disasm.c
> > >     commands/md.c
> > >     commands/memcmp.c
> > >     commands/memcpy.c
> > >     commands/memset.c
> > >     commands/mm.c
> > >     commands/mw.c
> >
> > I've forgotten to mention, that all meaningful MIPS64 virtual addresses
> > belong to the 2nd half of the address space. Except for user segment addresses
> > which are not used in barebox.
>
> In that case our only option seems to be to use an unsigned 64bit type
> for filesize. We would need an additional lseek like function which
> is able to reach the upper half of the address space and with regular
> lseek simply only the lower half would be reachable.
>
> Note that currently we don't seem to have a problem as even with Andreys
> series applied we can still 'md' the whole address space. The test if we
> lseek outside the file never triggers since the signed comparison of
> offset > f->size never evaluates to true for f->size == S64_MAX.
>

I am a bit confused by this statement. I agree The check for pos >
f->size won't evaluate to true if f->size == S64_MAX, but the pos < 0,
will. On my i.MX8MQ board with all but "drivers: mem: Create file to
access second half of 64-bit memory" applied I have:

barebox@ZII i.MX8MQ Ultra Zest Board:/ md -b 0x7ffffffffffffffe
7ffffffffffffffe: ff                                         .
barebox@ZII i.MX8MQ Ultra Zest Board:/ md -b 0x7fffffffffffffff
barebox@ZII i.MX8MQ Ultra Zest Board:/ md -b 0x8fffffffffffffff
lseek: Invalid argument
barebox@ZII i.MX8MQ Ultra Zest Board:/ md -b 0xfffffffffffffff0
lseek: Invalid argument

Thanks,
Andrey Smirnov

_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux