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

Re: [PATCH v4 4/4] xen/arm: add support for R-Car Gen4 PCI host controller


  • To: Stewart Hildebrand <stewart.hildebrand@xxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Mykyta Poturai <Mykyta_Poturai@xxxxxxxx>
  • Date: Tue, 13 May 2025 14:44:13 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epam.com; dmarc=pass action=none header.from=epam.com; dkim=pass header.d=epam.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=XvsUbw6ZWIkiwoWdJV8DBzxgo1doyQWkVTwGoW/fpWo=; b=qs32OIO7yJ1Q1rAstxKtqusE/RWc8kv+132lIK4bWvpGsk54FZ312zkxZSwXiDiBO69YI32saqzV+QjR0GitO2GHNe1NTp8XfyPJ19mmSDfVPZTaizQW0t5KYwjnVofp7HRQhQXzxWGv+Al+Io3/TLgjVE87csNZqyi83LuUvi7+EB2i3bz8m9baQS1zy2cLT9ZZP4B1IjGeYc06uI/J4Amj8yDpnzsyR4YwafyIlnla1JDxuP6GYRXx4aRdlIjoElsp1ujw0oMzq3tZs2EmKLanVY7fCUpiNbkZFdoSBA8UcbdXxmPIfBRTuks3cVr6VkQg5HXsqJUyHdggbPSWHQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=HTvwUvzlv74lvGYoV139le4+snn0Og8kOdo0oOB39TP4vXS2l4BbLerJ6ax4gCXqkcbiuqPq4qc2PhGjpT3+xAPueVa94cmRdihFQFu/dl2+wKwLMcm73GUuxyY055swN8BmzFVxgD3yRkm5apiY5lJvjTRDylNykjPedgkTbTcAI8edkSgSB4Jz3zufhf132AypAXFYqlhDlROO7srejM/HOWLhspBiogGLhO0iNJ3OY4rSJZA7ZzANqXEPk9Eh1Wqd4wAkpsQZicqA2nH4c4PqeCHVfCQJne1fq6Dr7EHmHSJpSyVOTAA3aKxi2EYiT5hu7FTV3lGaYkP8XShNpQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=epam.com;
  • Cc: Oleksandr Andrushchenko <Oleksandr_Andrushchenko@xxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Tue, 13 May 2025 14:44:18 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHbtD/+f1IljlTzAkG+gkmGFEbJELOzM/oAgB2OgoA=
  • Thread-topic: [PATCH v4 4/4] xen/arm: add support for R-Car Gen4 PCI host controller

On 24.04.25 22:22, Stewart Hildebrand wrote:
> On 4/23/25 07:08, Mykyta Poturai wrote:
>> From: Oleksandr Andrushchenko <oleksandr_andrushchenko@xxxxxxxx>
>>
>> Add support for Renesas R-Car Gen4 PCI host controller, specifically
>> targeting the S4 and V4H SoCs. The implementation includes configuration
>> read/write operations for both root and child buses. For accessing the
>> child bus, iATU is used for address translation.
> 
> In a system with dom0, I assume dom0 programs the iATU, and would do so
> before issuing any PHYSDEVOP_pci_device_add hypercalls or PCI config
> space accesses. Is that a correct assumption? If so, what is the use
> case for iATU initialization in Xen? E.g. is it to guard against a
> misconfigured or broken dom0? Do different iATU settings need to be
> applied when running as a Xen guest vs not?

dom0 can program iATU, but for guests, the programming should be done by 
Xen.

> Further, is this driver sufficient to initialize the PCI controller
> without dom0 involvement (e.g. to enable dom0less PCI passthrough)?

In the current state no. We are planning to add support for it in the 
future together with Xen device enumeration but it would also require 
changes to the bootloaders to deal with the initial host controller 
setup (clocks, resets, pincontrol, etc).

> These would all be valid use cases IMO, but I would just like to
> understand the rationale.
> 
> 
> dw_pcie_child_{map_bus,config_read,config_write}, and thus
> dw_pcie_prog_outbound_atu{_unroll}, would potentially be called on every
> guest PCI access, where the d->pci_lock may be held. It doesn't seem
> appropriate to have a busy-wait such as this in that code path.
> 
> If the busy-wait is necessary, then perhaps iATU configuration should
> happen during init/probe (as your FIXME note below suggests), not as a
> consequence of guest PCI access.
> 
> Same comment applies below.
> 
> 
> Does iATU configuration really need to happen on every guest PCI access?

It is possible to implement smarter allocation of iATU windows, but it 
would require at least a full control over the PCI host. For now we are 
doing the same approach as in Linux, of using window 0 for dynamic 
config space access and the rest for static mappings(configured by 
dom0). But overall there will always be a need for some dynamic 
configuration because there can be more devices than free ATU windows.

In practice with all of the hardware we tested on the ATU always 
configured in one pass of the wait loop, and the config space accesses 
are not that frequent so it shouldn't have a big impact on performance.

>> +
>> +    /*
>> +     * FIXME: we cannot read iATU unroll enable now as the host bridge's
>> +     * HW is not yet initialized by Domain-0: leave it for later.
>> +     */
> 
> Is there a plan to address this?
> 

We will need to address this to enable PCI scan by Xen.


-- 
Mykyta

 


Rackspace

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