Skip to contentSkip to conversation

blkfront/back and sector size of 2048 with CDROM's

DISCUSSION James Harper 3 participants 6 messages Feb 5, 2008

lore
Share & tools
lore
#0 lore raw

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

#1 lore raw
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

#2 lore raw
In reply to James Harper
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

#3 lore raw
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

#4 lore raw
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 and last_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

#5 lore raw
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