From patchwork Sat Jul 22 22:11:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aleksandr Bezzubikov X-Patchwork-Id: 9858243 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 A04BF601C0 for ; Sat, 22 Jul 2017 22:15:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 929B128509 for ; Sat, 22 Jul 2017 22:15:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 877CB28511; Sat, 22 Jul 2017 22:15:31 +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 4134128509 for ; Sat, 22 Jul 2017 22:15:31 +0000 (UTC) Received: from localhost ([::1]:48502 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dZ2gM-0002Lu-EX for patchwork-qemu-devel@patchwork.kernel.org; Sat, 22 Jul 2017 18:15:30 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59941) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dZ2dG-0000RZ-Cr for qemu-devel@nongnu.org; Sat, 22 Jul 2017 18:12:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dZ2dF-0006ly-Kg for qemu-devel@nongnu.org; Sat, 22 Jul 2017 18:12:18 -0400 Received: from mail-lf0-x241.google.com ([2a00:1450:4010:c07::241]:36402) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dZ2dF-0006li-Da for qemu-devel@nongnu.org; Sat, 22 Jul 2017 18:12:17 -0400 Received: by mail-lf0-x241.google.com with SMTP id t128so758265lff.3 for ; Sat, 22 Jul 2017 15:12:17 -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=DGBWUcwkNJnG+/Kbr+H/0FcXbeJw32MyqwBDvtYix6c=; b=noLuaX6QlwDWtfdiLDdm7mG8e3BFyVAJ89Nx9IaoOvrmY+kciekb9crC/ZhXIQHEo4 PuCKUeuPnss5rbRxUd7xPN9nF0av0C6zuen3OhZsy/fLwPLX68ZPpjZhPGapEgClnwMs Da7ma45ox5WwchJ/BGBfm1cQVrA+B8VKJdyOtdMEoqG3RIUJLzRkNc4xMNGHiOwWEqCk Ps8l6XILHUi/rfEXKOqTfcEchj9PkGv04eqBkn8dFOqZ/L0Rse9FWoCMlQ7lvlWxeFVd ka03swayyUA09GFd5u8onKI8qbd3CRgr8hIe79O3QJVsfMfWR9OISpbl+cHHqX6hzp+J JDIA== 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=DGBWUcwkNJnG+/Kbr+H/0FcXbeJw32MyqwBDvtYix6c=; b=oMH41pSvvsZ+9uFg8dojD+qVWjc0hVMepjSXr+oX7tQgihz/tBk0Oz04zBytgW7H5I YojqIBWS7CJIydDlK7i/uuAuPATv52I8SSI6w6FoRTV4ADJ1NtCPlZVlAVtJISP6e9Pf oiXo4eACVBPkiTLL3c6aga2eTIxBclngHr/fYeDeji7yy4lXfrel4RsaKQOFqZ35bAXg KS7tbSrANYPi3ldmEdeOyD19TpKcNz9Zc8ldcGXUOK3kwqlDdU1Z3DgKurWFS2VsW3us UuG+m28tRjKGlgNw3IambYD7FGpFUXZndOQEK3ytlShwVEqMp/0732uBHNFlabbyOrMP oPIQ== X-Gm-Message-State: AIVw1127HKn/saEqaW1taxod0tFYyw9uJGhszQ6g5BJ40wtxPnP+2vS7 J/hMPlqYTeijdA== X-Received: by 10.46.20.16 with SMTP id u16mr3905491ljd.54.1500761536316; Sat, 22 Jul 2017 15:12:16 -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 s134sm1604053lfe.27.2017.07.22.15.12.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 22 Jul 2017 15:12:15 -0700 (PDT) From: Aleksandr Bezzubikov To: seabios@seabios.org Date: Sun, 23 Jul 2017 01:11:50 +0300 Message-Id: <1500761510-1556-5-git-send-email-zuban32s@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1500761510-1556-1-git-send-email-zuban32s@gmail.com> References: <1500761510-1556-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::241 Subject: [Qemu-devel] [RFC PATCH v2 4/4] pci: enable RedHat PCI bridges to reserve additional buses on PCI init 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: konrad.wilk@oracle.com, mst@redhat.com, qemu-devel@nongnu.org, Aleksandr Bezzubikov , kevin@koconnor.net, kraxel@redhat.com, marcel@redhat.com, lersek@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP In case of Red Hat PCI bridges reserve additional buses, which number is provided in a vendor-specific capability. Signed-off-by: Aleksandr Bezzubikov --- src/fw/pciinit.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/fw/pciinit.c b/src/fw/pciinit.c index 864954f..f05a8b9 100644 --- a/src/fw/pciinit.c +++ b/src/fw/pciinit.c @@ -15,6 +15,7 @@ #include "hw/pcidevice.h" // pci_probe_devices #include "hw/pci_ids.h" // PCI_VENDOR_ID_INTEL #include "hw/pci_regs.h" // PCI_COMMAND +#include "hw/pci_cap.h" // qemu_pci_cap #include "list.h" // struct hlist_node #include "malloc.h" // free #include "output.h" // dprintf @@ -578,9 +579,18 @@ pci_bios_init_bus_rec(int bus, u8 *pci_bus) pci_bios_init_bus_rec(secbus, pci_bus); if (subbus != *pci_bus) { + u8 res_bus = 0; + if (pci_config_readw(bdf, PCI_VENDOR_ID) == PCI_VENDOR_ID_REDHAT) { + u8 cap = pci_find_capability(bdf, PCI_CAP_ID_VNDR, 0); + if (cap) { + res_bus = pci_config_readb(bdf, + cap + offsetof(struct redhat_pci_bridge_cap, + bus_res)); + } + } dprintf(1, "PCI: subordinate bus = 0x%x -> 0x%x\n", - subbus, *pci_bus); - subbus = *pci_bus; + subbus, *pci_bus + res_bus); + subbus = *pci_bus + res_bus; } else { dprintf(1, "PCI: subordinate bus = 0x%x\n", subbus); }