Received: by 10.223.185.116 with SMTP id b49csp5831964wrg; Tue, 27 Feb 2018 22:37:45 -0800 (PST) X-Google-Smtp-Source: AH8x226LTSziAAueJrGE5g3HOElmrL4w4Op2wUN0u6YvqNtKutbkesiWHOuEbssTUL9AksyxWJ5g X-Received: by 10.99.114.77 with SMTP id c13mr13365399pgn.286.1519799865703; Tue, 27 Feb 2018 22:37:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519799865; cv=none; d=google.com; s=arc-20160816; b=wGATVhirFLOVQFXtDCw5mQUuJEfoLVeM19tTsx/+zYA4lFRl0+Qv2FzwpI2QyLGnsz /T0DeRytsbXNG9IoJPIMidTj4WnfNBWQCKbQWoduV0tNvxPzADGQXWL0ntEgCaQ/qPjG giYmv1xsiP/TQ7cz7ccl2aTAmQnAmIvSk1aWkynARwHh5ecxJwNP/5K0eaG+tuJqOC23 5/a68OooCIkbRfFIKsY6JadG+XNK7rUgjXXBMBfr+c39q/+Aviph5vz6GlxtIuOLL1bs CMeGvoSDi21p239nHAeIvQnWSzbqF0ZJxy6+Mfd0cdoRybdUO9nlrIYbP3BkhcuQbimn 1p9g== 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=0dVnc142AxKp+obViJYXhOM8YWgbuIjw8F7XAPhquFJmNG6HvMB0vntYnW6fp2l8o2 v3OVLkkr1jgQ2mPJcpudMlNQhnnveu8N1bCGmW4dzDjkbGFtnrUkw7q+pPzNnckTTV5H 8pRBFsAZnspT8R8Ym+hNG3tsLpdBXNh75kokDd8MnjadIexADRh9YmPVLqgaVu50+laB HbpIhiOrPF9pNDlr4jgCM+utH6JsKcNjf0NBUAvWO7MiKse5wB1ji9+BRLSzDm5QbLQU K/OVGQbW+xjAzLioaDpz7TAtadxxgi+zeJJHjQ9/xJzkY/T81BdRXrvGWSt/2Pcpe2N9 ZM8g== 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 o5-v6si776045pls.800.2018.02.27.22.37.31; Tue, 27 Feb 2018 22:37: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 S1752145AbeB1GgE (ORCPT + 99 others); Wed, 28 Feb 2018 01:36:04 -0500 Received: from thoth.sbs.de ([192.35.17.2]:53979 "EHLO thoth.sbs.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751707AbeB1GfN (ORCPT ); Wed, 28 Feb 2018 01:35:13 -0500 Received: from mail3.siemens.de (mail3.siemens.de [139.25.208.14]) by thoth.sbs.de (8.15.2/8.15.2) with ESMTPS id w1S6YuTO009407 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 28 Feb 2018 07:34:56 +0100 Received: from md1f2u6c.ww002.siemens.net ([167.87.77.211]) by mail3.siemens.de (8.15.2/8.15.2) with ESMTP id w1S6Yqu5013249; Wed, 28 Feb 2018 07:34: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 v2 3/6] x86/jailhouse: Enable PCI mmconfig access in inmates Date: Wed, 28 Feb 2018 07:34:48 +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] 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