Received: by 10.223.185.116 with SMTP id b49csp1824070wrg; Sun, 4 Mar 2018 10:49:08 -0800 (PST) X-Google-Smtp-Source: AG47ELv3YB8an85Nqv/888cmK7wvp4dOSnm+Soc1l+yL/d4CsP0oqLMPX0cXE4FIPJ+VrdB7ejjW X-Received: by 2002:a17:902:24a5:: with SMTP id w34-v6mr10619932pla.221.1520189348202; Sun, 04 Mar 2018 10:49:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520189348; cv=none; d=google.com; s=arc-20160816; b=bNus/fi6BqSxJDtSMMB93b9EUrr/KuS/4HiAfAUfhPiXmL1zKUFio1Zd+y6MB5NdIX ZXUDjxlF+1LJoQ2e5PlgemhW7y9cKJs60O0YEu2S3yQV9oYUc8w7VC51HKwoTZc+w5aO JAO6oKYGyOYhBVCpmAeF+FfS5Vo76f/NefkJzpmm9Pn3OsdKxOgQqLgr8Zbvq5gASer/ 4YHLj1lLloc3QuNrAlDVN6SvrYP0igUX7Na9KwW0Tfl84HkzwCI8m6E4mbWMfFTrHlTR FyrHwnZ8TB5DWXq6ynf1kMaqBgefb21S8Cdy8mQnEf8ZiHcTMmFjyyUKhmxg2pmVTazA jzRA== 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=TKwaci7PAatuRs9RV1WViE3e0ynH5h6O2pum5XbX+/c=; b=VG09ck884+I02WQzGiuXE+t1JZVWOjMkeyYwqs+gSvNKZjFqKga92v+S8H1h6N/A+e cTD2gkMxCjGW7+nqnhOTECXxKYUFxyKJfk9aPjgmP0ZSkWMKNYhxpuNidFBM4BM9s5A2 G8v+6bucctMdFtCIysKKbqmbgYXXcVq3xJz5wzYrYDHC0XEkOfWdH/o9BWErl1Dxhb0X V5YY1VfnJtcWGtxLtGqwKMIWj0kU2EP1nWbcwr+3f0x6ZjzPemxcVdGgPrNv5HjyJA9K Azl6t/CM4ERDKYL6k9z4HyXcNWu9HPovaTOIYIQuP9yiSjkQGCMDUJN/uWN1wmbRizaD oSvg== 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 t10si7331475pgc.18.2018.03.04.10.48.54; Sun, 04 Mar 2018 10:49:08 -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 S932201AbeCDSdX (ORCPT + 99 others); Sun, 4 Mar 2018 13:33:23 -0500 Received: from goliath.siemens.de ([192.35.17.28]:60013 "EHLO goliath.siemens.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751999AbeCDScB (ORCPT ); Sun, 4 Mar 2018 13:32:01 -0500 Received: from mail3.siemens.de (mail3.siemens.de [139.25.208.14]) by goliath.siemens.de (8.15.2/8.15.2) with ESMTPS id w24IVhLo022881 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 4 Mar 2018 19:31:43 +0100 Received: from md1f2u6c.ww002.siemens.net ([167.87.43.202]) by mail3.siemens.de (8.15.2/8.15.2) with ESMTP id w24IVdj7022006; Sun, 4 Mar 2018 19:31:42 +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 v4 3/7] x86/jailhouse: Enable PCI mmconfig access in inmates Date: Sun, 4 Mar 2018 19:31:35 +0100 Message-Id: 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, used pcibios_last_bus] Signed-off-by: Jan Kiszka --- 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 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