Received: by 10.223.185.116 with SMTP id b49csp7040300wrg; Wed, 28 Feb 2018 21:42:30 -0800 (PST) X-Google-Smtp-Source: AG47ELtrIN55ylu5bTEUfF6Jr/DQ/6I2JwXIBfJnXSj+3Ak5MnMq1ucbZkITGDXOVG+rJKlsAPkR X-Received: by 10.98.192.203 with SMTP id g72mr740350pfk.27.1519882950180; Wed, 28 Feb 2018 21:42:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519882950; cv=none; d=google.com; s=arc-20160816; b=gEcGKAzCqN1L/iihoDCNpWmd3AELjLjfvllzk57hL63FjtvtRvL+7rihytVtKYnqBt rUcq0TW7N6+a5sX2XdTML2X6Vb9GHJ5kkMIIP6HNO61D4YLsL5Dxq6/TC2a2/Tgs6IVe nLqYDZJRJ3Yi78U/HIGhHMp05jFLwPH1SX4JUayaB3NEXXAaiq9QIBAdln+aXgYpL/JF ls51vUsFE+vkahWzhZoPurqhoAkALh5ZeK6angaFN/JEGgIoSp4YX/nRuFMYltnJb0da 9/DWyn2Yw27A1QZ+VvbqzHjf+2aew8xEsPbb3bfTAOKolGT1I/QvdpO3XDR6AVIagAw8 5sCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=hcV1tZaxerywUqAjNmDPuh66hGS14416+dTdUD2zJZU=; b=GthjElYEWDgfvz7rOjk9AwkqeRcbV0HFUrZwPG8BYSkECBRjNfUj+qlc8pdHvMQDZw 2CG2RUd6bqsClhBTLzNDTVzx85yLWNLmQkonLI6vdM6w1+ReH2qrAqCk/S+niS7OoZ0f eU3ewuAyuzGdzNCvm4OozrSTzqxopKg5XDuQL4VwzKRjL6bWNSw1wH8VdrsTM7DSHtAF rqD30xdMQq3KZH95qmuJL0WkqUElVuHsWBciHAB4nTu80o6eu/ygn+OhBekiNeZMcyBF hDoD0johbR2krs3pWMfCUv/dX7fhA1kjgySSvQT8492fkJXGWPGwK9K3mZ09lO0h4YP+ syVA== 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 j186si1979919pge.747.2018.02.28.21.42.15; Wed, 28 Feb 2018 21:42:30 -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 S966110AbeCAFlN (ORCPT + 99 others); Thu, 1 Mar 2018 00:41:13 -0500 Received: from david.siemens.de ([192.35.17.14]:59741 "EHLO david.siemens.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966063AbeCAFlK (ORCPT ); Thu, 1 Mar 2018 00:41:10 -0500 Received: from mail3.siemens.de (mail3.siemens.de [139.25.208.14]) by david.siemens.de (8.15.2/8.15.2) with ESMTPS id w215eqbu028976 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 1 Mar 2018 06:40:52 +0100 Received: from md1f2u6c.ww002.siemens.net ([167.87.33.50]) by mail3.siemens.de (8.15.2/8.15.2) with ESMTP id w215eo92000453; Thu, 1 Mar 2018 06:40:52 +0100 From: Jan Kiszka To: Thomas Gleixner , Ingo Molnar , "H . Peter Anvin" , Bjorn Helgaas Cc: x86@kernel.org, Linux Kernel Mailing List , jailhouse-dev@googlegroups.com, linux-pci@vger.kernel.org, virtualization@lists.linux-foundation.org, Andy Shevchenko Subject: [PATCH v3 3/6] x86/jailhouse: Enable PCI mmconfig access in inmates Date: Thu, 1 Mar 2018 06:40:46 +0100 Message-Id: <188edc11aa5fa11d4915097831a2a4a153f6ed83.1519882849.git.jan.kiszka@siemens.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Otavio Pontes Use the PCI mmconfig base address exported by jailhouse in boot parameters in order to access the memory mapped PCI configuration space. Signed-off-by: Otavio Pontes [Jan: rebased, fixed !CONFIG_PCI_MMCONFIG] Signed-off-by: Jan Kiszka --- arch/x86/include/asm/pci_x86.h | 2 ++ arch/x86/kernel/jailhouse.c | 7 +++++++ arch/x86/pci/mmconfig-shared.c | 4 ++-- 3 files changed, 11 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..7fe2a73da0b3 100644 --- a/arch/x86/kernel/jailhouse.c +++ b/arch/x86/kernel/jailhouse.c @@ -124,6 +124,13 @@ 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, 0xff, 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 96684d0adcf9..0e590272366b 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; -- 2.13.6