Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp5983119ybe; Tue, 10 Sep 2019 11:43:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqyme70yaYg3c3+pza3JKTdcLzXEUbgOovZFFqewseqSwET+KSdApelZejB3aRMYJSpy1nD9 X-Received: by 2002:a17:906:6818:: with SMTP id k24mr25743576ejr.271.1568140997712; Tue, 10 Sep 2019 11:43:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568140997; cv=none; d=google.com; s=arc-20160816; b=BAAYOLVMYgwdoG9m6xgL5sIn270nVqrew6Cbg4eDHC/V4QntgK+/MtPwNT3vdkqgSW /i6J4wT5id7sgUUcP6pL5TvErreX5VXtQh9u9+wl/4GqMcrCd9QF41jMeUK0U+5WT7TJ 7+BsUepje1IWuhguhf3eNHP2HrLPe8xC38XOQGHELnCh1Piy1fhqCLXxHUOBPfnqIMoP lefPSiR3bH7ZrBigev1K60Qk1E44VPB/KqnNJD6Vl4z508FYWBvLNRD168Au5u+kb+hw exUERmXS7jmuNDqSsM7NoRh7SoE/t7cUSIaNAh72HZLX3MqtSSegmefwM1tzeI2/6pVM 3MCQ== 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=OXcASyCU5n0K6PFdlLDRPmxVIemiAWnWHV0UJYvaxkE=; b=enmkZqxX7u5MoCO45VWwnsa4dVkh7xQ46b6WaECvwMBmOpdVhZMF1kKcKQH2JP4KNe EMOjpQEe+hYRKFTpGOwaxo7+8OnW3RX/StswiJs3f7UVTwfw70ktbmVD4lJuuBFupq50 Ht2vpRJ0WoEP4tQ1/r03qFpYjwRuwGQkmKxHdkREmp7zqXLvOVgn20lTVVnbYGG5o4T0 CkLtWabSXXYE42HgtxxKECIAPVNTVpWo6AIKCSvZHmALpfQttOngpcFqWMYLihorlmSP i6mU8cq6819e2pAcNUD0yI4W7M8bxbJhcIgFLA70FvDlQO5PD9l+c8tWGY+j1vTcptzO Ou8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@citrix.com header.s=securemail header.b=cMqn+GpW; 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 g25si11162783edp.128.2019.09.10.11.42.53; Tue, 10 Sep 2019 11:43:17 -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=cMqn+GpW; 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 S2388077AbfIIVsp (ORCPT + 99 others); Mon, 9 Sep 2019 17:48:45 -0400 Received: from esa3.hc3370-68.iphmx.com ([216.71.145.155]:14036 "EHLO esa3.hc3370-68.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727104AbfIIVsp (ORCPT ); Mon, 9 Sep 2019 17:48:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1568065722; h=subject:to:cc:references:from:message-id:date: mime-version:in-reply-to:content-transfer-encoding; bh=MtqZUegknBgsc7V9oe2SWxhatbu90YiITWhF1QMXFXQ=; b=cMqn+GpWr60vFpVz/DCuvwfIEiIEW8zHtmhL9shdy0Bmj4aFD0antSjt hMUxv+YnsNQ5PACOzfmcIaKD8LRyfZ/BVC6tgzAjERZf+mBVK7/Yq1eMa El7Av6SZqeZlOuSias03vLqwzmpS/jXUucqmw/eRzDeclahLiF+ynj+54 I=; Authentication-Results: esa3.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 (esa3.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=esa3.hc3370-68.iphmx.com; envelope-from="igor.druzhinin@citrix.com"; x-sender="igor.druzhinin@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa3.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=esa3.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 (esa3.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=esa3.hc3370-68.iphmx.com; envelope-from="igor.druzhinin@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: hCi2gIgXCpOpzBw/5gQOHY8H5elKkQJt9aNlcE1NFqFo0yPRohSWIGMRxTs0CjTDo5YTJqiyFG fcBPotXRNk1rKG19cBsTmSUHUnMEDEHqgidlwyLuWBEDhq+OuqSeMlWtSehk032wQBIRjYTrip W5DSJDoTmhfi9f2U8/FI2WEzbl7yZ79GCST1SOY8/Ztw0KGg1q0VymaIA2tfcHShwTogFgolRP A6jg/uiT+vgu/xatzJ0Otyf8gvOgW7LMhSPpf46TGpWPsYTY7xHBqVZ1SbI++I9bx2WJucfliJ MBo= X-SBRS: 2.7 X-MesageID: 5348248 X-Ironport-Server: esa3.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.64,487,1559534400"; d="scan'208";a="5348248" Subject: Re: [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> From: Igor Druzhinin Message-ID: Date: Mon, 9 Sep 2019 22:48: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: 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 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: >>>>> On 9/6/19 7:00 PM, Igor Druzhinin wrote: >>>>>> On 06/09/2019 23:30, Boris Ostrovsky wrote: >>>>>>> Where is MCFG parsed? pci_arch_init()? >>>>>>>> It happens twice: >>>>>> 1) first time early one in pci_arch_init() that is arch_initcall - that >>>>>> time pci_mmcfg_list will be freed immediately there because MCFG area is >>>>>> not reserved in E820; >>>>>> 2) second time late one in acpi_init() which is subsystem_initcall right >>>>>> before where PCI enumeration starts - this time ACPI tables will be >>>>>> checked for a reserved resource and pci_mmcfg_list will be finally >>>>>> populated. >>>>>> >>>>>> The problem is that on a system that doesn't have MCFG area reserved in >>>>>> E820 pci_mmcfg_list is empty before acpi_init() and our PCI hooks are >>>>>> called in the same place. So MCFG is still not in use by Xen at this >>>>>> point since we haven't reached our xen_mcfg_late(). >>>>> 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. 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. Igor