Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp2823155ybe; Sun, 8 Sep 2019 01:23:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqzZsFVFiG0Ay20sxY+zAULn52icq72Ompzj8J+sTORYZgRhTgXTCAgt3ZlQOhK6wLU+pgyW X-Received: by 2002:a62:3083:: with SMTP id w125mr21142787pfw.102.1567930980397; Sun, 08 Sep 2019 01:23:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567930980; cv=none; d=google.com; s=arc-20160816; b=LfKacQB7RaSMcbTwO8kx6R00MykyiPKCS4OqRum3DBhje/6jxb34vMrstJfXtGYucp lVXJOXxGMopIw3Y1zf3w1ZE3ZtPhkdVKHpeBwKPaBR17MF0U3c//nsMD6yYBOWo2/8Gq g+h5fybF1T0WQzF3OcI6N2TlTagu5BCyqmElHYLMZLOvGHD3TmhQKI/5OgwirzjMoCLB nMP+fNxX2p1aqnIx1IG/7q6LHGV4jjqzJOuvgp1hinaNrfTeYjmy5o8BxESq7WCQERP2 HF9I9bKgwayojt1rm8lqzj9/I2n3p/kDZdQNtKsenEcg3AZwY8gpEPI4GGCJmHkZ1l0y /x0g== 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=C1L58jWts/nop057a4ihmHaEYMMxDV3cFzIFb1hRkVY=; b=rvpkETIrTRsnOwbs7gouSVRCnli4Hjci0dhW52ZPgOrNEb/vydPpHezLTfC7qdZFVP 3MGleA/92IAu5leWvqEcR2hf50N5fJw9FGtEpaEOqCNSszcvk3NLxsCIYzB7daRKmGuj jRwY4qMQWueGCN5Kt0AYCfM5okrCp9j9wxaFnR7u+5JH57wL9HhZDjyWWVxoU7TfjeYA br2aurIxho4jZNvM9gkayeb9LbDlgypyJFFuXYoz4Os9yvE2TVDUiBtsWVocsKmvrlAg G8qlTwD7f5andNeKcRpILU6d1xINZ5IreBa23aPNplPsI9Hyo8rY1gU5XqXtdwz0eKKM pzjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@citrix.com header.s=securemail header.b=ABcmNdnf; 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 a4si9799003plm.377.2019.09.08.01.22.45; Sun, 08 Sep 2019 01:23:00 -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=ABcmNdnf; 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 S2392630AbfIFXC0 (ORCPT + 99 others); Fri, 6 Sep 2019 19:02:26 -0400 Received: from esa3.hc3370-68.iphmx.com ([216.71.145.155]:52996 "EHLO esa3.hc3370-68.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2392182AbfIFXC0 (ORCPT ); Fri, 6 Sep 2019 19:02:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1567810944; h=subject:to:cc:references:from:message-id:date: mime-version:in-reply-to:content-transfer-encoding; bh=dpPsk8LE83368fkJgEcOsXssOy2FoPlssTTZn0BFLZY=; b=ABcmNdnfZj5F3awRBT4ElXugV/R4FAhj9Y5NMbAwDP8QFMcbfVT8QoCG 5ii7BByOHE/QFBuEuws6g2tn8JWy/0BQxxmf509uDENhhpwty7vWqv3DP Yc0s5yanL0PP9qGomas689QvLoi3HyvmKBV34Xu83D+zzQVMDPJgnhzL4 w=; 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: T/9zojaCofQTVlg9JytA1HFg6m2EOIp6isp71QNFOWodT3M/pxCZDFS6Tp7lRml6yh9gRo2kio k4m0NoQDKq4gwgl/vh+1lZsUVEdxbh0ykvTE3sxXrqKw8IeRa4vj4u+eAuPXXOqnOd03HFyjme oMU975HElEZIHLolgJex75ZNWkzp3vEu7c6F6MWHfuf8EvN3yzZL2fw+bqaBQuuOUXRimGOswx omBipzSNypUdsO2QvhRuh8Ky9w7+glJ3gnAXM8VxjTLQ0iyvFQraFIUR4PtigIttZLRI4ee31Q 6qM= X-SBRS: 2.7 X-MesageID: 5266131 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,474,1559534400"; d="scan'208";a="5266131" 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> From: Igor Druzhinin Message-ID: Date: Sat, 7 Sep 2019 00:00:24 +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: <5054ad91-5b87-652c-873a-b31758948bd7@oracle.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 06/09/2019 23:30, Boris Ostrovsky wrote: > On 9/3/19 8:20 PM, Igor Druzhinin wrote: >> If MCFG area is not reserved in E820, Xen by default will defer its usage >> until Dom0 registers it explicitly after ACPI parser recognizes it as >> a reserved resource in DSDT. Having it reserved in E820 is not >> mandatory according to "PCI Firmware Specification, rev 3.2" (par. 4.1.2) >> and firmware is free to keep a hole E820 in that place. Xen doesn't know >> what exactly is inside this hole since it lacks full ACPI view of the >> platform therefore it's potentially harmful to access MCFG region >> without additional checks as some machines are known to provide >> inconsistent information on the size of the region. >> >> Now xen_mcfg_late() runs after acpi_init() which is too late as some basic >> PCI enumeration starts exactly there. Trying to register a device prior >> to MCFG reservation causes multiple problems with PCIe extended >> capability initializations in Xen (e.g. SR-IOV VF BAR sizing). There are >> no convenient hooks for us to subscribe to so try to register MCFG >> areas earlier upon the first invocation of xen_add_device(). > > > 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(). Igor