blkfront/back and sector size of 2048 with CDROM's
It looks like mounting a physical CDROM under the windows gpl pv drivers doesn't work, and I suspect that the problem is because the CDROM uses a sector size of 2048 instead of 512.
Do the pages passed between the front and backend scale to using different sector sizes, or do I have to do some magic to fudge them back to 512?
Thanks
James
Quoted 2 lines · James Harper, le Tue 05 Feb 2008 11:09:42 +1100, a écrit :
Do the pages passed between the front and backend scale to using different sector sizes,
The backend decides which sector size to be used, so
Quoted 1 line
or do I have to do some magic to fudge them back to 512?
Yes.
Samuel
Quoted 7 lines · James Harper
It looks like mounting a physical CDROM under the windows gpl pv drivers doesn't work, and I suspect that the problem is because the CDROM uses a sector size of 2048 instead of 512.
Do the pages passed between the front and backend scale to using different sector sizes, or do I have to do some magic to fudge them back to 512?
The 'sectors' referenced in blkif requests are always 512 bytes. So if you read 'sector-size' of 2048 from xenstore during blkif setup, that means that the #sector alignments and sizes you send in requests must be multiples of 4.
-- Keir
Quoted 1 line
The 'sectors' referenced in blkif requests are always 512 bytes. So if
you
Quoted 1 line
read 'sector-size' of 2048 from xenstore during blkif setup, that
means
Quoted 2 lines
that
the #sector alignments and sizes you send in requests must be
multiples of
Quoted 1 line
4.
Okay... a forinstance...
I give windows a sector size of 2048 based on what I have read from xenstore. Windows isssues a read request for sector 1 (byte offset 2048), and a length of 1 sector.
My read buffer is aligned at 1024 bytes into the page, so in the blkif request I set nr_segments = 1, sector_number = 4 (1 * (2048 / 512)), and in the first (and only) segment, first_sect = 2 and last_sect = 6.
Does that sound right?
Thanks
James
Quoted 11 lines · James Harper
Okay... a forinstance...
I give windows a sector size of 2048 based on what I have read from xenstore. Windows isssues a read request for sector 1 (byte offset 2048), and a length of 1 sector.
My read buffer is aligned at 1024 bytes into the page, so in the blkif request I set
nr_segments= 1,sector_number= 4 (1 * (2048 / 512)), and in the first (and only) segment,first_sect= 2 andlast_sect= 6.Does that sound right?
Yes, except that last_sect = 5, because it's an inclusive range.
I'm pretty sure you can DMA to/from unaligned buffers (e.g., in this case non-2kB aligned). Certainly blkback doesn't appear to check for it, so presumably we found it works!
-- Keir
Quoted 1 line
Yes, except that
last_sect= 5, because it's an inclusive range.
Yes. :)
Quoted 1 line
I'm pretty sure you can DMA to/from unaligned buffers (e.g., in this
case
Quoted 2 lines
non-2kB aligned). Certainly blkback doesn't appear to check for it, so presumably we found it works!
My buffers are always page aligned anyway. I have no control over the buffer alignment that windows gives me, so I have to copy the data back and forth. In a previous version I would check for buffer alignment first (windows almost always gives you buffers aligned to a page boundry), but the windows scsi controller interface is really messed up... you are always called at a really high irq level, and the routines for mapping buffers to pfn's are not available in that situation.
James