Received: by 10.223.185.116 with SMTP id b49csp2717250wrg; Mon, 5 Mar 2018 07:38:02 -0800 (PST) X-Google-Smtp-Source: AG47ELuYmPs8EJyhIYkojHmASbtZ+TQ3gGTvXPGEcNvsNDCipdwlfqihMWSY2D3if772SwVwnMWc X-Received: by 10.98.144.146 with SMTP id q18mr15962208pfk.103.1520264282407; Mon, 05 Mar 2018 07:38:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520264282; cv=none; d=google.com; s=arc-20160816; b=Evxj7LAivpPD7bJ6rATGECbVzvJxmZMrpt66HP9k2IPN/6vvVEXNBPdiQZCisEnCQ/ rlQuL6OqiPWbXLMHMlht9dT4jbhYwusFgqrKAepwlWIsgVEXr0Lp6vwI2GhfIZBfhdfl ly8qkkH/Dm76QTtWSPjg5I9cyxx7/nwW90s3agqLR5gkFsX0grp5OnGD4gQ+czZ9U1jI ZtWhdyewgAAKor2iVWRNZ5Fef5ntpAkY9h94zW+/YJ2kdpzoOIzABMQhcmWZzad8N52F CeGsedHqt5w44JWo+K/b3dnLwCEnqlJM5n7Da+UyvId3DlNsAB658ICtRPYp8N7tNak8 PL0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=I5R3SVJ84gRmM6EahvVAfT+saVVlppIpCe7DNtPe1kI=; b=hK3cExBLzZrK3tOQ4Al71VteSZh5C6tuSF6PXEIngdtSFWApG8xm9346gS1tX9iJJm EiSgt13l9cRwh2/UV4bqzN2KJ/1bzcm1pQc5s5wzijNQd5NzCTw5gFT85XFJB4b5oFGw kKBgeop+Ck3doMLUo0VbitqYXU6sYuSOeE7X5FIJ7hw3KCwdJtLSK+cxdJyYvQ+54s86 RnOTDkkImLmbU5dV68b+lmAMsHZxmAl8lcXh1ReSXPUq/4n/4jmFJzqa4MRVmh2zLLC1 nPcHSK1OakaM+dkZLNQn0FFKvOpdi0UvZkSwiaBTW5MShFpjLeRRvai1aOrMMdwyF9HP fLHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=JgBe1BpC; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p11-v6si7101639plk.785.2018.03.05.07.37.47; Mon, 05 Mar 2018 07:38:02 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=JgBe1BpC; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752063AbeCEPgv (ORCPT + 99 others); Mon, 5 Mar 2018 10:36:51 -0500 Received: from mail-qt0-f194.google.com ([209.85.216.194]:43150 "EHLO mail-qt0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751779AbeCEPgt (ORCPT ); Mon, 5 Mar 2018 10:36:49 -0500 Received: by mail-qt0-f194.google.com with SMTP id d26so20782829qtk.10; Mon, 05 Mar 2018 07:36:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=I5R3SVJ84gRmM6EahvVAfT+saVVlppIpCe7DNtPe1kI=; b=JgBe1BpCDqbrS3I2KFLm/lKXf7WX86t9WVikl0u7Os+PYU7o9NAJGoCwmAnewo1MQJ nDdvYHy3UXFPJH5D7ZFcKOswW+PkvwUvYG3hsxXFqj2Y0m9uiR6y9IpIAcsk8t8tTdh4 jFAfLPYSPesTsTAB7Gc5JG9hfHsDYAuugD+sMzsIE8E5UmzPephTgUF773U2yEIUoNdk M77/QeH4MSgWaHWxGyjke8C019DvlD5GWBE+UKcAIv0DbbtaZnJZRQSYncwQys7TkY6t L5PMXfyleHXN8YimZwiVc8KEdTFKyiWY7wCGKiSb4VzgtDlCI+nOQxOj3iNCDnS30ul/ 8Cdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=I5R3SVJ84gRmM6EahvVAfT+saVVlppIpCe7DNtPe1kI=; b=hEvy78p9K0Zx4g/NgtJWcd6qN0MZWTe8wwSASnjc0YXCmYBoMaJzIpM+W5qD0b/HlV n0ngPQE8z31YpdU73ziiheP1QSwAWgbPx4AOPROxGUriqlzUqUKhjaByx6K3YxGDv724 qBHMDTwv0i9Pub5615N+rXjilfHUKnovu4VbZ4n6/k1B/lgfUqRVMbIV8XrLa4kfUdjP gElSPRb3AoUem00jcxXPfFKbq2mDFwreY/D0p471BpCPR2FxjQLKSvmeIgcSImjPAwXK 9yI0XodLq6jtsNy5AKZVTon7rUcGdKgLHv/jpuCG+A7mEjlrm5AEQBLvoPwkTA6vhdAg P//Q== X-Gm-Message-State: AElRT7F85p7U4wNffgFLCYU+YlSlvGDLnbsOKseDdvBUeLqDxKNq7USw obSzDfdA8oq64XWBN+y67ldjslkV1X2Q3LOlsK4= X-Received: by 10.200.39.217 with SMTP id x25mr22601966qtx.266.1520264208818; Mon, 05 Mar 2018 07:36:48 -0800 (PST) MIME-Version: 1.0 Received: by 10.12.195.80 with HTTP; Mon, 5 Mar 2018 07:36:48 -0800 (PST) In-Reply-To: References: From: Andy Shevchenko Date: Mon, 5 Mar 2018 17:36:48 +0200 Message-ID: Subject: Re: [PATCH v4 3/7] x86/jailhouse: Enable PCI mmconfig access in inmates To: Jan Kiszka Cc: Thomas Gleixner , Ingo Molnar , "H . Peter Anvin" , Bjorn Helgaas , x86@kernel.org, Linux Kernel Mailing List , jailhouse-dev@googlegroups.com, linux-pci@vger.kernel.org, virtualization@lists.linux-foundation.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Mar 4, 2018 at 8:31 PM, Jan Kiszka wrote: > 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. > FWIW, Reviewed-by: Andy Shevchenko > 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 > -- With Best Regards, Andy Shevchenko