From patchwork Mon Nov 5 10:20:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 10667697 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8DFB713A4 for ; Mon, 5 Nov 2018 10:30:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7C8B32970D for ; Mon, 5 Nov 2018 10:30:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 708AC2972C; Mon, 5 Nov 2018 10:30:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 037362970D for ; Mon, 5 Nov 2018 10:30:40 +0000 (UTC) Received: from localhost ([::1]:34335 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gJc9W-0005ZD-SD for patchwork-qemu-devel@patchwork.kernel.org; Mon, 05 Nov 2018 05:30:38 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53657) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gJc4V-0007Wj-I2 for qemu-devel@nongnu.org; Mon, 05 Nov 2018 05:25:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gJc0Q-0008EQ-Ju for qemu-devel@nongnu.org; Mon, 05 Nov 2018 05:21:20 -0500 Received: from mx1.redhat.com ([209.132.183.28]:29825) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gJc0O-0003Sl-MP; Mon, 05 Nov 2018 05:21:13 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1698630820D1; Mon, 5 Nov 2018 10:20:53 +0000 (UTC) Received: from t460s.redhat.com (ovpn-117-149.ams2.redhat.com [10.36.117.149]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2C91E5D759; Mon, 5 Nov 2018 10:20:45 +0000 (UTC) From: David Hildenbrand To: qemu-devel@nongnu.org Date: Mon, 5 Nov 2018 11:20:34 +0100 Message-Id: <20181105102044.20547-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Mon, 05 Nov 2018 10:20:53 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 00/10] pci: hotplug handler reworks X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eduardo Habkost , "Michael S . Tsirkin" , Cornelia Huck , David Hildenbrand , Alexander Graf , "Dr . David Alan Gilbert" , Christian Borntraeger , qemu-s390x@nongnu.org, qemu-ppc@nongnu.org, Igor Mammedov , Richard Henderson , David Gibson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP This series reworks some pci hotplug handlers (except for s390, that will require more work but is not required for now). 1. Route all unplug calls via the hotplug handler when called from the unplug_request handler. This will be required to get multi-stage hotplug handlers running, but also makes sense on its own (just like we already did for some CPU/memory hotplug handlers). 2. Introduce some pre_plug handlers where it makes sense already. 3. Call the plug/pre_plug handler also for coldplugged devices. Especially pcihp is special as it overwrites hotplug handlers. This series will not yet factor out pre_plug/plug/unplug from pci device realize/unrealize functions, this will require more work but this series is also required first to get it running. From my POV what needs to be done in the future: 1. Introduce pre_plug/plug/unplug_request/unplug handlers for all PCI buses 2. Move pci realize/unrealize parts to pre_plug/pkug/unplug functions like pci_pre_plug() ... 3. Call the pci pre_plug/plug/unplug handlers from the PCI bus hotplug handler at the right spots 4. Factor more checks from existing plug() handlers out into pre_plug() (e.g. after the call to pci_pre_plug()) v1 -> v2: - Added "pci/pcie: rename hotplug handler callbacks" - Added "pci/shpc: rename hotplug handler callbacks" - Added "s390x/pci: rename hotplug handler callbacks" - Dropped "pci/shpc: move hotplug checks to preplug handler" -- We will have to factor out stuff into pre_plug() first as described above - Renamed and added more details to the "perform unplug via the hotplug handler" patches - "pci/pcihp: overwrite hotplug handler recursively from the start" -- Perform the overwrite only for cold plugged bridges, to keep the existing behavior David Hildenbrand (10): pci/pcie: rename hotplug handler callbacks pci/shpc: rename hotplug handler callbacks s390x/pci: rename hotplug handler callbacks pci/pcie: stop plug/unplug if the slot is locked pci/pcihp: perform check for bus capability in pre_plug handler pci/pcihp: overwrite hotplug handler recursively from the start pci/pcihp: perform unplug via the hotplug handler pci/pcie: perform unplug via the hotplug handler pci/shpc: perform unplug via the hotplug handler spapr_pci: perform unplug via the hotplug handler hw/acpi/pcihp.c | 47 ++++++++++++++++++++++++++++----- hw/acpi/piix4.c | 39 ++++++++++++++------------- hw/pci-bridge/pci_bridge_dev.c | 31 +++++++++++++++------- hw/pci-bridge/pcie_pci_bridge.c | 29 ++++++++++++++------ hw/pci/pcie.c | 46 +++++++++++++++++++++----------- hw/pci/pcie_port.c | 6 +++-- hw/pci/shpc.c | 25 ++++++++++++------ hw/ppc/spapr_pci.c | 33 ++++++++++++++--------- hw/s390x/s390-pci-bus.c | 12 ++++----- include/hw/acpi/pcihp.h | 5 ++++ include/hw/pci/pcie.h | 12 ++++++--- include/hw/pci/shpc.h | 10 ++++--- 12 files changed, 201 insertions(+), 94 deletions(-)