summaryrefslogtreecommitdiff
path: root/linux/src
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2014-11-13 01:25:29 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2014-11-13 01:25:29 +0100
commitacf1525f4dec4088c075e4d7847be7305873a3a9 (patch)
tree558732397d8c0eed592eda9bd387b789742e5cf5 /linux/src
parentdccf8be4b40ede12941ff347781fbff9330b2280 (diff)
Add nodma options
Some very slow qemu instances would eventually trigger DMA timeouts, let's give a way to disable DMA there, it does not actually slow down operations anyway. * linux/src/drivers/block/ide.h (ide_drive_s): Add nodma field. * linux/src/drivers/block/ide.c (do_identify): Do not call dmaproc(ide_dma_check) when nodma is 1. (ide_setup): Add nodma option.
Diffstat (limited to 'linux/src')
-rw-r--r--linux/src/drivers/block/ide.c10
-rw-r--r--linux/src/drivers/block/ide.h1
2 files changed, 8 insertions, 3 deletions
diff --git a/linux/src/drivers/block/ide.c b/linux/src/drivers/block/ide.c
index 7b639f7..41a2601 100644
--- a/linux/src/drivers/block/ide.c
+++ b/linux/src/drivers/block/ide.c
@@ -2526,7 +2526,7 @@ static inline void do_identify (ide_drive_t *drive, byte cmd)
drive->media = ide_tape;
drive->present = 1;
drive->removable = 1;
- if (drive->autotune != 2 && HWIF(drive)->dmaproc != NULL) {
+ if (drive->autotune != 2 && HWIF(drive)->dmaproc != NULL && !drive->nodma) {
if (!HWIF(drive)->dmaproc(ide_dma_check, drive))
printk(", DMA");
}
@@ -2653,7 +2653,7 @@ static inline void do_identify (ide_drive_t *drive, byte cmd)
if (drive->mult_req || ((id->multsect_valid & 1) && id->multsect))
drive->special.b.set_multmode = 1;
}
- if (drive->autotune != 2 && HWIF(drive)->dmaproc != NULL) {
+ if (drive->autotune != 2 && HWIF(drive)->dmaproc != NULL && !drive->nodma) {
if (!(HWIF(drive)->dmaproc(ide_dma_check, drive))) {
if ((id->field_valid & 4) && (id->dma_ultra & (id->dma_ultra >> 8) & 7))
printk(", UDMA");
@@ -3108,6 +3108,7 @@ static int match_parm (char *s, const char *keywords[], int vals[], int max_vals
* Not fully supported by all chipset types,
* and quite likely to cause trouble with
* older/odd IDE drives.
+ * "hdx=nodma" : disallow DMA for the drive
*
* "idebus=xx" : inform IDE driver of VESA/PCI bus speed in Mhz,
* where "xx" is between 20 and 66 inclusive,
@@ -3172,7 +3173,7 @@ void ide_setup (char *s)
#endif
const char *hd_words[] = {"none", "noprobe", "nowerr", "cdrom",
"serialize", "autotune", "noautotune",
- "slow", "ide-scsi", NULL};
+ "slow", "ide-scsi", "nodma", NULL};
#ifdef MACH
unit = s[2] - '0';
#else
@@ -3212,6 +3213,9 @@ void ide_setup (char *s)
case -9: /* "ide-scsi" */
drive->ide_scsi = 1;
goto done;
+ case -10: /* "nodma" */
+ drive->nodma = 1;
+ goto done;
case 3: /* cyl,head,sect */
drive->media = ide_disk;
drive->cyl = drive->bios_cyl = vals[0];
diff --git a/linux/src/drivers/block/ide.h b/linux/src/drivers/block/ide.h
index edeedc9..28e371b 100644
--- a/linux/src/drivers/block/ide.h
+++ b/linux/src/drivers/block/ide.h
@@ -344,6 +344,7 @@ typedef struct ide_drive_s {
unsigned nobios : 1; /* flag: do not probe bios for drive */
unsigned slow : 1; /* flag: slow data port */
unsigned autotune : 2; /* 1=autotune, 2=noautotune, 0=default */
+ unsigned nodma : 1; /* disk should not use dma for read/write */
#if FAKE_FDISK_FOR_EZDRIVE
unsigned remap_0_to_1 : 1; /* flag: partitioned with ezdrive */
#endif /* FAKE_FDISK_FOR_EZDRIVE */