[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v8 4/4] xen/arm: do not map PCI ECAM and MMIO space to Domain-0's p2m


  • To: Oleksandr Andrushchenko <andr2000@xxxxxxxxx>
  • From: Rahul Singh <Rahul.Singh@xxxxxxx>
  • Date: Thu, 9 Dec 2021 10:19:55 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=WXN8hJWdCy0TM2M9Ap9xBzUjFeqpvMZ2r4ODIIAjWOk=; b=m1k/czAmQun2G6TVzDyQqdVc4IbIopQ9GOgVAby2SF7iWNPGHG+en6h0IlxfmEISMlf5m3CjNeyqgtmqkNFdhdPrP0Km8qbHes1tqwVGnmfMxIbKZAjWW95O+4qjoEspcdqxydIkQWH3GBz8X+lbA72rgs0kbwxtyWBhFx0Dk7+/cTmq1bfziggtOhw8QD059/WKHlFmSCDAoI211LmQzyrzVf4gP7AM0EptUR/PGwNodj4SFiD66HKQ6Fo6QIiM0ufxw3qbxeGSTMsLQswdElbQxhofAycosE+DA3OBcvn5pDJpNrKTLZSbRIuBLpdUebBomoLKI4k7fbM25uwOVw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=brtuJCtZE6sUyelrBFQQDnaf1u2SQuMrgo3N3QoWjZvAWWfJapIPDVuLRCYurLv7gyoNwpsSxSplo1jvKQQW/2u33oc3sBO9fWgd3+8Hiih4zyxrFxW4RPWwspCfGXcdUv3C38vPogjklS/K7KuppM1NqFUa+GW+fPw2GQA+7pdX99HZz6N1++zvFxGLwH6vWt4Gc31K+0BjFcOttEQZLMbzmOF0WWTSRb8k57NgkvUhOghQwi4oB7c1XISfA59aGF18UqH6st/ma98qxV8JIWCWvPnDTdexvFr7rfzGJGX+QBEkk5GpalCh5sO3gApPqZHB3LoqLur6E2S7dEIUwA==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, "oleksandr_tyshchenko@xxxxxxxx" <oleksandr_tyshchenko@xxxxxxxx>, "volodymyr_babchuk@xxxxxxxx" <volodymyr_babchuk@xxxxxxxx>, "artem_mygaiev@xxxxxxxx" <artem_mygaiev@xxxxxxxx>, Bertrand Marquis <Bertrand.Marquis@xxxxxxx>, Oleksandr Andrushchenko <oleksandr_andrushchenko@xxxxxxxx>, Julien Grall <jgrall@xxxxxxxxxx>
  • Delivery-date: Thu, 09 Dec 2021 10:20:43 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Thread-index: AQHX7M6EjMHseeuB70ePU8gARpHGAqwp8wGA
  • Thread-topic: [PATCH v8 4/4] xen/arm: do not map PCI ECAM and MMIO space to Domain-0's p2m

Hi Oleksandr,

> On 9 Dec 2021, at 7:29 am, Oleksandr Andrushchenko <andr2000@xxxxxxxxx> wrote:
> 
> From: Oleksandr Andrushchenko <oleksandr_andrushchenko@xxxxxxxx>
> 
> PCI host bridges are special devices in terms of implementing PCI
> passthrough. According to [1] the current implementation depends on
> Domain-0 to perform the initialization of the relevant PCI host
> bridge hardware and perform PCI device enumeration. In order to
> achieve that one of the required changes is to not map all the memory
> ranges in map_range_to_domain as we traverse the device tree on startup
> and perform some additional checks if the range needs to be mapped to
> Domain-0.
> 
> The generic PCI host controller device tree binding says [2]:
> - ranges: As described in IEEE Std 1275-1994, but must provide
>          at least a definition of non-prefetchable memory. One
>          or both of prefetchable Memory and IO Space may also
>          be provided.
> 
> - reg   : The Configuration Space base address and size, as accessed
>          from the parent bus.  The base address corresponds to
>          the first bus in the "bus-range" property.  If no
>          "bus-range" is specified, this will be bus 0 (the default).
> 
> From the above none of the memory ranges from the "ranges" property
> needs to be mapped to Domain-0 at startup as MMIO mapping is going to
> be handled dynamically by vPCI as we assign PCI devices, e.g. each
> device assigned to Domain-0/guest will have its MMIOs mapped/unmapped
> as needed by Xen.
> 
> The "reg" property covers not only ECAM space, but may also have other
> then the configuration memory ranges described, for example [3]:
> - reg: Should contain rc_dbi, config registers location and length.
> - reg-names: Must include the following entries:
>   "rc_dbi": controller configuration registers;
>   "config": PCIe configuration space registers.
> 
> This patch makes it possible to not map all the ranges from the
> "ranges" property and also ECAM from the "reg". All the rest from the
> "reg" property still needs to be mapped to Domain-0, so the PCI
> host bridge remains functional in Domain-0. This is done by first
> skipping the mappings while traversing the device tree as it is done for
> usual devices and then by calling a dedicated pci_host_bridge_mappings
> function which only maps MMIOs required by the host bridges leaving the
> regions, needed for vPCI traps, unmapped.
> 
> [1] https://lists.xenproject.org/archives/html/xen-devel/2020-07/msg00777.html
> [2] 
> https://www.kernel.org/doc/Documentation/devicetree/bindings/pci/host-generic-pci.txt
> [3] 
> https://www.kernel.org/doc/Documentation/devicetree/bindings/pci/hisilicon-pcie.txt
> 
> Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@xxxxxxxx>
> Reviewed-by: Julien Grall <jgrall@xxxxxxxxxx>

Reviewed-by: Rahul Singh <rahul.singh@xxxxxxx>
Tested-by: Rahul Singh <rahul.singh@xxxxxxx>

Regards,
Rahul
 


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.