From patchwork Thu May 23 05:29:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Gibson X-Patchwork-Id: 10956907 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 ABEF5112C for ; Thu, 23 May 2019 05:34:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 85CD327FA8 for ; Thu, 23 May 2019 05:34:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 78C6D27FB7; Thu, 23 May 2019 05:34:34 +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=-5.0 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2F29E27FA8 for ; Thu, 23 May 2019 05:34:34 +0000 (UTC) Received: from localhost ([127.0.0.1]:57958 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hTgN7-0003Qd-H2 for patchwork-qemu-devel@patchwork.kernel.org; Thu, 23 May 2019 01:34:33 -0400 Received: from eggs.gnu.org ([209.51.188.92]:41313) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hTgIO-00080i-F2 for qemu-devel@nongnu.org; Thu, 23 May 2019 01:29:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hTgIM-0005jc-Hq for qemu-devel@nongnu.org; Thu, 23 May 2019 01:29:40 -0400 Received: from ozlabs.org ([203.11.71.1]:52855) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hTgIK-0005hs-RR; Thu, 23 May 2019 01:29:38 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 458dNM3kl4z9sDX; Thu, 23 May 2019 15:29:23 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1558589363; bh=AW77xSAKbMiDidstLqWSYFs3Idt3X/vhTJyEOA0oYfY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OEqKriCPGaUmkaQdMd+OcUFPS4Yz1XSzrOKpSnjjL5h1LrexgWM/wjghHiIok1OxS BuSZIZBY/IbZn3jN5zMjFGVuJHo2WXwguq68cOkZfzXCIJ/yVtyelqzPqgfufRbCH+ Y52UkPLHlr9rz3XlHZbysa4BJnLaIay6Qv+yIwZ0= From: David Gibson To: qemu-ppc@nongnu.org Date: Thu, 23 May 2019 15:29:17 +1000 Message-Id: <20190523052918.1129-7-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190523052918.1129-1-david@gibson.dropbear.id.au> References: <20190523052918.1129-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 203.11.71.1 Subject: [Qemu-devel] [PATCH 7/8] spapr: Direct all PCI hotplug to host bridge, rather than P2P bridge 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: mst@redhat.com, qemu-devel@nongnu.org, groug@kaod.org, clg@kaod.org, mdroth@linux.ibm.com, David Gibson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP A P2P bridge will attempt to handle the hotplug with SHPC, which doesn't work in the PAPR environment. Instead we want to direct all PCI hotplug actions to the PAPR specific host bridge which will use the PAPR hotplug mechanism. Signed-off-by: David Gibson --- hw/ppc/spapr.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 507fd50dd5..6dd8aaac33 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -4094,6 +4094,17 @@ static HotplugHandler *spapr_get_hotplug_handler(MachineState *machine, object_dynamic_cast(OBJECT(dev), TYPE_SPAPR_PCI_HOST_BRIDGE)) { return HOTPLUG_HANDLER(machine); } + if (object_dynamic_cast(OBJECT(dev), TYPE_PCI_DEVICE)) { + PCIDevice *pcidev = PCI_DEVICE(dev); + PCIBus *root = pci_device_root_bus(pcidev); + SpaprPhbState *phb = + (SpaprPhbState *)object_dynamic_cast(OBJECT(BUS(root)->parent), + TYPE_SPAPR_PCI_HOST_BRIDGE); + + if (phb) { + return HOTPLUG_HANDLER(phb); + } + } return NULL; }