Skip to contentSkip to conversation

Impact of no_lba48{_dma} = 1 ?

DISCUSSION Steven Scholz 3 participants 12 messages Feb 7, 2007 libata

lore
Share & tools
lore
#0 lore raw

Hi all,

on our embedded system we connected a HDD via FPGA driectly to the CPU. And wrote a evry simple IDE driver for it. BAsicly the HDD internbal registers are just memory mapped. No DMA is supported by the hardware. But I think it would be capable of 48bit LBA mode (which just means setting the HOB bit in the device control register of the HDD correctly?)

Now I wonder what the impact of setting

	hwif->no_lba48 = 1;		/* 1 = cannot do LBA48 */
	hwif->no_lba48_dma = 1;		/* 1 = cannot do LBA48 DMA */

would be.

IIUC then no_lba48 would limit the useable size to 130GB? Will every HDD work with no_lba48 set to 1? Even those which actually support 48bit LBA?

How about performance impact of

		if (hwif->no_lba48 || hwif->no_lba48_dma)
			hwif->rqsize = 256;
		else
			hwif->rqsize = 65536;

in ide-probe.c ?

Thanks a million for any pointers!

Steven

#1 lore raw
Quoted 4 lines

And wrote a evry simple IDE driver for it. BAsicly the HDD internbal registers are just memory mapped. No DMA is supported by the hardware. But I think it would be capable of 48bit LBA mode (which just means setting the HOB bit in the device control register of the HDD correctly?)

And not caching stuff wrongly

Quoted 5 lines

Now I wonder what the impact of setting

	hwif->no_lba48 = 1;		/* 1 = cannot do LBA48 */
	hwif->no_lba48_dma = 1;		/* 1 = cannot do LBA48 DMA */

no_lba48_dma turns off the use of DMA for 48bit commands, the kernel tries to issue DMA commands where possible but if it cannot issues LBA48 PIO commands (eg for the end part of a disk)

no_lba48 disables LBA48 so you won't be able to access the further parts of the disk or some newer features.

Quoted 5 lines

would be.

IIUC then no_lba48 would limit the useable size to 130GB? Will every HDD work with no_lba48 set to 1? Even those which actually support 48bit LBA?

No guarantees, but you ought to be able to use the first part of the disk ok.

Quoted 8 lines

How about performance impact of

		if (hwif->no_lba48 || hwif->no_lba48_dma)
			hwif->rqsize = 256;
		else
			hwif->rqsize = 65536;

in ide-probe.c ?

Only relevant for DMA really

#2 lore raw

Alan,

Quoted 10 lines
Quoted 8 lines

How about performance impact of

		if (hwif->no_lba48 || hwif->no_lba48_dma)
			hwif->rqsize = 256;
		else
			hwif->rqsize = 65536;

in ide-probe.c ?

Only relevant for DMA really

So rqsize is only needed for DMA accesses?

#3 lore raw
Quoted 3 lines
Quoted 1 line

Only relevant for DMA really

So rqsize is only needed for DMA accesses?

PIO transfers are sector at a time, or multi-sector up to a usual limit of about 16 sectors.

#4 lore raw

Hello.

Quoted 3 lines · Alan
Quoted 3 lines
Quoted 1 line

Only relevant for DMA really

So rqsize is only needed for DMA accesses?

Not really, it affects both PIO and DMA.

Quoted 2 lines

PIO transfers are sector at a time, or multi-sector up to a usual limit of about 16 sectors.

You're clearly mixing 2 things here. PIO transfers are 1 sectors _per
interrupt_ or N (usually 16) sectors in the multiple mode. The ANSI specified transfer limit is 256 for LBA28 (which fails on some drives), and 65536 with LBA48 _per command_.

MBR, Sergei

#5 lore raw
Quoted 9 lines · On Wed, 07 Feb 2007 16:49:44 +0300 Sergei Shtylyov <[email protected]>…

Hello.

Quoted 3 lines · Alan
Quoted 3 lines
Quoted 1 line

Only relevant for DMA really

So rqsize is only needed for DMA accesses?

Not really, it affects both PIO and DMA.

Yes but its not relevant. The question was about performance, and your performance will suck equally with PIO regardless of the request size limit.

Alan

#6 lore raw
Quoted 7 lines · Alan
Quoted 4 lines · On Wed, 07 Feb 2007 16:49:44 +0300 Sergei Shtylyov <[email protected]>…

Hello.

Alan wrote:

Quoted 7 lines
Quoted 3 lines
Quoted 2 lines
Quoted 2 lines
Quoted 1 line

Only relevant for DMA really

So rqsize is only needed for DMA accesses?

Not really, it affects both PIO and DMA.

Yes but its not relevant. The question was about performance, and your performance will suck equally with PIO regardless of the request size limit.

Ok: I rephrase my question:

Could it be that my HDD behaves strangly (i.e. doing

hda: status timeout: status=0xd0 { Busy }
ide: failed opcode was: unknown
hda: no DRQ after issuing MULTWRITE_EXT
ide0: unexpected interrupt, status=0x80, count=1
ide0: reset: success

) sometimes when rqsize is set to 65536 altough I only do PIO transfer?

Steven

#7 lore raw
Quoted 7 lines

hda: status timeout: status=0xd0 { Busy }
ide: failed opcode was: unknown
hda: no DRQ after issuing MULTWRITE_EXT
ide0: unexpected interrupt, status=0x80, count=1
ide0: reset: success

) sometimes when rqsize is set to 65536 altough I only do PIO transfer?

If your hardware support for LBA48 is broken and you've not disabled LBA48 then your hardware will do many strange things.

If however the hwif->no_lba48 is set then drive->addressing ends up as 0 so LBA48 commands should never be issued and rqsize should never get > 256.

Alan

#8 lore raw
In reply to Alan

Hello.

Quoted 9 lines · Alan
Quoted 5 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line

Only relevant for DMA really

So rqsize is only needed for DMA accesses?

Not really, it affects both PIO and DMA.

Yes but its not relevant. The question was about performance, and your performance will suck equally with PIO regardless of the request size limit.

Performace would suck even more with the single sector transfers. :-)

Quoted 1 line

Alan

MBR, Sergei

#9 lore raw
In reply to Alan

Alan,

Quoted 5 lines
Quoted 2 lines
Quoted 1 line

Only relevant for DMA really

So rqsize is only needed for DMA accesses?

PIO transfers are sector at a time, or multi-sector up to a usual limit of about 16 sectors.

So again: rqsize does not matter for PIO transfer?

Looking at the lines

	if (hwif->no_lba48_dma && lba48 && dma) {
		if (block + rq->nr_sectors > 1ULL << 28)
			dma = 0;
		else
			lba48 = 0;
	}

in drivers/ide/ide-disk.c. Does that mean that 48bit LBA adressing using the task_ioreg_t stuff is only used for sector numbers larger 1 << 28? Thus for small HDDs only LBA28 ist used by

			hwif->OUTB(block, IDE_SECTOR_REG);
			hwif->OUTB(block>>=8, IDE_LCYL_REG);
			hwif->OUTB(block>>=8, IDE_HCYL_REG);

???

Thanks a million!!!!

Steven

#10 lore raw
Quoted 10 lines · On Wed, 07 Feb 2007 14:57:27 +0100 Steven Scholz <[email protected]>…

Alan,

Quoted 5 lines
Quoted 2 lines
Quoted 1 line

Only relevant for DMA really

So rqsize is only needed for DMA accesses?

PIO transfers are sector at a time, or multi-sector up to a usual limit of about 16 sectors.

So again: rqsize does not matter for PIO transfer?

Quoted 8 lines

Looking at the lines

	if (hwif->no_lba48_dma && lba48 && dma) {
		if (block + rq->nr_sectors > 1ULL << 28)
			dma = 0;
		else
			lba48 = 0;
	}

This code is for DMA transfers when we need LBA48 and can't do it. The general code tries to avoid LBA48 commands when possible as they require two loads of the taskfile which has a performance impact. The old IDE code didn't use to do this for PIO that I remember but I'd need to re-read the code in case it ever got changed. If it doesn't its not hard to add a check for the PIO case.

#11 lore raw
In reply to Steven Scholz

Hello.

Quoted 16 lines · Steven Scholz
Quoted 4 lines
Quoted 1 line

So rqsize is only needed for DMA accesses?

PIO transfers are sector at a time, or multi-sector up to a usual limit of about 16 sectors.

So again: rqsize does not matter for PIO transfer?

Looking at the lines

	if (hwif->no_lba48_dma && lba48 && dma) {
		if (block + rq->nr_sectors > 1ULL << 28)
			dma = 0;
		else
			lba48 = 0;
	}
Quoted 2 lines

in drivers/ide/ide-disk.c. Does that mean that 48bit LBA adressing using the task_ioreg_t stuff is only used for sector numbers larger 1 << 28?

If you're asking in general, no, that does not follow from that code. It only takes care of the no_lba48_dma case.

MBR, Sergei