qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: John Snow <jsnow@redhat.com>
To: Stefan Hajnoczi <stefanha@redhat.com>
Cc: pbonzini@redhat.com, hare@suse.de, qemu-block@nongnu.org,
	qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 2/2] ahci: fix signature generation
Date: Wed, 08 Jul 2015 11:18:03 -0400	[thread overview]
Message-ID: <559D3F2B.7030901@redhat.com> (raw)
In-Reply-To: <20150708125603.GB20502@stefanha-thinkpad.redhat.com>



On 07/08/2015 08:56 AM, Stefan Hajnoczi wrote:
> On Tue, Jul 07, 2015 at 01:15:02PM -0400, John Snow wrote:
>>
>>
>> On 07/07/2015 04:49 AM, Stefan Hajnoczi wrote:
>>> On Mon, Jul 06, 2015 at 05:49:52PM -0400, John Snow wrote:
>>>> The initial register device-to-host FIS no longer needs to specially
>>>> set certain fields, as these can be handled generically by setting those
>>>> fields explicitly with the signatures we want at port reset time.
>>>>
>>>> (1) Signatures are decomposed into their four component registers and
>>>>     set upon (AHCI) port reset.
>>>> (2) the signature cache register is no longer set manually per-each
>>>>     device type, but instead just once during ahci_init_d2h.
>>>>
>>>> Signed-off-by: John Snow <jsnow@redhat.com>
>>>> ---
>>>>  hw/ide/ahci.c | 33 ++++++++++++++++++++-------------
>>>>  1 file changed, 20 insertions(+), 13 deletions(-)
>>>
>>> I see two code paths that call ahci_init_d2h().  Either
>>> ahci_reset_port() does it (if a block device is attached) or it's called
>>> when the guest writes to the PORT_CMD register.
>>>
>>> I'm not sure the latter works.  The signature doesn't seem to be set
>>> anywhere.
>>>
>>> Any ideas?
> ...
>> So on initial boot, we call ahci_init_d2h and set pr->sig, then call
>> ahci_write_fis_d2h. However, since the FIS RX engine (PxFRE) is off, we
>> don't actually generate the FIS because there's nowhere to store it.
> 
> My question is about the ide_state->blk == NULL case:
> 
> ahci_reset_port() is contradictory:
> 
> static void ahci_reset_port(AHCIState *s, int port)
> {
>     ...
>     ide_state = &s->dev[port].port.ifs[0];
>     if (!ide_state->blk) {
>         return;
>     }
> 
>     ...
> 
>     s->dev[port].port_state = STATE_RUN;
>     if (!ide_state->blk) { <-- deadcode?
>         pr->sig = 0;
>         ide_state->status = SEEK_STAT | WRERR_STAT;
>     }
> 
> Does code after the first "if (!ide_state->blk)" in ahci_reset_port()
> ever execute in a drive hotplug scenario?
> 
> If it doesn't execute then sig is never filled in.
> 
> Your patch does not include a regression but either something is broken
> here or I don't understand the code.
> 

I'm sorry, I misunderstood you...

Haven't really played with the hotplugging much so I don't know it to
work. I'll throw it on the list.

Actually, since I need to start focusing on non-legacy devices, I'll
start a wiki page of all the bugs and quirks I know about and that way
if I forget to get back to it (or my plane disappears over the Bermuda
Triangle) my understanding of existing problems will be documented.

I'll stage patch #1 here (Reviewed by Kevin) for inclusion in 2.4, #2 is
also a bug fix but it's more subtle and isn't known to break anything
and could possibly benefit from a more comprehensive fix so I'll leave
it for now.

Thanks,
--js

      reply	other threads:[~2015-07-08 15:18 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-06 21:49 [Qemu-devel] [PATCH 0/2] ahci: Fix CD-ROM signature John Snow
2015-07-06 21:49 ` [Qemu-devel] [PATCH 1/2] " John Snow
2015-07-07 17:19   ` John Snow
2015-07-08  9:26     ` [Qemu-devel] [Qemu-block] " Kevin Wolf
2015-07-06 21:49 ` [Qemu-devel] [PATCH 2/2] ahci: fix signature generation John Snow
2015-07-07  8:49   ` Stefan Hajnoczi
2015-07-07 17:15     ` John Snow
2015-07-08 12:56       ` Stefan Hajnoczi
2015-07-08 15:18         ` John Snow [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=559D3F2B.7030901@redhat.com \
    --to=jsnow@redhat.com \
    --cc=hare@suse.de \
    --cc=pbonzini@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /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).