Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp5523564ybe; Tue, 10 Sep 2019 05:12:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqwFgj74BWjFKE/W4jWSQE1I28EwL3Vn5lnbpSMjsEIzO9eL9kwPCjecYff9i0G4qB2e0stC X-Received: by 2002:a17:906:4c54:: with SMTP id d20mr23896692ejw.159.1568117552402; Tue, 10 Sep 2019 05:12:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568117552; cv=none; d=google.com; s=arc-20160816; b=Q8fMLqEa3N57d/RLKUNm+tANMOcVX3BTN38l8IU36iwtfE2qh+JWMhrUH0GKU/C220 PhohXvdglD5MPSoY91wyofzdNP39vpOA2CJiATk9rfCejwKx3jm/og667SfNZoUSX6NC BO/5v/FGbWRUrnFDG4CFVVgsoYMxMETX3u1Qn0rhUs7pNQtGlnBzwM1QmOs2IG+YP5hR PpcS2N8FbvEXGVprejj54vuBfY+8+Oxd7Q4tpm9gvTht79NZwxUb1vyTHZll9D/1TZJ2 fknT13f3FvmDoV65Cf669Oumr07o84dHySjDOtGRiZNC3A4qsMBEiOAH59wOQGWCTI1O lorw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:ironport-sdr :dkim-signature; bh=3coB7uSiwel7AfTAVI0tLjS7s95qCNq0IPP+yPJCcxU=; b=Oiab5EK2TtYWAPZN+qiI5gvkKI1tRjSgxoahDztjVs9QHdgJWv3y3fwXWk63hVh7jb R9x+GGep4gFwVYLBY1bsymPiqW7qx8nmoWnHcme9OoPAehBPdNG9IJyK86ghCDL+enne EO12RgQJqwWP+lSJCmsqSvxAlKmkPwZ0tK/378290pumnUj1Xj89zzQuduIOMPSgIyUn 6qzLDi1hiehXyIc4VaIrj57LZvNvzPIeSWpN0z1vu497ignVvqfEM+Atwlndb5a4Dyf5 X8j7GAhrSx32ORF+PLsTY7WD9H+ZLr5fiYImjRYvlpD3DNPa8jMUbQajTtF6orntSJ8p TtRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@citrix.com header.s=securemail header.b=AynZNtV2; 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 k23si9043935ejx.130.2019.09.10.05.12.08; Tue, 10 Sep 2019 05:12:32 -0700 (PDT) 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=fail header.i=@citrix.com header.s=securemail header.b=AynZNtV2; 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 S2405335AbfIJJqm (ORCPT + 99 others); Tue, 10 Sep 2019 05:46:42 -0400 Received: from esa1.hc3370-68.iphmx.com ([216.71.145.142]:44653 "EHLO esa1.hc3370-68.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727535AbfIJJqm (ORCPT ); Tue, 10 Sep 2019 05:46:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1568108802; h=subject:to:cc:references:from:message-id:date: mime-version:in-reply-to:content-transfer-encoding; bh=8E5RL8X5WeajVCnn5vq1+mxTjPqDjazWxoob9NeNGNE=; b=AynZNtV2TGf8zh0UbW4eQb82KnI+o9AX/AKmzM4cPLxz2OSyjB82qNVB nixrNHLxBQHFCgVU4tDmkjGQbUBzf+SY1UIBHd3LsY0JQxVhpHHgHPJXS aeJO5K0eL3GdyzqgbGQ9OeKCSm4eE+Q+NE4t3w7MZr7eT4Pa29P5GMd7o c=; Authentication-Results: esa1.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=igor.druzhinin@citrix.com; spf=Pass smtp.mailfrom=igor.druzhinin@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: None (esa1.hc3370-68.iphmx.com: no sender authenticity information available from domain of igor.druzhinin@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa1.hc3370-68.iphmx.com; envelope-from="igor.druzhinin@citrix.com"; x-sender="igor.druzhinin@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa1.hc3370-68.iphmx.com: domain of igor.druzhinin@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa1.hc3370-68.iphmx.com; envelope-from="igor.druzhinin@citrix.com"; x-sender="igor.druzhinin@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ~all" Received-SPF: None (esa1.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa1.hc3370-68.iphmx.com; envelope-from="igor.druzhinin@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: AgY4YBa9SZqZDb2XZGfDW/N/bNhCxk6gnc2o2rZCbMaDE3QDyLj0qR8AcffIrNjy3l47IcJjCJ 91YXehax9cFUWunmd/Pz0pRv3xtClo5f0V6h4T6tNLJKVz8gdGw0hvY4tfScQ9uGDkGrTb3lPd jVEIW6+6VXkyyzp6qeZXEAO668ZXtQkp/lanCnBB+8PbjgMffgZhu/vgbRBYC3VykCrFAiUV94 X4OrxJH8BO0gmRkbvG4dkC3bW5UKNSy96+8lyfDkmj3cELv/B+rTFmV0J3pE+unFjDxCdUe0z4 Lws= X-SBRS: 2.7 X-MesageID: 5411591 X-Ironport-Server: esa1.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.64,489,1559534400"; d="scan'208";a="5411591" Subject: Re: [Xen-devel] [PATCH] xen/pci: try to reserve MCFG areas earlier To: Boris Ostrovsky , , CC: References: <1567556431-9809-1-git-send-email-igor.druzhinin@citrix.com> <5054ad91-5b87-652c-873a-b31758948bd7@oracle.com> <43b7da04-5c42-80d8-898b-470ee1c91ed2@oracle.com> <1695c88d-e5ad-1854-cdef-3cd95c812574@oracle.com> <4d3bf854-51de-99e4-9a40-a64c581bdd10@citrix.com> <43e492ff-f967-7218-65c4-d16581fabea3@oracle.com> From: Igor Druzhinin Message-ID: <416ff4b7-3186-f61a-75fa-bcfc968f8117@citrix.com> Date: Tue, 10 Sep 2019 10:46:38 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <43e492ff-f967-7218-65c4-d16581fabea3@oracle.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/09/2019 02:47, Boris Ostrovsky wrote: > On 9/9/19 5:48 PM, Igor Druzhinin wrote: >> On 09/09/2019 20:19, Boris Ostrovsky wrote: >>> On 9/8/19 7:37 PM, Igor Druzhinin wrote: >>>> On 09/09/2019 00:30, Boris Ostrovsky wrote: >>>>> On 9/8/19 5:11 PM, Igor Druzhinin wrote: >>>>>> On 08/09/2019 19:28, Boris Ostrovsky wrote: >>>>>>> Would it be possible for us to parse MCFG ourselves in pci_xen_init()? I >>>>>>> realize that we'd be doing this twice (or maybe even three times since >>>>>>> apparently both pci_arch_init()  and acpi_ini() do it). >>>>>>> >>>>>> I don't thine it makes sense: >>>>>> a) it needs to be done after ACPI is initialized since we need to parse >>>>>> it to figure out the exact reserved region - that's why it's currently >>>>>> done in acpi_init() (see commit message for the reasons why) >>>>> Hmm... We should be able to parse ACPI tables by the time >>>>> pci_arch_init() is called. In fact, if you look at >>>>> pci_mmcfg_early_init() you will see that it does just that. >>>>> >>>> The point is not to parse MCFG after acpi_init but to parse DSDT for >>>> reserved resource which could be done only after ACPI initialization. >>> OK, I think I understand now what you are trying to do --- you are >>> essentially trying to account for the range inserted by >>> setup_mcfg_map(), right? >>> >> Actually, pci_mmcfg_late_init() that's called out of acpi_init() - >> that's where MCFG areas are properly sized. > > pci_mmcfg_late_init() reads the (static) MCFG, which doesn't need DSDT parsing, does it? setup_mcfg_map() OTOH does need it as it uses data from _CBA (or is it _CRS?), and I think that's why we can't parse MCFG prior to acpi_init(). So what I said above indeed won't work. > No, it uses is_acpi_reserved() (it's called indirectly so might be well hidden) to parse DSDT to find a reserved resource in it and size MCFG area accordingly. setup_mcfg_map() is called for every root bus discovered and indeed tries to evaluate _CBA but at this point pci_mmcfg_late_init() has already finished MCFG registration for every cold-plugged bus (which information is described in MCFG table) so those calls are dummy. >> setup_mcfg_map() is mostly >> for bus hotplug where MCFG area is discovered by evaluating _CBA method; >> for cold-plugged buses it just confirms that MCFG area is already >> registered because it is mandated for them to be in MCFG table at boot time. >> >>> The other question I have is why you think it's worth keeping >>> xen_mcfg_late() as a late initcall. How could MCFG info be updated >>> between acpi_init() and late_initcalls being run? I'd think it can only >>> happen when a new device is hotplugged. >>> >> It was a precaution against setup_mcfg_map() calls that might add new >> areas that are not in MCFG table but for some reason have _CBA method. >> It's obviously a "firmware is broken" scenario so I don't have strong >> feelings to keep it here. Will prefer to remove in v2 if you want. > > Isn't setup_mcfg_map() called before the first xen_add_device() which is where you are calling xen_mcfg_late()? > setup_mcfg_map() calls are done in order of root bus discovery which happens *after* the previous root bus has been enumerated. So the order is: call setup_mcfg_map() for root bus 0, find that pci_mmcfg_late_init() has finished MCFG area registration, perform PCI enumeration of bus 0, call xen_add_device() for every device there, call setup_mcfg_map() for root bus X, etc. Igor