From: Paolo Bonzini <pbonzini@redhat.com>
To: George Kennedy <george.kennedy@oracle.com>,
famz@redhat.com, qemu-devel@nongnu.org,
boris.ostrovsky@oracle.com
Subject: Re: [Qemu-devel] [PATCH v3] lsi_scsi: Reselection needed to remove pending commands from queue
Date: Wed, 31 Oct 2018 12:42:23 +0100 [thread overview]
Message-ID: <b2afd96c-a7f7-9e7b-d756-997f6ebd3bc8@redhat.com> (raw)
In-Reply-To: <fb9cafab-8a35-2220-4c60-b74d247bb649@oracle.com>
On 31/10/2018 12:29, George Kennedy wrote:
>>> case 2: /* Wait Reselect */
>>> + if (!s->resel_dsp) {
>>> + s->resel_dsp = s->dsp - 8;
>>> + }
>>
>> What is the reason for the "if"?
>
> The save of the Rselection Script address only needs to be done once
That's not correct. There could be more than one WAIT RESELECT instruction.
(I'm also not sure why the "- 8", which causes the WAIT RESELECT opcode
to run again. I think that, instead of that "- 8", you're missing a
call to lsi_wait_reselect where you set s->dsp = s->resel_dsp. It makes
sense: after disconnecting from one target, you immediately fake a
reselect from the target. This isn't quite right, the reselection
should be in lsi_transfer_data, but it's a start).
>>> if (!lsi_irq_on_rsl(s)) {
>>> + if (save_dsp) {
>>> + s->dsp = save_dsp;
>>> + save_dsp = 0;
>>> + }
>>> lsi_wait_reselect(s);
>>> }
>>> break;
>>> @@ -1476,6 +1501,10 @@ again:
>>> if (insn & (1 << 28)) {
>>> addr = s->dsa + sextract32(addr, 0, 24);
>>> + } else if (s->want_resel && s->resel_dsp && !(insn & (1
>>> << 24))) {
>>> + save_dsp = s->dsp;
>>> + s->dsp = s->resel_dsp;
>>> + s->want_resel = false;
>>> }
>> Can you explain why this is placed under the LOAD AND STORE instruction?
>>
>> Your previous patch has, more specifically, a store from the scratch
>> register into memory. In the Linux scripts this occurs twice, both
>> after a DISCONNECT instruction. Is that the place where you want to
>> hook?
>
> Yes. I can revert to what was in the previous patch. I had figured that,
> like the change to capture the Reselection Script address, the point
> where the DSP address gets loaded with the Script Reselection address
> could be handled in a similar manner.
There is only one correct way to handle SCRIPTS instructions, and it's
the one that matches the data sheet. In other words, even if we agree
to an incomplete solution it still must have some foundation in the
datasheet and parallel SCSI spec. We have to adjust for the coalescing
of initiator/target/scripts that occurs in lsi53c895a.c, but that should
be it.
In particular, the reselection script is captured in WAIT RESELECT
because the data sheet says so:
If the LSI53C895A is reselected, it fetches the next
instruction from the address pointed to by the DMA
SCRIPTS Pointer (DSP) register.
but LOAD AND STORE has nothing to do with reselection.
Paolo
prev parent reply other threads:[~2018-10-31 11:42 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-30 21:42 [Qemu-devel] [PATCH v3] lsi_scsi: Reselection needed to remove pending commands from queue George Kennedy
2018-10-31 9:21 ` Paolo Bonzini
2018-10-31 11:29 ` George Kennedy
2018-10-31 11:42 ` Paolo Bonzini [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b2afd96c-a7f7-9e7b-d756-997f6ebd3bc8@redhat.com \
--to=pbonzini@redhat.com \
--cc=boris.ostrovsky@oracle.com \
--cc=famz@redhat.com \
--cc=george.kennedy@oracle.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).