Add calls to flush_kernel_dcache_page() after CPU has kmapped and modified a page. This fixes PIO cache coherency bugs on architectures with aliased caches. Signed-off-by: Tejun Heo <htejun@xxxxxxxxx> --- drivers/scsi/libata-core.c | 5 +++++ drivers/scsi/libata-scsi.c | 1 + 2 files changed, 6 insertions(+), 0 deletions(-) cc874e5080d87eff23a1576df11ddaaeae9575ec diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c index b046ffa..47eb263 100644 --- a/drivers/scsi/libata-core.c +++ b/drivers/scsi/libata-core.c @@ -2821,6 +2821,7 @@ static void ata_sg_clean(struct ata_queu struct scatterlist *psg = &qc->pad_sgent; void *addr = kmap_atomic(psg->page, KM_IRQ0); memcpy(addr + psg->offset, pad_buf, qc->pad_len); + flush_kernel_dcache_page(kmap_atomic_to_page(addr)); kunmap_atomic(addr, KM_IRQ0); } } else { @@ -3451,6 +3452,8 @@ static void ata_pio_sector(struct ata_qu do_write = (qc->tf.flags & ATA_TFLAG_WRITE); ata_data_xfer(ap, buf, ATA_SECT_SIZE, do_write); + if (!do_write) + flush_kernel_dcache_page(page); kunmap(page); } @@ -3533,6 +3536,8 @@ next_sg: /* do the actual data transfer */ ata_data_xfer(ap, buf, count, do_write); + if (!do_write) + flush_kernel_dcache_page(page); kunmap(page); if (bytes) diff --git a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c index a0289ec..b65d7f5 100644 --- a/drivers/scsi/libata-scsi.c +++ b/drivers/scsi/libata-scsi.c @@ -1500,6 +1500,7 @@ static inline void ata_scsi_rbuf_put(str struct scatterlist *sg; sg = (struct scatterlist *) cmd->request_buffer; + flush_kernel_dcache_page(kmap_atomic_to_page(buf - sg->offset)); kunmap_atomic(buf - sg->offset, KM_USER0); } } -- 1.3.2 - : send the line "unsubscribe linux-scsi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html