On 22/10/2018 23:28, George Kennedy wrote: > As you suggested I moved the loading of "s->resel_dsp" down to the "Wait > Reselect" > case. The address of the Reselection Scripts, though, is contained in "s->dsp > - 8" > and not in s->dnad.
Are you sure? s->dsp - 8 should be the address of the Wait Reselect instruction itself. But you're right that s->dnad is the address at which to jump "if the LSI53C895A is selected before being reselected" (as the spec puts it) so the reselection DSP should be just s->dsp. > The reason the timeout is needed is that under heavy IO some pending commands > stay on the pending queue longer than the 30 second command timeout set by the > linux upper layer scsi driver (sym53c8xx). When command timeouts occur, the > upper layer scsi driver sends SCSI Abort messages to remove the timed out > commands. The command timeouts are caused by the fact that under heavy IO, > lsi_reselect() in qemu "hw/scsi/lsi53c895a.c" is not being called before the > upper layer scsi driver 30 second command timeout goes off. > > If lsi_reselect() were called more frequently, the command timeout problem > would > probably not occur. There are a number of places where lsi_reselect() is > supposed > to get called (e.g. at the end of lsi_update_irq()), but the only place that I > have observed lsi_reselect() being called is from lsi_execute_script() when > lsi_wait_reselect() is called because of a SCRIPT "Wait Select" IO > Instruction. Reselection should only happen when the target needs access to the bus, which is when I/O has finished. There should be no need for such a deadline; reselection should already be happening at the right time when lsi_transfer_data calls lsi_queue_req, which in turn calls lsi_reselect. Maybe many of the places that call lsi_irq_on_rsl(s) also need to check s->want_resel? Paolo