libata: align ap->sector_buf
PATCH 1/2 libata: align ap->sector_buf
ap->sector_buf is used as DMA target and should at least be aligned on cacheline. This caused problems on some embedded machines.
Signed-off-by Tejun Heo <[email protected]>
--- include/linux/libata.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
include/linux/libata.h +2 -1
@@ -750,7 +750,8 @@ struct ata_port {acpi_handle acpi_handle;struct ata_acpi_gtm __acpi_init_gtm;/* use ata_acpi_init_gtm() */ #endif -u8 sector_buf[ATA_SECT_SIZE ];/* owned by EH */ +/* owned by EH */ +u8 sector_buf[ATA_SECT_SIZE ]____cacheline_aligned ; };/* The following initializer overrides a method to NULL whether one of
PATCH 2/2 libata: don't use on-stack sense buffer
sense_buffer is used as DMA target and shouldn't be allocated on stack. Use ap->sector_buf instead. This problem is spotted by Chuck Ebbert.
Signed-off-by Tejun Heo <[email protected]>
Reported-by Chuck Ebbert <[email protected]>
--- drivers/ata/libata-eh.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ata/libata-eh.c +1 -1
@@ -2901,7 +2901,7 @@ static int atapi_eh_clear_ua(struct ata_device *dev)int i;for (i =0 ; i <ATA_EH_UA_TRIES ; i++) { -u8 sense_buffer[SCSI_SENSE_BUFFERSIZE ]; +u8 *sense_buffer = dev->link->ap->sector_buf;u8 sense_key =0 ;unsigned int err_mask;