qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alexey Kardashevskiy <aik@ozlabs.ru>
To: "Gonglei (Arei)" <arei.gonglei@huawei.com>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Cc: Michael Roth <mdroth@linux.vnet.ibm.com>,
	Tyrel Datwyler <tyreld@linux.vnet.ibm.com>,
	"kraxel@redhat.com" <kraxel@redhat.com>
Subject: Re: [Qemu-devel] USB PCI host bus adapter hot plug
Date: Wed, 13 Aug 2014 16:02:04 +1000	[thread overview]
Message-ID: <53EAFF5C.3030608@ozlabs.ru> (raw)
In-Reply-To: <33183CC9F5247A488A2544077AF1902086C302E0@SZXEMA503-MBS.china.huawei.com>

On 08/13/2014 03:00 PM, Gonglei (Arei) wrote:
>>>>> I noticed that QMP's "device_add usb-ehci,id=i2,bus=pci.0" fails on PCI
>>>>> hotplug. The same for pci-ohci and this is because their initfn() do
>>>>> "dc->hotpluggable   = false". So I removed those and now I can hotplug
>> USB
>>>>> hosts but none of them is able to actually work:
>>>>>
>>>>> root@aiktest-le:~# echo 1 >/sys/bus/pci/rescan
>>>>> [   41.143062] ohci-pci 0000:00:01.0: init err (c8700000 0000)
>>>>> [   41.143133] ohci-pci 0000:00:01.0: can't start
>>>>> [   41.143227] ohci-pci 0000:00:01.0: startup error -75
>>>>> [   41.144202] ohci-pci 0000:00:01.0: init 0000:00:01.0 fail, -75
>>>>>
>>>>>
>>>>> root@aiktest-le:~# echo 1 >/sys/bus/pci/rescan
>>>>> [   43.691067] ehci-pci 0000:00:01.0: can't setup: -110
>>>>> [   43.692424] ehci-pci 0000:00:01.0: init 0000:00:01.0 fail, -110
>>>>>
>>>>>
>>>>> Why is that? Is QEMU just missing some bits or there is some fundamental
>>>>> issue which I just do not see? Thanks!
>>>>>
>>>> Cc'ing Gerd.
>>>>
>>>> Actually I have post a patch serials for supporting usb host adapter
>> hotplugging,
>>>> Which has been involved in Gerd's (the USB mantainer) usb-next tree. Please
>> see:
>>>> https://www.kraxel.org/cgit/qemu/log/?h=rebase/usb-next
>>>>
>>>> The function of usb host adapter hotplugging is ok. You are welcome to test
>> it.
>>>
>>> It does not work for me though. The device appears in the system but the
>>> driver fails to bring it up:
>>>
>>> [root@localhost ~]# echo 1 >/sys/bus/pci/rescan
>>>
>>> [   43.482378] pci 0000:00:01.0: BAR 0: assigned [mem
>>> 0x100a0000000-0x100a0000fff]
>>> [   43.488851] ehci-pci 0000:00:01.0: EHCI Host Controller
>>>
>>> [   43.490153] ehci-pci 0000:00:01.0: new USB bus registered, assigned bus
>>> number 1
>>> [   43.504957] ehci-pci 0000:00:01.0: can't setup: -110
>>>
>>> [   43.505028] ehci-pci 0000:00:01.0: USB bus 1 deregistered
>>>
>>> [   43.507660] ehci-pci 0000:00:01.0: init 0000:00:01.0 fail, -110
>>>
>>> [   43.507808] ehci-pci: probe of 0000:00:01.0 failed with error -110
>>>
>>>
>>>
>>>> BTW, What's your guest os type?
>>>
>>> Fedora20/ppc64 or Ubuntu14/ppc64le.
>>>
>>> I tried your tree merged with
>>> https://github.com/mdroth/qemu/tree/spapr-pci-hotplug-ppc-next-cleanup2
>>>
>>> I am adding PCIhotplug-on-PPC experts to the thread, may be they have
>> ideas...
>>
>>
>> More precise - this fails:
>>
>> drivers/usb/host/ehci-hcd.c:
>>
>> int ehci_handshake(struct ehci_hcd *ehci, void __iomem *ptr,
>>                    u32 mask, u32 done, int usec)
>> {
>>         u32     result;
>>
>>         do {
>>                 result = ehci_readl(ehci, ptr);
>>                 if (result == ~(u32)0)          /* card removed */
>>                         return -ENODEV;
>>                 result &= mask;
>>                 if (result == done)
>>                         return 0;
>>                 udelay (1);
>>                 usec--;
>>         } while (usec > 0);
>>         return -ETIMEDOUT; // <------------------
>> }
>>
>> --
>> Alexey
> 
> Hi, Alexey. 
> 
> Does this work when you configure 
> EHCI at the command line, not hotplugging?

Yes, all possible USB hosts work just fine when added in the command line.


> BTW, I'm not familiar with PCIhotplug-on-PPC. Sorry for this.

I doubt this is because of PPC but there is always a chance :)


-- 
Alexey

  reply	other threads:[~2014-08-13  6:02 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-11  4:02 [Qemu-devel] USB PCI host bus adapter hot plug Alexey Kardashevskiy
2014-08-11  5:59 ` Gonglei (Arei)
2014-08-12  6:05   ` Alexey Kardashevskiy
2014-08-13  4:52     ` Alexey Kardashevskiy
2014-08-13  5:00       ` Gonglei (Arei)
2014-08-13  6:02         ` Alexey Kardashevskiy [this message]
2014-08-28  8:24   ` Gerd Hoffmann
2014-08-28  8:31     ` Gonglei (Arei)
2014-08-28  8:35       ` Gerd Hoffmann
2014-08-29  3:23         ` Gonglei (Arei)

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=53EAFF5C.3030608@ozlabs.ru \
    --to=aik@ozlabs.ru \
    --cc=arei.gonglei@huawei.com \
    --cc=kraxel@redhat.com \
    --cc=mdroth@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=tyreld@linux.vnet.ibm.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).