From patchwork Sat Jul 22 22:15:42 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aleksandr Bezzubikov X-Patchwork-Id: 9858253 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5DF33601C0 for ; Sat, 22 Jul 2017 22:21:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 54423284BD for ; Sat, 22 Jul 2017 22:21:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 493A028524; Sat, 22 Jul 2017 22:21:13 +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=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID 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 D345C284BD for ; Sat, 22 Jul 2017 22:21:12 +0000 (UTC) Received: from localhost ([::1]:48525 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dZ2ls-0006SU-2I for patchwork-qemu-devel@patchwork.kernel.org; Sat, 22 Jul 2017 18:21:12 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60362) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dZ2gy-0003LC-Fv for qemu-devel@nongnu.org; Sat, 22 Jul 2017 18:16:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dZ2gx-0008Lz-Hv for qemu-devel@nongnu.org; Sat, 22 Jul 2017 18:16:08 -0400 Received: from mail-lf0-x244.google.com ([2a00:1450:4010:c07::244]:33835) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dZ2gx-0008LG-A5 for qemu-devel@nongnu.org; Sat, 22 Jul 2017 18:16:07 -0400 Received: by mail-lf0-x244.google.com with SMTP id p11so5151612lfd.1 for ; Sat, 22 Jul 2017 15:16:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=CmC0ZrzbdJ6lPaeasTTJvLBJ0ACZREUz5pMUAmIHDtg=; b=E7d/Flxr3VYf4kSKrTBtRuq9xLMQI7ZECmdXy1wHP4SBqgl8MwNxSwOXFlzQde2iga u3Z0G0fV9KBzNdDsW5ptIYXP4QrlJHOfpsRNDZlepHMUh4Vxou7gyhb16JjR0vQZKVVs StV26ZpSv9woKy1mjR0O9/tHxTFvSZ5eLsvg2g4IP+NVpbzJsp1mVSVnh0BqdwrvOpwB MEx+hGajaVoNW8fgvl01vW/SJuWG6EI172VkquI8jLjcdp1h7gKaWWVrsjU7EQWi/xZQ SMllf6BNiggvFafup7xJgBxU4QCfl+odP89HBpDHO/Xv+AUz7czxOAh5gu1H2D6U8aKN KqtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=CmC0ZrzbdJ6lPaeasTTJvLBJ0ACZREUz5pMUAmIHDtg=; b=B26/lGE68lktcgiPwtqjsesVNKzgJDb0fl/jbSz582bPfu8JjJXb2+pGG0D++Ci2Hc rHx3agOJMGFfkSY1SG5fcFxzy0I5YmKnww+fnfM08cjrLIYtdHu/3DK/NNlIo5vuOqCN POWz9R6wVX+lDiQ3SrEQ3sQnlgDIdH8EZFrpse5SxucX6QajFqWWRg6ZNwhCeyejCMsB RuwSRRhn6Dxs3g8yhwbfEZYxRJtHRTam5tous18zg2zH6sWokvxDoJGOZtM3WGhsrmzI 8S0T3qNenuRO+Kh6d24jY5i8W5WHyyQrY2NLH70i+SuibZ3mM5AFoVTZSfRNtq4L9RMh lfFQ== X-Gm-Message-State: AIVw110ZV+hoSye6/kt38bV+3SESmFaDXijrVugGqbLUuumwQ/V5MP7H 67ABBZqNEAXEEwNP6s4= X-Received: by 10.25.190.83 with SMTP id o80mr3204656lff.87.1500761765859; Sat, 22 Jul 2017 15:16:05 -0700 (PDT) Received: from localhost.localdomain (broadband-178-140-16-138.moscow.rt.ru. [178.140.16.138]) by smtp.gmail.com with ESMTPSA id t10sm757832lja.47.2017.07.22.15.16.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 22 Jul 2017 15:16:04 -0700 (PDT) From: Aleksandr Bezzubikov To: qemu-devel@nongnu.org Date: Sun, 23 Jul 2017 01:15:42 +0300 Message-Id: <1500761743-1669-6-git-send-email-zuban32s@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1500761743-1669-1-git-send-email-zuban32s@gmail.com> References: <1500761743-1669-1-git-send-email-zuban32s@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4010:c07::244 Subject: [Qemu-devel] [RFC PATCH v2 5/6] hw/pci: add bus_reserve property to pcie-root-port 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: ehabkost@redhat.com, mst@redhat.com, seabios@seabios.org, Aleksandr Bezzubikov , kraxel@redhat.com, pbonzini@redhat.com, marcel@redhat.com, imammedo@redhat.com, rth@twiddle.net Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP To enable hotplugging of a newly created pcie-pci-bridge, we need to tell firmware (SeaBIOS in this case) to reserve additional buses for pcie-root-port, that allows us to hotplug pcie-pci-bridge into this root port. The number of buses to reserve is provided to the device via a corresponding property, and to the firmware via new PCI capability (next patch). The property's default value is 1 as we want to hotplug at least 1 bridge. Signed-off-by: Aleksandr Bezzubikov --- hw/pci-bridge/pcie_root_port.c | 1 + include/hw/pci/pcie_port.h | 3 +++ 2 files changed, 4 insertions(+) diff --git a/hw/pci-bridge/pcie_root_port.c b/hw/pci-bridge/pcie_root_port.c index 4d588cb..b0e49e1 100644 --- a/hw/pci-bridge/pcie_root_port.c +++ b/hw/pci-bridge/pcie_root_port.c @@ -137,6 +137,7 @@ static void rp_exit(PCIDevice *d) static Property rp_props[] = { DEFINE_PROP_BIT(COMPAT_PROP_PCP, PCIDevice, cap_present, QEMU_PCIE_SLTCAP_PCP_BITNR, true), + DEFINE_PROP_UINT8("bus_reserve", PCIEPort, bus_reserve, 1), DEFINE_PROP_END_OF_LIST() }; diff --git a/include/hw/pci/pcie_port.h b/include/hw/pci/pcie_port.h index 1333266..1b2dd1f 100644 --- a/include/hw/pci/pcie_port.h +++ b/include/hw/pci/pcie_port.h @@ -34,6 +34,9 @@ struct PCIEPort { /* pci express switch port */ uint8_t port; + + /* additional buses to reserve on firmware init */ + uint8_t bus_reserve; }; void pcie_port_init_reg(PCIDevice *d);