From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52805) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cA7ub-0001Qm-DL for qemu-devel@nongnu.org; Thu, 24 Nov 2016 23:15:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cA7uW-00011h-Nz for qemu-devel@nongnu.org; Thu, 24 Nov 2016 23:14:57 -0500 Received: from ozlabs.org ([2401:3900:2:1::2]:58849) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cA7uV-0000ui-FF for qemu-devel@nongnu.org; Thu, 24 Nov 2016 23:14:52 -0500 Date: Fri, 25 Nov 2016 15:14:38 +1100 From: David Gibson Message-ID: <20161125041438.GC12287@umbus.fritz.box> References: <20161103213514-mutt-send-email-mst@kernel.org> <20161116164442.wrwbs7cobkiclymp@kamzik.brq.redhat.com> <55156135-9617-906a-e65b-ce948dc22140@redhat.com> <20161118155201.uifhhouuidl2bsha@kamzik.brq.redhat.com> <165c06da-ae03-f855-19c8-a99a8aa13dba@redhat.com> <8aa4a75c-18d6-4793-2e5e-0c6155cb4821@redhat.com> <20161124040635.GB23872@umbus.fritz.box> <9674cba2-0eb1-4b2e-6790-ace056f4640c@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="yLVHuoLXiP9kZBkt" Content-Disposition: inline In-Reply-To: <9674cba2-0eb1-4b2e-6790-ace056f4640c@redhat.com> Subject: Re: [Qemu-devel] [PATCH] hw/pci: disable pci-bridge's shpc by default List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Marcel Apfelbaum Cc: Laurent Vivier , Andrew Jones , qemu-devel@nongnu.org, Gerd Hoffmann , Markus Armbruster , laine@redhat.com, "Michael S. Tsirkin" , Thomas Huth --yLVHuoLXiP9kZBkt Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Nov 24, 2016 at 11:39:25AM +0200, Marcel Apfelbaum wrote: > On 11/24/2016 06:06 AM, David Gibson wrote: > > On Wed, Nov 23, 2016 at 01:08:46PM +0200, Marcel Apfelbaum wrote: > > > On 11/22/2016 10:25 PM, Laurent Vivier wrote: > > > >=20 > > > >=20 > > > > On 22/11/2016 18:26, Marcel Apfelbaum wrote: > > > > > On 11/18/2016 05:52 PM, Andrew Jones wrote: > > > > > > On Wed, Nov 16, 2016 at 07:05:25PM +0200, Marcel Apfelbaum wrot= e: > > > > > > > On 11/16/2016 06:44 PM, Andrew Jones wrote: > > > > > > > > On Sat, Nov 05, 2016 at 06:46:34PM +0200, Marcel Apfelbaum = wrote: > > > > > > > > > On 11/03/2016 09:40 PM, Michael S. Tsirkin wrote: > > > > > > > > > > On Thu, Nov 03, 2016 at 01:05:44PM +0200, Marcel Apfelb= aum wrote: > > > > > > > > > > > On 11/03/2016 06:18 AM, Michael S. Tsirkin wrote: > > > > > > > > > > > > On Wed, Nov 02, 2016 at 05:16:42PM +0200, Marcel Ap= felbaum wrote: > > > > > > > > > > > > > The shpc component is optional while ACPI hotplu= g is used > > > > > > > > > > > > > for hot-plugging PCI devices into a PCI-PCI bridg= e. > > > > > > > > > > > > > Disabling the shpc by default will make slot 0 us= able at boot time > > > > > > > > > > >=20 > > > > > > > > > > > Hi Michael > > > > > > > > > > >=20 > > > > > > > > > > > >=20 > > > > > > > > > > > > at the cost of breaking all hotplug for all non-acp= i users. > > > > > > > > > > > >=20 > > > > > > > > > > >=20 > > > > > > > > > > > Do we have a non-acpi user that is able to use the sh= pc component > > > > > > > > > > > as-is today? > > > > > > > > > >=20 > > > > > > > > > > power and some arm systems I guess? > > > > > > > > > >=20 > > > > > > > > >=20 > > > > > > > > > Adding Andrew , maybe he can give us an answer. > > > > > > > >=20 > > > > > > > > Not really :-) My lack of PCI knowledge makes that difficul= t. I'd be > > > > > > > > happy > > > > > > > > to help with an experiment though. Can you give me command = line > > > > > > > > arguments, > > > > > > > > qmp commands, etc. that I should use to try it out? I imagi= ne I should > > > > > > > > just boot an ARM guest using DT (instead of ACPI) and then = attempt to > > > > > > > > hotplug a PCI device. I'm not sure, however, what, if any, = special > > > > > > > > configuration I need in order to ensure I'm testing what yo= u're > > > > > > > > interested in. > > > > > > > >=20 > > > > > > >=20 > > > > > > > Hi Drew, > > > > > > >=20 > > > > > > >=20 > > > > > > > Just run QEMU with '-device pci-bridge,chassis_nr=3D1,id=3Dbr= idge1 > > > > > > > -monitor stdio' > > > > > > > with an ARM guest using DT and wait until the guest finish bo= oting. > > > > > > >=20 > > > > > > > Then run at hmp: > > > > > > > device_add virtio-net-pci,bus=3Dbridge1,id=3Dnet2 > > > > > > >=20 > > > > > > > Next run lspci in the guest to see the new device. > > > > > >=20 > > > > > > Thanks for the instructions Marcel. Here's the results > > > > > >=20 > > > > > > $QEMU -machine virt,accel=3D$ACCEL -cpu $CPU -nographic -m 409= 6 -smp 8 \ > > > > > > -bios /usr/share/AAVMF/AAVMF_CODE.fd \ > > > > > > -device pci-bridge,chassis_nr=3D1,id=3Dbridge1 \ > > > > > > -drive file=3D$FEDORA_IMG,if=3Dnone,id=3Ddr0,format=3Dqc= ow2 \ > > > > > > -device virtio-blk-pci,bus=3Dbridge1,addr=3D01,drive=3Dd= r0,id=3Ddisk0 \ > > > > > > -netdev user,id=3Dhostnet0 \ > > > > > > -device virtio-net-pci,bus=3Dbridge1,addr=3D02,netdev=3D= hostnet0,id=3Dnet0 > > > > > >=20 > > > > > > # lspci > > > > > > 00:00.0 Host bridge: Red Hat, Inc. Device 0008 > > > > > > 00:01.0 PCI bridge: Red Hat, Inc. QEMU PCI-PCI bridge > > > > > > 01:01.0 SCSI storage controller: Red Hat, Inc Virtio block dev= ice > > > > > > 01:02.0 Ethernet controller: Red Hat, Inc Virtio network device > > > > > >=20 > > > > > > (qemu) device_add virtio-net-pci,bus=3Dbridge1,id=3Dnet2 > > > > > > Unsupported PCI slot 0 for standard hotplug controller. Valid = slots are > > > > > > between 1 and 31. > > > > > >=20 > > > > > > (Tried again giving addr=3D03) > > > > > >=20 > > > > > > (qemu) device_add virtio-net-pci,bus=3Dbridge1,id=3Dnet2,addr= =3D03 > > > > > >=20 > > > > > > (Seemed to work, but...) > > > > > >=20 > > > > > > # lspci > > > > > > 00:00.0 Host bridge: Red Hat, Inc. Device 0008 > > > > > > 00:01.0 PCI bridge: Red Hat, Inc. QEMU PCI-PCI bridge > > > > > > 01:01.0 SCSI storage controller: Red Hat, Inc Virtio block dev= ice > > > > > > 01:02.0 Ethernet controller: Red Hat, Inc Virtio network device > > > > > >=20 > > > > > > (Doesn't show up in lscpi. So I guess it doesn't work) > > > > > >=20 > > > > >=20 > > > > > Hi Drew, > > > > > Thanks for confirming that it doesn't work. > > > > >=20 > > > > > Michael asked if we can check the same for powerpc before > > > > > disabling the shpc by default. > > > > >=20 > > > > > Adding David, Thomas and Laurrent, maybe they have time > > > > > to check it for powerpc. > > > >=20 > > > > With this patch: > > > >=20 > > > > # lspci > > > > 00:00.0 PCI bridge: Red Hat, Inc. QEMU PCI-PCI bridge > > > > 00:03.0 Unclassified device [00ff]: Red Hat, Inc Virtio memory ball= oon > > > > [root@dhcp6-56 ~]# QEMU 2.7.90 monitor - type 'help' for more infor= mation > > > > (qemu) device_add virtio-net-pci,bus=3Dbridge1,id=3Dnet2 > > > > Bus 'bridge1' does not support hotplugging > > > > (qemu) device_add virtio-net-pci,bus=3Dbridge1,id=3Dnet2,addr=3D3 > > > > Bus 'bridge1' does not support hotplugging > > > >=20 > > > > Without this patch: > > > >=20 > > > > # lspci > > > > 00:00.0 PCI bridge: Red Hat, Inc. QEMU PCI-PCI bridge > > > > 00:03.0 Unclassified device [00ff]: Red Hat, Inc Virtio memory ball= oon > > > > [root@dhcp6-56 ~]# QEMU 2.7.90 monitor - type 'help' for more infor= mation > > > > (qemu) device_add virtio-net-pci,bus=3Dbridge1,id=3Dnet2 > > > > Unsupported PCI slot 0 for standard hotplug controller. Valid slots= are > > > > between 1 and 31. > > > > (qemu) device_add virtio-net-pci,bus=3Dbridge1,id=3Dnet2,addr=3D3 > > > > (qemu) [ 37.342908] shpchp 0000:00:00.0: Latch close on Slot(3) > > > > [ 37.342963] shpchp 0000:00:00.0: Button pressed on Slot(3) > > > > [ 37.343003] shpchp 0000:00:00.0: Card present on Slot(3) > > > > [ 37.344186] shpchp 0000:00:00.0: PCI slot #3 - powering on due to > > > > button press > > > > [ 43.361827] shpchp 0000:00:00.0: No new device found > > >=20 > > >=20 > > > Hi Laurrent, > > > Thank you for the fast reply! > > >=20 > > > What I see from the log is that ppc does use the shpc for hotplug, > > > but there is some implementation bug preventing it to work. > >=20 > > That doesn't sound right. ppc, or more correctly the pseries machine > > type, has it's own hotplug notification mechanism. If we're trying to > > invoke shpc, I think something is wrong. > >=20 >=20 > Hi David, >=20 > As you can see the shpc driver claims the pci-bridge slots and it responds > to the hot-plug events. Yeah.. that's a bug of itself. shpc can't work properly on PAPR guests (or even on IBM POWER hardware hosts, for related though not identical reasons). In addition to PAPR having its own hotplug mechanism, the shpc stuff apparently conflicts with the (also POWER specific) EEH error recovery mechanism. > Anyway, what is the hotplug mechanism preferred by the pseries machine ? The PAPR specification which defines the firmware and hypervisor interfaces that guests on POWER operate under, has its own hotplug mechanism, using hypervisor events to deliver updated device tree fragments to the guest. > Side note: what we want to understand is if using pci-bridges's shpc by = default > would help non x86 archs (since QEMU x86 machine uses ACPI based > hot-plug). Certainly not for pseries or powernv. It might be correct for (some?) embedded ppc machines with PCI-E >=20 > Thanks, > Marcel >=20 > > > Drew, may I trouble one last time for the dmesg? > > > I think we would see exactly the same log. > > >=20 > > >=20 > > > Thanks, > > > Marcel > > >=20 > > > > [ 43.361867] shpchp 0000:00:00.0: Cannot add device at 0000:01:03 > > > > [ 43.363277] shpchp 0000:00:00.0: Latch open on Slot(3) > > > > [ 43.363320] shpchp 0000:00:00.0: Button pressed on Slot(3) > > > > [ 43.363360] shpchp 0000:00:00.0: Card not present on Slot(3) > > > > [ 43.363506] shpchp 0000:00:00.0: PCI slot #3 - powering on due to > > > > button press > > > > [ 48.371835] shpchp 0000:00:00.0: No adapter on slot(3) > > > >=20 > > > > Laurent > > > >=20 > > >=20 > >=20 >=20 --=20 David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson --yLVHuoLXiP9kZBkt Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJYN7qtAAoJEGw4ysog2bOSXNIP/AksLQ7fEN+4016K1e53hMXL Y5x6IFoVavsw3JNlsEoHv7vXXElsCy//SaPkn3xYsTp1u7OHCOocj35vepfg+5Q+ IXq8ZG0MpNgUfAxMhLOCj11T/NqTucedHBTdrlszubCBCsQo5IgCpIZ9umSl5BUL y0dd3IzT1BiWN1c3BQzBImK948Ybn0d0fDC6zEiyg9h3kH1XW4a8p01WJzpCC+0D sTvuChprEU1aQqmBT4rYEENMCdWSA621qJYULwGae7VoUMFkWpVuRp9AjVoEjkX1 lkQPX/oIA5r3C34M/kGiGM7nFltauAZ5dGVQ+8CiA/5jD0TKA5j3wC/r3KdrS1S6 /hPNuWNVKEGSznwomLucQsw4puQZfVx/PoJ288/gm4elGibsrxbDg3s9OPslWnjj LP9JBFGYZVXSc9LuqAKT9AsG7B/kjEmRMJsxGIfMpZN55Knq6ZZNbkr9JfdOe7TR QB+sJ1THFYqrlHpz0P3KLuXmT27jE6eO4fb7rGRLduKsF+9B+xRCqyIKOQjB7TVj 6kwaKmPvh8xnum/shSc3n9/bq1qLJZxocfrdsjclXThDJ6+hKYCLpVbqrnxO5p/H sK5HQtch8kGI1QFM/cEfpBibI3nU4XpatYoch4kSbpQBEK2nIDTwSWbqsID7WONh z/LaCA6lPSdL0/YklkiX =i15s -----END PGP SIGNATURE----- --yLVHuoLXiP9kZBkt--