Received: by 10.223.185.116 with SMTP id b49csp6200877wrg; Thu, 8 Mar 2018 03:36:49 -0800 (PST) X-Google-Smtp-Source: AG47ELvVa0ZGeYsCz1lE2yZwn9O0HUAa4Zpe6Zre+EPDNS4qwnVBrWpv3thWv7VIZDvy6uuzCl5j X-Received: by 10.101.85.204 with SMTP id k12mr21408554pgs.40.1520509009513; Thu, 08 Mar 2018 03:36:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520509009; cv=none; d=google.com; s=arc-20160816; b=zHcTmT5aLZDie6/ZjKQcGpp7rembV6s584ozUrfisMsHvbcnWg56VAnZnEzMPXMUn3 T38ba2ADNRQzy4V379TL46lVR6BZh76iDYYxhznulp6ua0ad0JoJlIWQk/R8gP9Qscc1 8rlHjWtqsRtYOa2L03S2ae1RMrhe3uXUFQj9Aw/hBl2WH8aMAnLXu/M1Qg4vy95cudfm cRa2QEoejG00il1CdcW1nVJsEf0UtEOMsrW02iaJYE5181b4IOhk7kbMnX1pdw06Nu36 kCFiIeaBkM95ZxRotIdNI6VVpHOPe81CM9xmarTVwKNxVN2qk/HxSF1zALU54/2fZXCm QWOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date:arc-authentication-results; bh=f/M9pNlSFLiRRUGR/mYD4oIWSzKm7la12eHCokIhd7U=; b=VKd9vQ3U5sbiv1Cb/qKqryVObvhwjX07SQmHTTLhSBFO21CTMjrnrAu9iz2nNyjx4X lyZoMXPRkCCDmgab8xEdKwNcz11qWEEDWXuKh+h9ZCyZOvw6vdqwnghc/6ZT6LQKtVSn OMF58WpUscObdXPEyzJ3co/sta5OUWZ5ERMPaihzfxkoEEjTYl+hrT/Rl0+7rrPLvNme qC8/4fmpoOoHqUcc7oFa9Z8yVkAaMxXrRvYikZVb/GN+vS9h+WT7S4VM05k7Pn4hISXt mLnOMb3ABiL6L9xJAjdXMsJiooA2IQ4kX76hB3fM5gJgBMH1LWkIC4MeY3TIKGJdxxZw u0fg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u3-v6si14524001plz.494.2018.03.08.03.36.34; Thu, 08 Mar 2018 03:36:49 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755623AbeCHLfX (ORCPT + 99 others); Thu, 8 Mar 2018 06:35:23 -0500 Received: from terminus.zytor.com ([198.137.202.136]:42241 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755329AbeCHLfV (ORCPT ); Thu, 8 Mar 2018 06:35:21 -0500 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTP id w28BZ2SC029990; Thu, 8 Mar 2018 03:35:02 -0800 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id w28BZ15p029987; Thu, 8 Mar 2018 03:35:01 -0800 Date: Thu, 8 Mar 2018 03:35:01 -0800 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Otavio Pontes Message-ID: Cc: bhelgaas@google.com, andy.shevchenko@gmail.com, mingo@kernel.org, hpa@zytor.com, otavio.pontes@intel.com, jan.kiszka@siemens.com, linux-kernel@vger.kernel.org, tglx@linutronix.de Reply-To: bhelgaas@google.com, andy.shevchenko@gmail.com, mingo@kernel.org, hpa@zytor.com, otavio.pontes@intel.com, jan.kiszka@siemens.com, linux-kernel@vger.kernel.org, tglx@linutronix.de In-Reply-To: <2ee9e4401fa22377b3965893a558120f169be82b.1520408357.git.jan.kiszka@siemens.com> References: <2ee9e4401fa22377b3965893a558120f169be82b.1520408357.git.jan.kiszka@siemens.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/platform] x86/jailhouse: Enable PCI mmconfig access in inmates Git-Commit-ID: 6fa4a94e150be25d02547d51f03b4bc34aaec32f X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 6fa4a94e150be25d02547d51f03b4bc34aaec32f Gitweb: https://git.kernel.org/tip/6fa4a94e150be25d02547d51f03b4bc34aaec32f Author: Otavio Pontes AuthorDate: Wed, 7 Mar 2018 08:39:14 +0100 Committer: Thomas Gleixner CommitDate: Thu, 8 Mar 2018 12:30:38 +0100 x86/jailhouse: Enable PCI mmconfig access in inmates Use the PCI mmconfig base address exported by jailhouse in boot parameters in order to access the memory mapped PCI configuration space. [Jan: rebased, fixed !CONFIG_PCI_MMCONFIG, used pcibios_last_bus] Signed-off-by: Otavio Pontes Signed-off-by: Jan Kiszka Signed-off-by: Thomas Gleixner Reviewed-by: Andy Shevchenko Cc: jailhouse-dev@googlegroups.com Cc: linux-pci@vger.kernel.org Cc: virtualization@lists.linux-foundation.org Cc: Bjorn Helgaas Link: https://lkml.kernel.org/r/2ee9e4401fa22377b3965893a558120f169be82b.1520408357.git.jan.kiszka@siemens.com --- arch/x86/include/asm/pci_x86.h | 2 ++ arch/x86/kernel/jailhouse.c | 8 ++++++++ arch/x86/pci/mmconfig-shared.c | 4 ++-- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/arch/x86/include/asm/pci_x86.h b/arch/x86/include/asm/pci_x86.h index eb66fa9cd0fc..959d618dbb17 100644 --- a/arch/x86/include/asm/pci_x86.h +++ b/arch/x86/include/asm/pci_x86.h @@ -151,6 +151,8 @@ extern int pci_mmconfig_insert(struct device *dev, u16 seg, u8 start, u8 end, phys_addr_t addr); extern int pci_mmconfig_delete(u16 seg, u8 start, u8 end); extern struct pci_mmcfg_region *pci_mmconfig_lookup(int segment, int bus); +extern struct pci_mmcfg_region *__init pci_mmconfig_add(int segment, int start, + int end, u64 addr); extern struct list_head pci_mmcfg_list; diff --git a/arch/x86/kernel/jailhouse.c b/arch/x86/kernel/jailhouse.c index b68fd895235a..fa183a131edc 100644 --- a/arch/x86/kernel/jailhouse.c +++ b/arch/x86/kernel/jailhouse.c @@ -124,6 +124,14 @@ static int __init jailhouse_pci_arch_init(void) if (pcibios_last_bus < 0) pcibios_last_bus = 0xff; +#ifdef CONFIG_PCI_MMCONFIG + if (setup_data.pci_mmconfig_base) { + pci_mmconfig_add(0, 0, pcibios_last_bus, + setup_data.pci_mmconfig_base); + pci_mmcfg_arch_init(); + } +#endif + return 0; } diff --git a/arch/x86/pci/mmconfig-shared.c b/arch/x86/pci/mmconfig-shared.c index 0b40482578b8..7389db538c30 100644 --- a/arch/x86/pci/mmconfig-shared.c +++ b/arch/x86/pci/mmconfig-shared.c @@ -94,8 +94,8 @@ static struct pci_mmcfg_region *pci_mmconfig_alloc(int segment, int start, return new; } -static struct pci_mmcfg_region *__init pci_mmconfig_add(int segment, int start, - int end, u64 addr) +struct pci_mmcfg_region *__init pci_mmconfig_add(int segment, int start, + int end, u64 addr) { struct pci_mmcfg_region *new;