Re: [PATCH 4/4] firewire: sbp2: remove overzealous alignment constraints

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


On May 18 Clemens Ladisch wrote at linux1394-devel:
> The SBP-2/3 specifications do not require any alignment of data
> buffers; only their own data structures need to be quadlet-aligned.

SBP-2 clause 3.1.2.24 requires that system memory accepts quadlet r/w
access.  Memory which is not aligned at quadlet boundaries is not
accessible by quadlet accesses per IEEE 1394 clause 6.2.5.2.2.

> This patch is perfectly safe because there is no actual change:
> the SCSI framework uses a default block queue DMA alignment of
> 32 bits anyway.

This code was added after recommendation to set it explicitly in the
driver:
http://marc.info/?l=linux-scsi&m=120137366708017
http://thread.gmane.org/gmane.linux.kernel.firewire.devel/11424

It is probably not going to happen that somebody decreases the SCSI
default.  But perhaps we should still keep this explicit...?

> Signed-off-by: Clemens Ladisch <clemens@xxxxxxxxxx>
> ---
>  drivers/firewire/sbp2.c |    8 ++------
>  1 files changed, 2 insertions(+), 6 deletions(-)
> 
> --- a/drivers/firewire/sbp2.c
> +++ b/drivers/firewire/sbp2.c
> @@ -207,9 +207,8 @@ static const struct device *lu_dev(const struct sbp2_logical_unit *lu)
>  #define SBP2_MAX_CDB_SIZE		16
> 
>  /*
> - * The default maximum s/g segment size of a FireWire controller is
> - * usually 0x10000, but SBP-2 only allows 0xffff. Since buffers have to
> - * be quadlet-aligned, we set the length limit to 0xffff & ~3.
> + * The maximum SBP-2 data buffer size is 0xffff.  We quadlet-align this
> + * for compatibility with earlier versions of this driver.
>   */
>  #define SBP2_MAX_SEG_SIZE		0xfffc
> 
> @@ -1530,9 +1529,6 @@ static int sbp2_scsi_slave_alloc(struct scsi_device *sdev)
> 
>  	sdev->allow_restart = 1;
> 
> -	/* SBP-2 requires quadlet alignment of the data buffers. */
> -	blk_queue_update_dma_alignment(sdev->request_queue, 4 - 1);
> -
>  	if (lu->tgt->workarounds & SBP2_WORKAROUND_INQUIRY_36)
>  		sdev->inquiry_len = 36;
> 

-- 
Stefan Richter
-=====-===-- -=-= =--=-
http://arcgraph.de/sr/
--
To unsubscribe from this list: 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


[SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Photos]     [Yosemite]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

Add to Google Powered by Linux