Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp4264643ybe; Mon, 9 Sep 2019 06:51:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqzY5D8Eb2bldQZzRYqA463HkK1K4sQawJt09TCbuoosug8+tgO2FHbu7bWwon6IJ8wE9xh0 X-Received: by 2002:a50:e68d:: with SMTP id z13mr24356272edm.142.1568037111943; Mon, 09 Sep 2019 06:51:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568037111; cv=none; d=google.com; s=arc-20160816; b=ResLkQrckaUN8dOVvBQpsQMwav2a02HnAV5vfCWxjqQ5sT14+7mqU5BwvoLHe3R+t9 LzY+Vu8tVtkE0SrzuILBS7y1LV9mxzBHd1mrzxpJ+inG+S2GvFkOy3ofCxzI9VfUEVWQ EZv5KVTveHkRyQBnrE+kcjsOxHr1oXFjcDMHp8x7920rVOFOdKM30KnqNenGbsAt8uVM RQ4QTrH65RAJtdrYTG47IVMk+M+zGrtF0D6vkpcP43aruWCkwjblRJ4FRLr7RVXPsT4U vmcj4c5o7AVXJ8f4L7KsuzU7GK4z9jNaEkeui7fY+ZRa/+spGRWN8FEYN1o406YvLfVO i2lQ== 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=v3pfWbCqMHp2m8V8TbAJ3YY/IhEICKXXxVyqM1+2tWc=; b=bFMuZRYaT66zv4xag5ryq6G7h62ThTmW/dHUnnw0iEU8WSwoBkfJc4UDD0ifrLxWUU 9neovGGD6inYlmjVcLOJYgq6x2ozh8cTNK4xn2F+ehs5Le6/VyyKnD5SgdBDy/Qyxc8S QMhPy1PLOcvWLOnZv2pOQTo23BREMUF3vQoj3TwxxSH+UiHl8mztyFYN2u0Cj+bHDWM+ 9LY/4diVIa0djT0pDyOEyLdTyeoaYHCHdCa/EZx77N4THXN/OpaSSF04i4DvZHa3PKsU P21dNWXT04klcts8BeF2a6rBuAiWx6PjKoH0Sng0IsRNUeggqkQpZDKD0gwz5HnFm/Wx sAmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@citrix.com header.s=securemail header.b="Z3R/n/UM"; 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 pj15si7648063ejb.284.2019.09.09.06.51.27; Mon, 09 Sep 2019 06:51:51 -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="Z3R/n/UM"; 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 S1731410AbfIHXhP (ORCPT + 99 others); Sun, 8 Sep 2019 19:37:15 -0400 Received: from esa4.hc3370-68.iphmx.com ([216.71.155.144]:46187 "EHLO esa4.hc3370-68.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731203AbfIHXhP (ORCPT ); Sun, 8 Sep 2019 19:37:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1567985834; h=subject:to:cc:references:from:message-id:date: mime-version:in-reply-to:content-transfer-encoding; bh=j27af3ptPQZ2OnmzBveENofO7zeBJFyvmuv4vbn2eJQ=; b=Z3R/n/UMNq1fRUfKZllDVTTeUETTYNMeebdo9XIyY+IdyAarQWe2nUwY zdY5MAoIq0GG1/nwcYGzLGYi8bkFJb8mZRewZRsmyzpOdMr5L8DwTm+2S h6pJak+AO5z+nue97fJUkM4J2VMcGAjbAC2HlLaLkZBXIJ2PCVRcUZW2y 0=; Authentication-Results: esa4.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 (esa4.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=esa4.hc3370-68.iphmx.com; envelope-from="igor.druzhinin@citrix.com"; x-sender="igor.druzhinin@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa4.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=esa4.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 (esa4.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=esa4.hc3370-68.iphmx.com; envelope-from="igor.druzhinin@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: +z45qSjQII/5flzz3HRMW6jwaGS/a+cfRgMJ0WNGy16YukfNrmVu9TXJ0w8CiYD8l/iuL83zhL 3a6i7Ie3l9U6tu87filf2L4dbBdRg7B7h1GPcLY9ooY7gbxXerEy+5NOvXJX7Cs1NOHBVVt0cU J9aley3cnBkhdGWuTAExwr5zAq+tdch93XIGPX1/ondc+zRI61/3SWd7tXId/EPUJAFEQN70Wu LwHAt1x/7+GdQn2jpSEEUFCYL3ZSlgAoZeJZyQ0kH3h2ZF3hX2/YSuA7g0Qf3HtSVij5bbD+8o jXQ= X-SBRS: 2.7 X-MesageID: 5570001 X-Ironport-Server: esa4.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.64,483,1559534400"; d="scan'208";a="5570001" 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> From: Igor Druzhinin Message-ID: <4d3bf854-51de-99e4-9a40-a64c581bdd10@citrix.com> Date: Mon, 9 Sep 2019 00:37:12 +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: <1695c88d-e5ad-1854-cdef-3cd95c812574@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 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. >> b) given (a) we cannot do it ourselves before acpi_init and after is too >> late as we're already past ACPI PCI enumeration >> c) we'd have to do it in the same place I call xen_mcfg_late() and it'd >> be code duplication of what's already done by the existing code. > > > If we manage to parse MCFG ourselves early then maybe we won't not need > xen_mcfg_late()? We can call PHYSDEVOP_pci_mmcfg_reserved right away. Again, this cannot be done untile acpi_init finishes basic setup to parse DSDT. Igor