Re: [PATCH 13/24] scsi: Kill DRIVER_SENSE

2019-10-21 Thread Finn Thain
> diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c > b/drivers/scsi/megaraid/megaraid_sas_base.c > index c40fbea06cc5..649f9610ca72 100644 > --- a/drivers/scsi/megaraid/megaraid_sas_base.c > +++ b/drivers/scsi/megaraid/megaraid_sas_base.c > @@ -1,3 +1,4 @@ > + > // SPDX-License-Identifier

Re: [PATCH 12/24] scsi: introduce scsi_build_sense()

2019-10-21 Thread Finn Thain
On Mon, 21 Oct 2019, Hannes Reinecke wrote: > Introduce scsi_build_sense() as a wrapper around > scsi_build_sense_buffer() to format the buffer and set > the correct SCSI status. > > Signed-off-by: Hannes Reinecke > --- > drivers/ata/libata-scsi.c | 7 ++-- > drivers/s390/scsi/zf

Re: [PATCH RFC 00/24] scsi: Revamp result values

2019-10-21 Thread Finn Thain
On Mon, 21 Oct 2019, Douglas Gilbert wrote: > > > As usual, comments and reviews are welcome. > > It is hard to make an omelette without breaking some eggs. > Coccinelle can minimize the breakage; particularly the straight-forward conversion of (FOO << 1) to SAM_STAT_BAR. -- > Doug Gilbert

Re: [PATCH 05/24] scsi: use standard SAM status codes

2019-10-21 Thread Finn Thain
On Mon, 21 Oct 2019, Hannes Reinecke wrote: > Use standard SAM status codes and omit the explicit shift to convert > to linus-specific ones. "Linux-specific". -- > > Signed-off-by: Hannes Reinecke > --- > drivers/ata/libata-scsi.c | 2 +- > drivers/infiniband/ulp/srp/ib_srp.c

Re: [PATCH 03/24] wd33c93: use SCSI status

2019-10-21 Thread Finn Thain
On Mon, 21 Oct 2019, Hannes Reinecke wrote: > Use standard SCSI status and drop usage of the linux-specific ones. > > Signed-off-by: Hannes Reinecke > --- > drivers/scsi/wd33c93.c | 21 - > 1 file changed, 8 insertions(+), 13 deletions(-) > > diff --git a/drivers/scsi/wd33c

Re: [PATCH 10/24] scsi: introduce set_status_byte()

2019-10-21 Thread Finn Thain
On Mon, 21 Oct 2019, Hannes Reinecke wrote: > To be in-line with the other set_XX_byte() functions. > > Signed-off-by: Hannes Reinecke > --- > include/scsi/scsi_cmnd.h | 5 + > 1 file changed, 5 insertions(+) > > diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h > index 91bd

[RFC] scsi: Avoid sign extension when setting command result bytes, was Re: [PATCH v5 00/13] scsi: core: fix uninit-value access of variable sshdr

2019-10-18 Thread Finn Thain
On Fri, 18 Oct 2019, Martin K. Petersen wrote: > > (Sorry, zhengbin, you opened a can of worms. This is some of our oldest > and most arcane code in SCSI) > A call to set_host_byte(cmd, x) or set_msg_byte(cmd, x) when x & 0x80 is set clobbers the most significant bytes in cmd->result. Avoid t

Re: [PATCH v3] scsi: core: fix uninit-value access of variable sshdr

2019-10-16 Thread Finn Thain
On Sat, 12 Oct 2019, zhengbin wrote: > kmsan report a warning in 5.1-rc4: > > BUG: KMSAN: uninit-value in sr_get_events drivers/scsi/sr.c:207 [inline] > BUG: KMSAN: uninit-value in sr_check_events+0x2cf/0x1090 drivers/scsi/sr.c:243 > CPU: 1 PID: 13858 Comm: syz-executor.0 Tainted: GB

Re: [PATCH V2] scsi: save/restore command resid for error handling

2019-09-30 Thread Finn Thain
On Sat, 28 Sep 2019, Damien Le Moal wrote: > When a non-passthrough command is terminated with CHECK CONDITION, > request sense is executed by hijacking the command descriptor. Since > scsi_eh_prep_cmnd() and scsi_eh_restore_cmnd() do not save/restore the > original command resid, the value return

Re: [PATCH 0/2] Fix SCSI & USB Storage CHECK CONDITION handling

2019-09-27 Thread Finn Thain
[snipped selective measurements of word usage] On Fri, 27 Sep 2019, Alan Stern wrote: > > So I guess this was never defined precisely. > The O.E.D. defines these terms: residual a. [...] n. 1. a quantity remaining after other things have been subtracted

Re: [PATCH V5 10/16] s390: zfcp_fc: use sg helper to operate scatterlist

2019-06-24 Thread Finn Thain
On Tue, 25 Jun 2019, Ming Lei wrote: > On Tue, Jun 25, 2019 at 12:01:24PM +1000, Finn Thain wrote: > > > diff --git a/drivers/s390/scsi/zfcp_dbf.c b/drivers/s390/scsi/zfcp_dbf.c > > > index dccdb41bed8c..c7129f5234f0 100644 > > > --- a/drivers/s390/scsi/zfcp_dbf.c

Re: [PATCH V5 10/16] s390: zfcp_fc: use sg helper to operate scatterlist

2019-06-24 Thread Finn Thain
> diff --git a/drivers/s390/scsi/zfcp_dbf.c b/drivers/s390/scsi/zfcp_dbf.c > index dccdb41bed8c..c7129f5234f0 100644 > --- a/drivers/s390/scsi/zfcp_dbf.c > +++ b/drivers/s390/scsi/zfcp_dbf.c > @@ -552,7 +552,7 @@ static u16 zfcp_dbf_san_res_cap_len_if_gpn_ft(char *tag, > if (x % (ZFCP

Re: [PATCH V5 11/16] scsi: aha152x: use sg helper to operate scatterlist

2019-06-17 Thread Finn Thain
On Tue, 18 Jun 2019, Ming Lei wrote: > From: Finn Thain > > Use the scatterlist iterators and remove direct indexing of the > scatterlist array. > > This way allows us to pre-allocate one small scatterlist, which can be > chained with one runtime allocated scatterlist if

Re: [PATCH V4 11/16] scsi: aha152x: use sg helper to operate scatterlist

2019-06-17 Thread Finn Thain
On Mon, 17 Jun 2019, Finn Thain wrote: > On Mon, 17 Jun 2019, Ming Lei wrote: > > > Use the scatterlist iterators and remove direct indexing of the > > scatterlist array. > > > > This way allows us to pre-allocate one small scatterlist, which can be > >

Re: [PATCH V4 11/16] scsi: aha152x: use sg helper to operate scatterlist

2019-06-16 Thread Finn Thain
n't enough for the whole request. > > Finn added the change to replace SCp.buffers_residual with sg_is_last() > for fixing updating it, and the similar change has been applied on > NCR5380.c > > Cc: Finn Thain > Signed-off-by: Ming Lei Reviewed-by: Finn Thain

Re: [PATCH V3 10/15] scsi: aha152x: use sg helper to operate scatterlist

2019-06-14 Thread Finn Thain
On Fri, 14 Jun 2019, Ming Lei wrote: > > Follows the fixed version, could you review again? > > From f03484d4bac083c39d70665cfbadb641093b63de Mon Sep 17 00:00:00 2001 > From: Ming Lei > Date: Wed, 12 Jun 2019 20:37:35 +0800 > Subject: [PATCH] scsi: aha152x: use sg helper to operate scatterlist

Re: [PATCH V3 07/15] usb: image: microtek: use sg helper to operate scatterlist

2019-06-13 Thread Finn Thain
On Fri, 14 Jun 2019, Ming Lei wrote: > Use the scatterlist iterators and remove direct indexing of the > scatterlist array. > > This way allows us to pre-allocate one small scatterlist, which can be > chained with one runtime allocated scatterlist if the pre-allocated one > isn't enough for the w

Re: [PATCH V3 10/15] scsi: aha152x: use sg helper to operate scatterlist

2019-06-13 Thread Finn Thain
Hi Ming, On Fri, 14 Jun 2019, Ming Lei wrote: > Use the scatterlist iterators and remove direct indexing of the > scatterlist array. > > This way allows us to pre-allocate one small scatterlist, which can be > chained with one runtime allocated scatterlist if the pre-allocated one > isn't enough

Re: [PATCH V3 0/3] scsi: three SG_CHAIN related fixes

2019-06-06 Thread Finn Thain
On Thu, 6 Jun 2019, Martin K. Petersen wrote: > > Ming, > > > Guenter reported scsi boot issue caused by commit c3288dd8c232 ("scsi: > > core: avoid pre-allocating big SGL for data"). > > Applied to 5.3/scsi-queue, thank you! > Thanks, that seems to fix the esp_scsi regression. Am I right in

Re: [PATCH V2 3/3] scsi: esp: make it working on SG_CHAIN

2019-06-04 Thread Finn Thain
On Wed, 5 Jun 2019, Ming Lei wrote: > The driver expects that SCSI SGL is a simply array of SG, and itereate > the SGL via integer index. This way is obviously wrong, because of > SG_CHAIN. > > Fixes it by using sgl helper. > > V2: > - as suggested by Finn Thai

Re: [PATCH 2/2] scsi: esp: make it working on SG_CHAIN

2019-06-04 Thread Finn Thain
On Tue, 4 Jun 2019, Ming Lei wrote: > The driver supporses that there isn't sg chain, and itereate the > list one by one. This way is obviously wrong. > > Fixes it by sgl helper. > > Cc: Christoph Hellwig > Cc: Bart Van Assche > Cc: Ewan D. Milne > Cc: Hannes Reinecke > Cc: Guenter Roeck >

Re: [PATCH] scsi/NCR5380: Avoid compiler warning when -Wimplicit-fallthrough is enabled

2019-04-08 Thread Finn Thain
On Mon, 8 Apr 2019, Gustavo A. R. Silva wrote: > Hi all, > > Friendly ping: > > Who can take this? > > Thanks > It has been queued up by Martin and James on git.kernel.org. Apparently it is to be pushed in the v5.2 merge window. --

[PATCH] scsi/NCR5380: Remove set but unused variable

2019-03-07 Thread Finn Thain
Cc: Michael Schmitz Signed-off-by: Finn Thain --- drivers/scsi/NCR5380.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/scsi/NCR5380.c b/drivers/scsi/NCR5380.c index 01c23d27f290..7fed9bb72784 100644 --- a/drivers/scsi/NCR5380.c +++ b/drivers/scsi/NCR5380.c

[PATCH] scsi/NCR5380: Avoid compiler warning when -Wimplicit-fallthrough is enabled

2019-03-07 Thread Finn Thain
Adjust comments accordingly. Cc: Gustavo A. R. Silva Cc: Michael Schmitz Signed-off-by: Finn Thain --- drivers/scsi/NCR5380.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/NCR5380.c b/drivers/scsi/NCR5380.c index 7fed9bb72784..fe0535affc14 100644

Re: [PATCH v2] scsi: NCR5380: Mark expected switch fall-through

2019-02-28 Thread Finn Thain
On Thu, 28 Feb 2019, Gustavo A. R. Silva wrote: > In preparation to enabling -Wimplicit-fallthrough, mark switch > cases where we are expecting to fall through. > This switch case is already marked. So I think the patch description should state that this patch is actually a workaround for a gcc

Re: [PATCH v9 00/22] Re-use nvram module

2019-01-22 Thread Finn Thain
On Tue, 22 Jan 2019, Greg Kroah-Hartman wrote: > On Tue, Jan 15, 2019 at 03:18:56PM +1100, Finn Thain wrote: > > The "generic" NVRAM module, drivers/char/generic_nvram.c, implements a > > /dev/nvram misc device. This module is used only by 32-bit PowerPC > > pl

[PATCH v9 01/22] scsi/atari_scsi: Don't select CONFIG_NVRAM

2019-01-14 Thread Finn Thain
n this patch and the subsequent fbdev driver patch, the convention is adopted across all relevant platforms whereby NVRAM functionality gets enabled in a given device driver when the nvram misc device is built-in or when both drivers are modules. Acked-by: Michael Schmitz Signed-off-by: Finn T

[PATCH v9 04/22] nvram: Replace nvram_* function exports with static functions

2019-01-14 Thread Finn Thain
-implemented in subsequent patches. Replace the sole validate-checksum-and-read-byte sequence with a call to nvram_read() which will gain the same semantics in subsequent patches. Remove unused exports. Acked-by: Geert Uytterhoeven Signed-off-by: Finn Thain --- arch/m68k/atari/nvram.c | 39

[PATCH v9 00/22] Re-use nvram module

2019-01-14 Thread Finn Thain
- Changed the CONFIG_NVRAM default to better approximate the present code. In particular, the CONFIG_GENERIC_NVRAM default and use of "select NVRAM". - Added more tested-by tags. For older change logs, please refer to, https://lore.kernel.org/lkml/20151101104202.301856...@telegraphics.com.a

Re: [PATCH v8 01/25] scsi/atari_scsi: Don't select CONFIG_NVRAM

2018-12-30 Thread Finn Thain
On Mon, 31 Dec 2018, Finn Thain wrote: > On Sun, 30 Dec 2018, James Bottomley wrote: > > > > > That said, as has been pointed out, the current #ifdef has a failing > > corner case when both are modular (because the code should then be > > included). The runtime

Re: [PATCH v8 01/25] scsi/atari_scsi: Don't select CONFIG_NVRAM

2018-12-30 Thread Finn Thain
On Sun, 30 Dec 2018, James Bottomley wrote: > > That said, as has been pointed out, the current #ifdef has a failing > corner case when both are modular (because the code should then be > included). The runtime macro that correctly expresses this is > IS_REACHABLE(CONFIG_NVRAM). > No, in th

Re: [PATCH v8 01/25] scsi/atari_scsi: Don't select CONFIG_NVRAM

2018-12-28 Thread Finn Thain
On Sat, 29 Dec 2018, Michael Schmitz wrote: > > IS_BUILTIN(CONFIG_NVRAM) is probably what Christophe really meant to suggest. > > Or (really going out on a limb here): > > IS_BUILTIN(CONFIG_NVRAM) || > ( IS_MODULE(CONFIG_ATARI_SCSI) && IS_ENABLED(CONFIG_NVRAM) ) > > Not that I'd advocate that,

Re: [PATCH v8 01/25] scsi/atari_scsi: Don't select CONFIG_NVRAM

2018-12-28 Thread Finn Thain
On Fri, 28 Dec 2018, LEROY Christophe wrote: > Finn Thain a ?crit?: > > > On powerpc, setting CONFIG_NVRAM=n builds a kernel with no NVRAM support. > > Setting CONFIG_NVRAM=m enables the /dev/nvram misc device module without > > enabling NVRAM support in drivers. Settin

[PATCH v8 01/25] scsi/atari_scsi: Don't select CONFIG_NVRAM

2018-12-25 Thread Finn Thain
the valkyriefb driver with powerpc, and since that driver uses NVRAM, it is affected by CONFIG_ATARI_SCSI, because of the use of "select NVRAM". Adopt the powerpc convention on m68k to avoid surprises. Signed-off-by: Finn Thain Tested-by: Christian T. Steigies --- This patch temporaril

[PATCH v8 03/25] m68k/atari: Replace nvram_{read,write}_byte with arch_nvram_ops

2018-12-25 Thread Finn Thain
l. Replace this validate-checksum-and-read-byte sequence with the equivalent rtc_nvram_ops.read() call and remove the now unused functions. Signed-off-by: Finn Thain Tested-by: Christian T. Steigies Acked-by: Geert Uytterhoeven --- The advantage of the new ops struct over the old global nvram

Re: [PATCH 01/10] gdth: refactor ioc_general

2018-12-06 Thread Finn Thain
On Thu, 6 Dec 2018, Christoph Hellwig wrote: > This function is a huge mess with duplicated error handling. Split out > a few useful helpers and use goto labels to untangle the error handling > and no-data ioctl handling. > > Signed-off-by: Christoph Hellwig > --- > drivers/scsi/gdth.c | 244

Re: DISABLE_CLUSTERING in scsi drivers

2018-12-03 Thread Finn Thain
On Mon, 3 Dec 2018, Hannes Reinecke wrote: > As I said: I need to do PIO for the last two bytes of the data buffer. > For everything else DMA works nicely, it's just the last two bytes which > might be left over in the FIFO buffer under certain circumstances. I read the driver a few times alrea

Re: DISABLE_CLUSTERING in scsi drivers

2018-12-02 Thread Finn Thain
On Sun, 2 Dec 2018, Hannes Reinecke wrote: > On 12/2/18 10:21 PM, Finn Thain wrote: > > On Sun, 2 Dec 2018, Hannes Reinecke wrote: > > > > > Well, that lone 'kmap' is due to a quirk/errata in the datasheet; > > > essentially > > > we ha

Re: DISABLE_CLUSTERING in scsi drivers

2018-12-02 Thread Finn Thain
On Sun, 2 Dec 2018, Hannes Reinecke wrote: > Well, that lone 'kmap' is due to a quirk/errata in the datasheet; essentially > we have to PIO a lone byte out of the FIFO to clear it up. > And this byte is technically still part of the SCSI data, so we need to > stuff it onto the end of the actual da

Re: DISABLE_CLUSTERING in scsi drivers

2018-11-26 Thread Finn Thain
On Mon, 26 Nov 2018, Christoph Hellwig wrote: > On Thu, Nov 22, 2018 at 09:02:13AM +1100, Finn Thain wrote: > > > you in the To list maintain or wrote SCSI drivers that set the > > > DISABLE_CLUSTERING flag, which basically disable merges of any > > > bio segment

Re: [PATCH AUTOSEL 4.19 09/36] scsi: NCR5380: Return false instead of NULL

2018-11-22 Thread Finn Thain
This patch is not relevant to any -stable branch. Please don't backport. -- On Thu, 22 Nov 2018, Sasha Levin wrote: > From: Finn Thain > > [ Upstream commit 96edebd6bb995f2acb7694bed6e01bf6f5a7b634 ] > > I overlooked this statement when I recently converted the functio

Re: DISABLE_CLUSTERING in scsi drivers

2018-11-21 Thread Finn Thain
On Wed, 21 Nov 2018, Christoph Hellwig wrote: > Hi all, > > you in the To list maintain or wrote SCSI drivers that set the > DISABLE_CLUSTERING flag, which basically disable merges of any > bio segments. We already have the actual max_segment size limit > to say which length a segment should h

Re: remove exofs and the T10 OSD code V2

2018-10-31 Thread Finn Thain
On Wed, 31 Oct 2018, Boaz Harrosh wrote: > > [...] All changes made by other kernel developers than you are the > > result of tree-wide refactoring, compiler warning fixes, fixes for > > issues detected by static source code analyzers or spelling fixes. > > Hence my question: how big is the use

[PATCH] NCR5380: Return false instead of NULL

2018-10-24 Thread Finn Thain
I overlooked this statement when I recently converted the function result type from struct scsi_cmnd * to bool. No change to object code. Signed-off-by: Finn Thain --- drivers/scsi/NCR5380.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/NCR5380.c b/drivers

Re: [PATCH 2/4] gdth: reuse dma coherent allocation in gdth_show_info

2018-10-18 Thread Finn Thain
On Thu, 18 Oct 2018, Christoph Hellwig wrote: > gdth_show_info currently allocs and frees a dma buffer four times, > which isn't very efficient. Reuse a single allocation instead. > > Signed-off-by: Christoph Hellwig > --- > drivers/scsi/gdth_proc.c | 18 +- > 1 file changed, 5

Re: [PATCH 1/4] gdth: refactor ioc_general

2018-10-18 Thread Finn Thain
On Thu, 18 Oct 2018, Christoph Hellwig wrote: > + > +static int ioc_general(void __user *arg, char *cmnd) > +{ > + gdth_ioctl_general gen; > + gdth_ha_str *ha; > + char *buf = NULL; > + u64 paddr; > + int rval; > + > + if (copy_from_user(&gen, arg, sizeof(gdth_ioctl_general

Re: [PATCH 4/4] gdth: use generic DMA API

2018-10-18 Thread Finn Thain
On Thu, 18 Oct 2018, Christoph Hellwig wrote: > Switch from the legacy PCI DMA API to the generic DMA API. Also switch > to dma_map_single from pci_map_page in one case where this makes the code > simpler. > > Signed-off-by: Christoph Hellwig > --- > drivers/scsi/gdth.c | 111

Re: [PATCH] scsi: ips: fix missing break in switch

2018-10-17 Thread Finn Thain
On Wed, 17 Oct 2018, Martin K. Petersen wrote: > > >> See the case statements above for another fast exit scenario. > >> > > > > But that's an error path. > > Look further down. Several other SCSI commands are completed as NOPs the > same way. > That's true, but it doesn't indicate a bug to

Re: [PATCH v2 5/6] esp_scsi: De-duplicate PIO routines

2018-10-17 Thread Finn Thain
On Wed, 17 Oct 2018, Christoph Hellwig wrote: > > Please leave the possibly unused exports as-is. > I take that to mean "leave the conditional export as-is". Hence, I think v3 (posted on the 16th) should address all of the concerns raised by reviewers... --

Re: [PATCH] scsi: ips: fix missing break in switch

2018-10-16 Thread Finn Thain
On Tue, 16 Oct 2018, Martin K. Petersen wrote: > > Finn, > > > This looks wrong to me. I think you've just prevented all START STOP > > commands sent to logical volumes from reaching > > > > return ((*ha->func.issue) (ha, scb)); > > > > I think a better patch is to add a "fall though" c

Re: [PATCH] scsi: ips: fix missing break in switch

2018-10-16 Thread Finn Thain
On Tue, 16 Oct 2018, Martin K. Petersen wrote: > > Gustavo, > > > Add missing break statement in order to prevent the code from falling > > through to case TEST_UNIT_READY. > > Applied to 4.20/scsi-queue, thanks! > > This looks wrong to me. I think you've just prevented all START STOP comma

[PATCH v3 0/6] mac_esp, zorro_esp, esp_scsi: Various improvements

2018-10-15 Thread Finn Thain
This series has fixes and cleanup for mac_esp, zorro_esp and the core esp_scsi driver. These improvements include elimination of duplicated code temporarily introduced for zorro_esp. Finn Thain (6): zorro_esp: Limit DMA transfers to 65535 bytes esp_scsi: Track residual for PIO transfers

[PATCH v3 1/6] zorro_esp: Limit DMA transfers to 65535 bytes

2018-10-15 Thread Finn Thain
scsi: zorro_esp: New driver for Amiga Zorro NCR53C9x boards") Signed-off-by: Finn Thain Cc: Michael Schmitz Tested-by: Michael Schmitz Reviewed-by: Michael Schmitz --- drivers/scsi/zorro_esp.c | 8 +--- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/scsi/z

[PATCH v3 5/6] esp_scsi: De-duplicate PIO routines

2018-10-15 Thread Finn Thain
m68k writesb() implementation is a separate patch. Tested-by: Stan Johnson Signed-off-by: Finn Thain Tested-by: Michael Schmitz --- Changed since v1: - Use shost_printk() instead of pr_err(). - Add new symbol CONFIG_SCSI_ESP_PIO to Kconfig. Changed since v2: - Omit "default n" fro

[PATCH v3 3/6] esp_scsi: Grant disconnect privilege for untagged commands

2018-10-15 Thread Finn Thain
27;lp' check. The mid-layer invokes .slave_alloc and .slave_destroy in such a way that we may rely on scmd->device->hostdata for as long as scmd belongs to the low-level driver. Tested-by: Stan Johnson Signed-off-by: Finn Thain Tested-by: Michael Schmitz --- Changed since v2: - Dr

[PATCH v3 2/6] esp_scsi: Track residual for PIO transfers

2018-10-15 Thread Finn Thain
d-by: Stan Johnson Signed-off-by: Finn Thain Tested-by: Michael Schmitz --- Changed since v2: - Declare send_cmd_residual as u32 instead of int. --- drivers/scsi/esp_scsi.c | 1 + drivers/scsi/esp_scsi.h | 2 ++ drivers/scsi/mac_esp.c | 2 ++ 3 files changed, 5 insertions(+) diff --git a/dr

[PATCH v3 6/6] esp_scsi: Optimize PIO loops

2018-10-15 Thread Finn Thain
. Tested-by: Stan Johnson Signed-off-by: Finn Thain Tested-by: Michael Schmitz --- Changed since v1: - Don't touch the scsi_esp_cmd(esp, ESP_CMD_FLUSH) as it's outside the loop. --- drivers/scsi/esp_scsi.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git

[PATCH v3 4/6] esp_scsi: Eliminate ESP_FLAG_DOING_SLOWCMD

2018-10-15 Thread Finn Thain
is better to use the terminology from the datasheets. The global ESP_FLAG_DOING_SLOWCMD flag is redundant anyway, as it can be inferred from esp->select_state. Remove the ESP_FLAG_DOING_SLOWCMD cruft and just use a boolean local variable. Tested-by: Stan Johnson Signed-off-by: Finn Thain Tes

Re: [PATCH v2 5/6] esp_scsi: De-duplicate PIO routines

2018-10-15 Thread Finn Thain
On Mon, 15 Oct 2018, Hannes Reinecke wrote: > > However, the function declaration really is a worry, as the actual function > body only exists when the config option is enabled. > So either add a dummy function or surround the function declaration by > CONFIG_ESP_PIO. > Otherwise I think Dan Carp

Re: [PATCH v2 5/6] esp_scsi: De-duplicate PIO routines

2018-10-15 Thread Finn Thain
On Mon, 15 Oct 2018, Hannes Reinecke wrote: > > > > In the case of send_cmd_residual, that would mean a second #ifdef > > added to esp_data_bytes_sent() where it gets used. I'm happy to comply > > but I fear that all these #ifdefs may harm readability... > > > > There are already other variabl

Re: [PATCH v2 5/6] esp_scsi: De-duplicate PIO routines

2018-10-14 Thread Finn Thain
On Mon, 15 Oct 2018, Hannes Reinecke wrote: > On 10/14/18 8:12 AM, Finn Thain wrote: > > As a temporary measure, the code to implement PIO transfers was > > duplicated in zorro_esp and mac_esp. Now that it has stabilized > > move the common code into the core driver but

Re: [PATCH 5/6] esp_scsi: De-duplicate PIO routines

2018-10-14 Thread Finn Thain
On Mon, 15 Oct 2018, Hannes Reinecke wrote: > On 10/13/18 2:51 AM, Finn Thain wrote: > > As a temporary measure, the code to implement PIO transfers was > > duplicated in zorro_esp and mac_esp. Now that this code has stabilized, > > move it into the core driver to elim

Re: [PATCH v2 3/6] esp_scsi: Grant disconnect privilege for untagged commands

2018-10-14 Thread Finn Thain
On Mon, 15 Oct 2018, Finn Thain wrote: > On Sun, 14 Oct 2018, Christoph Hellwig wrote: > > > > + *p++ = IDENTIFY(lp && (tp->flags & ESP_TGT_DISCONNECT), lun); > > > > I think lp should always be non-NULL here. > > > > It's not clea

Re: [PATCH v2 5/6] esp_scsi: De-duplicate PIO routines

2018-10-14 Thread Finn Thain
On Sun, 14 Oct 2018, Geert Uytterhoeven wrote: > > > --- a/drivers/scsi/Kconfig > > +++ b/drivers/scsi/Kconfig > > @@ -42,6 +42,10 @@ config SCSI_DMA > > bool > > default n > > > > +config SCSI_ESP_PIO > > + bool > > + default n > > "default n" is the default, so plea

Re: [PATCH v2 3/6] esp_scsi: Grant disconnect privilege for untagged commands

2018-10-14 Thread Finn Thain
On Sun, 14 Oct 2018, Christoph Hellwig wrote: > > + *p++ = IDENTIFY(lp && (tp->flags & ESP_TGT_DISCONNECT), lun); > > I think lp should always be non-NULL here. > It's not clear from Documentation/scsi/scsi_mid_low_api.txt, but I guess that's true for scanning of targets. Is it true in gene

Re: [PATCH v2 3/6] esp_scsi: Grant disconnect privilege for untagged commands

2018-10-14 Thread Finn Thain
On Mon, 15 Oct 2018, Michael Schmitz wrote: > > Do we really need to make that distinction? > esp_reconnect() dereferences lp, so !lp has to inhibit disconnection. At least, that's my reading. I can't see any other reason for the lp conditional. --

Re: [PATCH v2 2/6] esp_scsi: Track residual for PIO transfers

2018-10-14 Thread Finn Thain
On Sun, 14 Oct 2018, Geert Uytterhoeven wrote: > > > Fixes: 6fe07aaffbf0 > > Fixes: 6fe07aaffbf0 ("[SCSI] m68k: new mac_esp scsi driver") > Fixed. > > Tested-by: Stan Johnson > > Signed-off-by: Finn Thain > > Tested-by: Michael Schmitz

Re: [PATCH v2 1/6] zorro_esp: Limit DMA transfers to 65535 bytes

2018-10-14 Thread Finn Thain
'Fixes: %h ("%s")' -s' > > BTW, if you use vim, add > > noremap ;gs "zyiw:exe "new \| setlocal buftype=nofile > bufhidden=hide noswapfile syntax=git \| 0r ! git show ".@z."" \| > :0 > > to .vimrc, and type ";gs" when the

[PATCH v2 4/6] esp_scsi: Eliminate ESP_FLAG_DOING_SLOWCMD

2018-10-13 Thread Finn Thain
is better to use the terminology from the datasheets. The global ESP_FLAG_DOING_SLOWCMD flag is redundant anyway, as it can be inferred from esp->select_state. Remove the ESP_FLAG_DOING_SLOWCMD cruft and just use a boolean local variable. Tested-by: Stan Johnson Signed-off-by: Finn Thain Tes

[PATCH v2 0/6] mac_esp, zorro_esp, esp_scsi: Various improvements

2018-10-13 Thread Finn Thain
This series has fixes and cleanup for mac_esp, zorro_esp and the core esp_scsi driver. These improvements include elimination of duplicated code temporarily introduced for zorro_esp. Finn Thain (6): zorro_esp: Limit DMA transfers to 65535 bytes esp_scsi: Track residual for PIO transfers

[PATCH v2 3/6] esp_scsi: Grant disconnect privilege for untagged commands

2018-10-13 Thread Finn Thain
-off-by: Finn Thain Tested-by: Michael Schmitz --- drivers/scsi/esp_scsi.c | 8 ++-- 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/scsi/esp_scsi.c b/drivers/scsi/esp_scsi.c index 9e5d3f7d29ae..b7c41aa9927c 100644 --- a/drivers/scsi/esp_scsi.c +++ b/drivers/scsi

[PATCH v2 1/6] zorro_esp: Limit DMA transfers to 65535 bytes

2018-10-13 Thread Finn Thain
The core driver, esp_scsi, does not use the ESP_CONFIG2_FENAB bit, so the chip's Transfer Counter register is only 16 bits wide (not 24). A larger transfer cannot work and will theoretically result in a failed command and a "DMA length is zero" error. Fixes: 3109e5ae0311 Signed-off

[PATCH v2 2/6] esp_scsi: Track residual for PIO transfers

2018-10-13 Thread Finn Thain
residual calculation relies on the Transfer Count registers which works for DMA transfers but not for PIO transfers. Fix the problem by storing the PIO transfer residual and using that to correctly calculate bytes_sent. Fixes: 6fe07aaffbf0 Tested-by: Stan Johnson Signed-off-by: Finn Thain Tested

[PATCH v2 6/6] esp_scsi: Optimize PIO loops

2018-10-13 Thread Finn Thain
with LTO). Tested-by: Stan Johnson Signed-off-by: Finn Thain Tested-by: Michael Schmitz --- Changed since v1: - Don't touch the scsi_esp_cmd(esp, ESP_CMD_FLUSH) that's outside the loop. --- drivers/scsi/esp_scsi.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) di

[PATCH v2 5/6] esp_scsi: De-duplicate PIO routines

2018-10-13 Thread Finn Thain
m68k writesb() implementation is a separate patch. Tested-by: Stan Johnson Signed-off-by: Finn Thain Tested-by: Michael Schmitz --- Changed since v1: - Use shost_printk() instead of pr_err(). - Add new symbol CONFIG_SCSI_ESP_PIO to Kconfig. --- drivers/scsi/Kconfig | 6 + drivers

Re: various esp_scsi cleanups V3

2018-10-13 Thread Finn Thain
he pointless union in struct esp_cmd_priv > > Changes since v1: > - fix a sun_esp compiler failure in an intermediate patch > - drop the dev argument to scsi_esp_register > Tested-by: Finn Thain Thanks. --

Re: [PATCH 5/6] esp_scsi: De-duplicate PIO routines

2018-10-13 Thread Finn Thain
On Sat, 13 Oct 2018, Christoph Hellwig wrote: > > +#if IS_ENABLED(CONFIG_SCSI_MAC_ESP) || IS_ENABLED(CONFIG_SCSI_ZORRO_ESP) > > Please add a new CONFIG_SCSI_ESP_PIO symbol that is selected by > the mac and zorro drivers instead. > OK. > > + pr_err("FIFO is empty (sreg %02x)\n", esp_read8(ESP

Re: [PATCH 5/5] esp_scsi: move dma mapping into the core code

2018-10-13 Thread Finn Thain
On Sat, 13 Oct 2018, Christoph Hellwig wrote: > On Sat, Oct 13, 2018 at 09:24:51AM +1100, Finn Thain wrote: > > > struct scatterlist *sg = scsi_sglist(cmd); > > > - int dir = cmd->sc_data_direction; > > > - int total, i; > > > + int total =

Re: [PATCH 6/6] esp_scsi: Optimize PIO loops

2018-10-12 Thread Finn Thain
On Sat, 13 Oct 2018, Michael Schmitz wrote: > Hi Finn, > > Am 13.10.2018 um 13:51 schrieb Finn Thain: > > Avoid function calls in the inner PIO loops. On a Centris 660av this > > improves throughput for sequential read transfers by about 40% and > > s

[PATCH 1/6] zorro_esp: Limit DMA transfers to 65535 bytes

2018-10-12 Thread Finn Thain
The core driver, esp_scsi, does not use the ESP_CONFIG2_FENAB bit, so the chip's Transfer Counter register is only 16 bits wide (not 24). A larger transfer cannot work and will theoretically result in a failed command and a "DMA length is zero" error. Fixes: 3109e5ae0311 Signed-off

[PATCH 4/6] esp_scsi: Eliminate ESP_FLAG_DOING_SLOWCMD

2018-10-12 Thread Finn Thain
is better to use the terminology from the datasheets. The global ESP_FLAG_DOING_SLOWCMD flag is redundant anyway, as it can be inferred from esp->select_state. Remove the ESP_FLAG_DOING_SLOWCMD cruft and just use a boolean local variable. Tested-by: Stan Johnson Signed-off-by: Finn Thain --- drive

[PATCH 2/6] esp_scsi: Track residual for PIO transfers

2018-10-12 Thread Finn Thain
residual calculation relies on the Transfer Count registers which works for DMA transfers but not for PIO transfers. Fix the problem by storing the PIO transfer residual and using that to correctly calculate bytes_sent. Fixes: 6fe07aaffbf0 Tested-by: Stan Johnson Signed-off-by: Finn Thain

[PATCH 6/6] esp_scsi: Optimize PIO loops

2018-10-12 Thread Finn Thain
with LTO). Tested-by: Stan Johnson Signed-off-by: Finn Thain --- drivers/scsi/esp_scsi.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/scsi/esp_scsi.c b/drivers/scsi/esp_scsi.c index 646701fc22a4..9f0e68cd0e99 100644 --- a/drivers/scsi/esp_scsi.c +++ b

[PATCH 3/6] esp_scsi: Grant disconnect privilege for untagged commands

2018-10-12 Thread Finn Thain
-off-by: Finn Thain --- drivers/scsi/esp_scsi.c | 8 ++-- 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/scsi/esp_scsi.c b/drivers/scsi/esp_scsi.c index 9e5d3f7d29ae..b7c41aa9927c 100644 --- a/drivers/scsi/esp_scsi.c +++ b/drivers/scsi/esp_scsi.c @@ -800,13 +800,9

[PATCH 5/6] esp_scsi: De-duplicate PIO routines

2018-10-12 Thread Finn Thain
() implementation is a separate patch. Tested-by: Stan Johnson Signed-off-by: Finn Thain --- drivers/scsi/esp_scsi.c | 126 + drivers/scsi/esp_scsi.h | 5 + drivers/scsi/mac_esp.c | 173 ++- drivers/scsi/zorro_esp.c | 232

[PATCH 0/6] mac_esp, zorro_esp, esp_scsi: Various improvements

2018-10-12 Thread Finn Thain
with this code. Finn Thain (6): zorro_esp: Limit DMA transfers to 65535 bytes esp_scsi: Track residual for PIO transfers esp_scsi: Grant disconnect privilege for untagged commands esp_scsi: Eliminate ESP_FLAG_DOING_SLOWCMD esp_scsi: De-duplicate PIO routines esp_scsi: Optimize PIO

Re: [PATCH 3/5] esp_scsi: use strong typing for the dev field

2018-10-12 Thread Finn Thain
> On Fri, 12 Oct 2018, Christoph Hellwig wrote: > > > > > > diff --git a/drivers/scsi/mac_esp.c b/drivers/scsi/mac_esp.c > > > index eb551f3cc471..85d067889a9b 100644 > > > --- a/drivers/scsi/mac_esp.c > > > +++ b/drivers/scsi/mac_esp.c > > > @@ -58,8 +58,7 @@ static struct esp *esp_chips[2]; > >

Re: [PATCH 5/5] esp_scsi: move dma mapping into the core code

2018-10-12 Thread Finn Thain
On Thu, 11 Oct 2018, Christoph Hellwig wrote: > diff --git a/drivers/scsi/esp_scsi.c b/drivers/scsi/esp_scsi.c > index 90604bff8dd2..73fcbd65b9fe 100644 > --- a/drivers/scsi/esp_scsi.c > +++ b/drivers/scsi/esp_scsi.c > @@ -369,19 +369,25 @@ static void esp_map_dma(struct esp *esp, struct > scsi_c

Re: [PATCH 3/5] esp_scsi: use strong typing for the dev field

2018-10-11 Thread Finn Thain
On Thu, 11 Oct 2018, Christoph Hellwig wrote: > esp->dev is a void pointer that points either to a struct device, or a > struct platform_device. As we can easily get from the device to the > platform_device if needed change it to always point to a struct device > and properly type the pointer to

Re: [PATCH 5/5] esp_scsi: move dma mapping into the core code

2018-10-11 Thread Finn Thain
On Thu, 11 Oct 2018, Christoph Hellwig wrote: > index 90604bff8dd2..73fcbd65b9fe 100644 > --- a/drivers/scsi/esp_scsi.c > +++ b/drivers/scsi/esp_scsi.c > @@ -369,19 +369,25 @@ static void esp_map_dma(struct esp *esp, struct > scsi_cmnd *cmd) > { > struct esp_cmd_priv *spriv = ESP_CMD_PRIV(

Re: [PATCH 3/4] esp_scsi: use strong typing for the dev field

2018-10-10 Thread Finn Thain
On Wed, 10 Oct 2018, Christoph Hellwig wrote: > esp->dev is a void pointer that points either to a struct device, or a > struct platform_device. As we can easily get from the device to the > platform_device if needed change it to always point to a struct device > and properly type the pointer to

[PATCH 03/10] NCR5380: Have NCR5380_select() return a bool

2018-09-26 Thread Finn Thain
The return value is taken to mean "retry" or "don't retry". Change it to bool to improve readability. Fix related comments. No functional change. Tested-by: Michael Schmitz Signed-off-by: Finn Thain --- drivers/scsi/NCR5380.c | 46 +--

[PATCH 05/10] NCR5380: Use DRIVER_SENSE to indicate valid sense data

2018-09-26 Thread Finn Thain
When sense data is valid, call set_driver_byte(cmd, DRIVER_SENSE). Otherwise some callers of scsi_execute() will ignore sense data. Don't set DID_ERROR or DID_RESET just because sense data is missing. Tested-by: Michael Schmitz Signed-off-by: Finn Thain --- drivers/scsi/NCR5380.

[PATCH 00/10] NCR5380: Various improvements

2018-09-26 Thread Finn Thain
EH. The patch by Hannes Reinecke was cherry-picked from his 'eh-reset.v5' branch. Finn Thain (9): NCR5380: Reduce goto statements in NCR5380_select() NCR5380: Have NCR5380_select() return a bool NCR5380: Withhold disconnect privilege for REQUEST SENSE NCR5380: Use DRIVER_SENSE t

[PATCH 09/10] NCR5380: Handle BUS FREE during reselection

2018-09-26 Thread Finn Thain
s wait for the target to try again. Tested-by: Michael Schmitz Signed-off-by: Finn Thain --- drivers/scsi/NCR5380.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/scsi/NCR5380.c b/drivers/scsi/NCR5380.c index 419033643015..b9a3eb0647e4 100644 --- a/drivers/scsi/NCR5380.c +++ b/dr

[PATCH 08/10] NCR5380: Don't call dsprintk() following reselection interrupt

2018-09-26 Thread Finn Thain
dure. The selection abort time is only 200 us which may be insufficient time for a printk() call. Move the diagnostics to the error paths. Tested-by: Michael Schmitz Signed-off-by: Finn Thain --- drivers/scsi/NCR5380.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dr

[PATCH 10/10] NCR5380: Check for bus reset

2018-09-26 Thread Finn Thain
ned-off-by: Finn Thain --- drivers/scsi/NCR5380.c | 74 ++ 1 file changed, 45 insertions(+), 29 deletions(-) diff --git a/drivers/scsi/NCR5380.c b/drivers/scsi/NCR5380.c index b9a3eb0647e4..8429c855701f 100644 --- a/drivers/scsi/NCR5380.c +++ b/dr

[PATCH 06/10] NCR5380: Check for invalid reselection target

2018-09-26 Thread Finn Thain
hael Schmitz Signed-off-by: Finn Thain --- drivers/scsi/NCR5380.c | 5 + 1 file changed, 5 insertions(+) diff --git a/drivers/scsi/NCR5380.c b/drivers/scsi/NCR5380.c index e96a48b9e86c..3058b68b6740 100644 --- a/drivers/scsi/NCR5380.c +++ b/drivers/scsi/NCR5380.c @@ -2016,6 +2016,11 @@ static v

[PATCH 02/10] NCR5380: Reduce goto statements in NCR5380_select()

2018-09-26 Thread Finn Thain
Replace a 'goto' statement with a simple 'return' where possible. This improves readability. No functional change. Tested-by: Michael Schmitz Signed-off-by: Finn Thain --- drivers/scsi/NCR5380.c | 21 - 1 file changed, 12 insertions(+), 9 deletions(-)

[PATCH 07/10] NCR5380: Don't clear busy flag when abort fails

2018-09-26 Thread Finn Thain
g set when NCR5380_abort() fails. Tested-by: Michael Schmitz Signed-off-by: Finn Thain --- Consistent with the rest of NCR5380.c, this patch triggers some "line over 80 characters" messages from checkpatch.pl. I haven't addressed those complaints because IMHO the cure is worse than the disea

  1   2   3   4   5   6   7   8   9   10   >