Skip to contentSkip to conversation

ide: don't enable local IRQs for PIO-in in driver_cmd_intr()

PATCH In review Bartlomiej Zolnierkiewicz 2 participants 4 messages Dec 9, 2007 – Dec 13, 2007 libata

lore
Share & tools
lore
#0 lore raw

PATCH 15/20 ide: don't enable local IRQs for PIO-in in driver_cmd_intr()

Don't enable local IRQs for PIO-in protocol in driver_cmd_intr().

While at it:

* Remove redundant rq->cmd_type check.

* Read status register after enabling local IRQs for no-data protocol.

---
 drivers/ide/ide-io.c |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/ide/ide-io.c +6 -5
Index: b/drivers/ide/ide-io.c
===================================================================
@@ -638,17 +638,18 @@ static ide_startstop_t drive_cmd_intr (i
 {
 	struct request *rq = HWGROUP(drive)->rq;
 	ide_hwif_t *hwif = HWIF(drive);
-	u8 *args = (u8 *) rq->buffer;
-	u8 stat = hwif->INB(IDE_STATUS_REG);
+	u8 *args = (u8 *)rq->buffer, pio_in = (args && args[3]) ? 1 : 0, stat;
 
-	local_irq_enable_in_hardirq();
-	if (rq->cmd_type == REQ_TYPE_ATA_CMD &&
-	    (stat & DRQ_STAT) && args && args[3]) {
+	if (pio_in) {
 		u8 io_32bit = drive->io_32bit;
+		stat = hwif->INB(IDE_STATUS_REG);
 		drive->io_32bit = 0;
 		hwif->ata_input_data(drive, &args[4], args[3] * SECTOR_WORDS);
 		drive->io_32bit = io_32bit;
 		stat = wait_drive_not_busy(drive);
+	} else {
+		local_irq_enable_in_hardirq();
+		stat = hwif->INB(IDE_STATUS_REG);
 	}
 
 	if (!OK_STAT(stat, READY_STAT, BAD_STAT))
#1 lore raw
Quoted 18 lines · Bartlomiej Zolnierkiewicz

Don't enable local IRQs for PIO-in protocol in driver_cmd_intr().

While at it:

* Remove redundant rq->cmd_type check.

* Read status register after enabling local IRQs for no-data protocol.

Index: b/drivers/ide/ide-io.c
===================================================================

drivers/ide/ide-io.c +0 -0
@@ -638,17 +638,18 @@ static ide_startstop_t drive_cmd_intr (i
 {
 	struct request *rq = HWGROUP(drive)->rq;
 	ide_hwif_t *hwif = HWIF(drive);

drivers/ide/ide-io.c static ide_startstop_t drive_cmd_intr (i · line 645

Quoted 10 lines
drivers/ide/ide-io.c +3 -5
-	u8 *args = (u8 *) rq->buffer;
-	u8 stat = hwif->INB(IDE_STATUS_REG);
+	u8 *args = (u8 *)rq->buffer, pio_in = (args && args[3]) ? 1 : 0, stat;
 
-	local_irq_enable_in_hardirq();
-	if (rq->cmd_type == REQ_TYPE_ATA_CMD &&
-	    (stat & DRQ_STAT) && args && args[3]) {
+	if (pio_in) {
 		u8 io_32bit = drive->io_32bit;
+		stat = hwif->INB(IDE_STATUS_REG);

You've lost DRQ=1 check (which is returned in the next patch however)...

MBR, Sergei

#2 lore raw
Quoted 24 lines · Sergei Shtylyov
Quoted 22 lines · Bartlomiej Zolnierkiewicz

Don't enable local IRQs for PIO-in protocol in driver_cmd_intr().

While at it:

* Remove redundant rq->cmd_type check.

* Read status register after enabling local IRQs for no-data protocol.

Index: b/drivers/ide/ide-io.c
===================================================================

drivers/ide/ide-io.c +1 -2
@@ -638,17 +638,18 @@ static ide_startstop_t drive_cmd_intr (i
 {
 	struct request *rq = HWGROUP(drive)->rq;
 	ide_hwif_t *hwif = HWIF(drive);
-	u8 *args = (u8 *) rq->buffer;
-	u8 stat = hwif->INB(IDE_STATUS_REG);
+	u8 *args = (u8 *)rq->buffer, pio_in = (args && args[3]) ? 1 : 0, stat;
 
Quoted 8 lines

drivers/ide/ide-io.c static ide_startstop_t drive_cmd_intr (i · line 645

Quoted 6 lines
drivers/ide/ide-io.c +2 -3
-	local_irq_enable_in_hardirq();
-	if (rq->cmd_type == REQ_TYPE_ATA_CMD &&
-	    (stat & DRQ_STAT) && args && args[3]) {
+	if (pio_in) {
 		u8 io_32bit = drive->io_32bit;
+		stat = hwif->INB(IDE_STATUS_REG);

You've lost DRQ=1 check (which is returned in the next patch however)...

Thanks, revised patch below.

[PATCH] ide: don't enable local IRQs for PIO-in in driver_cmd_intr() (take 2)

Don't enable local IRQs for PIO-in protocol in driver_cmd_intr().

While at it:

* Remove redundant rq->cmd_type check.

* Read status register after enabling local IRQs for no-data protocol.

v2:
* Re-add DRQ=1 check lost in v1 (noticed by Sergei).

---
 drivers/ide/ide-io.c |   15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)
drivers/ide/ide-io.c +9 -6
Index: b/drivers/ide/ide-io.c
===================================================================
@@ -638,19 +638,22 @@ static ide_startstop_t drive_cmd_intr (i
 {
 	struct request *rq = HWGROUP(drive)->rq;
 	ide_hwif_t *hwif = HWIF(drive);
-	u8 *args = (u8 *) rq->buffer;
-	u8 stat = hwif->INB(IDE_STATUS_REG);
+	u8 *args = (u8 *)rq->buffer, pio_in = (args && args[3]) ? 1 : 0, stat;
 
-	local_irq_enable_in_hardirq();
-	if (rq->cmd_type == REQ_TYPE_ATA_CMD &&
-	    (stat & DRQ_STAT) && args && args[3]) {
+	if (pio_in) {
 		u8 io_32bit = drive->io_32bit;
+		stat = hwif->INB(IDE_STATUS_REG);
+		if ((stat & DRQ_STAT) == 0)
+			goto out;
 		drive->io_32bit = 0;
 		hwif->ata_input_data(drive, &args[4], args[3] * SECTOR_WORDS);
 		drive->io_32bit = io_32bit;
 		stat = wait_drive_not_busy(drive);
+	} else {
+		local_irq_enable_in_hardirq();
+		stat = hwif->INB(IDE_STATUS_REG);
 	}
-
+out:
 	if (!OK_STAT(stat, READY_STAT, BAD_STAT))
 		return ide_error(drive, "drive_cmd", stat);
 		/* calls ide_end_drive_cmd */
#3 lore raw
Quoted 32 lines · Bartlomiej Zolnierkiewicz
Quoted 12 lines
Quoted 12 lines

Index: b/drivers/ide/ide-io.c
===================================================================

drivers/ide/ide-io.c +1 -2
@@ -638,17 +638,18 @@ static ide_startstop_t drive_cmd_intr (i
 {
 	struct request *rq = HWGROUP(drive)->rq;
 	ide_hwif_t *hwif = HWIF(drive);
-	u8 *args = (u8 *) rq->buffer;
-	u8 stat = hwif->INB(IDE_STATUS_REG);
+	u8 *args = (u8 *)rq->buffer, pio_in = (args && args[3]) ? 1 : 0, stat;
 
Quoted 8 lines

drivers/ide/ide-io.c static ide_startstop_t drive_cmd_intr (i · line 645

Quoted 6 lines
drivers/ide/ide-io.c +2 -3
-	local_irq_enable_in_hardirq();
-	if (rq->cmd_type == REQ_TYPE_ATA_CMD &&
-	    (stat & DRQ_STAT) && args && args[3]) {
+	if (pio_in) {
 		u8 io_32bit = drive->io_32bit;
+		stat = hwif->INB(IDE_STATUS_REG);

You've lost DRQ=1 check (which is returned in the next patch however)...

Thanks, revised patch below.

[PATCH] ide: don't enable local IRQs for PIO-in in driver_cmd_intr() (take 2)

Don't enable local IRQs for PIO-in protocol in driver_cmd_intr().

While at it:

* Remove redundant rq->cmd_type check.

Quoted 7 lines

* Read status register after enabling local IRQs for no-data protocol.

v2:
* Re-add DRQ=1 check lost in v1 (noticed by Sergei).

MBR, Sergei