Received: by 10.223.176.46 with SMTP id f43csp2524831wra; Sun, 21 Jan 2018 22:14:45 -0800 (PST) X-Google-Smtp-Source: AH8x224e6GNxnjfUeCD3pbaxDKBfVodw1h8GolnSQgDTv4GAQEt2xCgeMcOTOKYBiq2jKDERntlH X-Received: by 2002:a17:902:7716:: with SMTP id n22-v6mr2892827pll.388.1516601685380; Sun, 21 Jan 2018 22:14:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516601685; cv=none; d=google.com; s=arc-20160816; b=nBYXlmuC7RoEWIW/71cmHueaublcowMMjnniPBiRzN+4weTuHroJRnMDGEXVFepuX/ ejWhm1rQuKevJMnmLHE6zjkP6Sti7vJ1qxBl8ueybtYIelfyezpSNoDW8Tlp31IMCp4h rbpi54730D/sBEzdGUVOr8ImoMD+zKiW9pjP5kEp2lfW3Uu10JoT8Z5HAdDkXRlVZF0S /Hv/+zktXCMlysOSBJIFYoRHwGCURieThVl/HOkRNL3AtcwCPf5y1eUVfQFbLOTLlNQ0 eA1gyQoHQtZT8gL+qAk24/6LvCnul/9VzwDTrEFg/ev/QBzw+u89j3TH6XlK/OKUOuZD zb5A== 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=yWd2rqQ5xyMh9hC61Go+dILmQUnBZuPbBXydofsjgGLPbXDk9rJ2APOaWBPkf9FgvW fIJjQGh3OOc9frDfe7PvTwvRCBWA9fZJVBBQPqJ9NtN75juCjdK7u8K4nZFdd9dQ+BqO /5vDn5Gzyij3eCRWRBn+b484Nxno4fpNxcCsUOKcTIzuhdxzFG3BVgQm40nWk/0TqShL HWSdTgmQERLWNDrrFqrxmOOxrpO7f72llGaN93nUOo1/f6NcGQcqq5LcnQBPmZHEfIUE 7jPUNoeMco/hzV+Lgcp6WBGkjWYr6Tg5NdwMXWkEjTs7X0t3wih09xrb+BuAKYBOEL5G 2c0A== 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 y23si13516138pgc.588.2018.01.21.22.14.31; Sun, 21 Jan 2018 22:14:45 -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 S1751243AbeAVGNs (ORCPT + 99 others); Mon, 22 Jan 2018 01:13:48 -0500 Received: from david.siemens.de ([192.35.17.14]:38100 "EHLO david.siemens.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751122AbeAVGNO (ORCPT ); Mon, 22 Jan 2018 01:13:14 -0500 Received: from mail1.siemens.de (mail1.siemens.de [139.23.33.14]) by david.siemens.de (8.15.2/8.15.2) with ESMTPS id w0M6Cv1q016972 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 22 Jan 2018 07:12:57 +0100 Received: from md1f2u6c.ww002.siemens.net ([167.87.15.170]) by mail1.siemens.de (8.15.2/8.15.2) with ESMTP id w0M6Cq6k008276; Mon, 22 Jan 2018 07:12:56 +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 Subject: [PATCH 3/6] x86/jailhouse: Enable PCI mmconfig access in inmates Date: Mon, 22 Jan 2018 07:12:47 +0100 Message-Id: <3c087d2882c83b70c29c5f84f36414a51b13802c.1516601570.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