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

Re: [PATCH v2 3/3] xen/pci: add discovered PCI device at boot


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Mykyta Poturai <Mykyta_Poturai@xxxxxxxx>
  • Date: Fri, 22 Aug 2025 08:03:43 +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=NNowHo/RDLQ8SBwcreAsJpQx+L5ucmWWOrnyLUe/zak=; b=LQnLGDWN/6idOH5r2tZVE+27c31qyIJiMXTf7YCIZfzRMidrgRy0wtmkaknlYv+OEWutLfbfpXoGBL3y7Elc4Fu+mb6V1ORgjNYzSXfYIsP+fYhhakzqBLFJSXK+NpIFOOOaQJXlxCrcU1lyI1/AmAuUzZiYx5xDoV+Wz2j8oMFDbLb9LYR/Nzs4hrodmXP9760DIfO68hI/OeWVY0uFjNYuwZghHpuYL+6y7AWcQfeF8IoTUm81Hsceps1Vr8copGpeDsxuFxpKr3I8MjGt9vnaHz3FuWV3eBvtkc8bt8jLd07f+5IFgmb9+VoTnxDPTWV4qP+OLQOJ7JZJi9Ge7A==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=sdbddw1yvqvbRec0kJdg+RPt6RPu55ytABd5RjEU1W52d3olHc7nadf+0e/YpzLO6SnGKh/AykWv66+eCwXxbtCCMIKK7WcXpT3HSGrOop4OmfYdH0kul6yZMGJX5mR8pL95kDrnSzpqGyR/FmMmrHB1zUVnNMcRK1aZB+bfGYNsMjiU6f38tgWZ0SKh6Q4EHVQ3T/TZ01INM9VIyOCdPKncGUjGb682ZrU3/uoQX/KxbCbm1ZzGAM9TkUVUN1ictnsblRKRVf4tScpfuIm67Rr6XFkuJ/+U8SUOFjhDSAToolGCs7h0hWJOA+NfX+M/J4dJG5/iZ7EeZE4WjX548Q==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=epam.com;
  • Cc: Luca Fancellu <luca.fancellu@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, "Daniel P. Smith" <dpsmith@xxxxxxxxxxxxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Fri, 22 Aug 2025 08:04:21 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHcEc3mKXITpUZcl0ea3L2+fX5U/bRs0pmAgAGAWAA=
  • Thread-topic: [PATCH v2 3/3] xen/pci: add discovered PCI device at boot

On 21.08.25 12:08, Jan Beulich wrote:
> On 20.08.2025 14:28, Mykyta Poturai wrote:
>> From: Luca Fancellu <luca.fancellu@xxxxxxx>
>>
>> In dom0less mode, there is no dom0 that can call PCI physdev ops to
>> register PCI devices to iommu, so it needs to be done by Xen.
>> pci_add_device requires some default domain, we don't have hwdom, and
>> the guests are not yet created during the PCI init phase, so use dom_io
>> as a temporary sentinel before devices are assigned to their target
>> domains.
>>
>> Rename setup_hwdom_pci_devices to setup_pci_devices and add dom0less
>> handling to it.
>>
>> In pci_add_device there is a call to xsm that doesn't consider the
>> requester of the function to be Xen itself, so add a check to skip
>> the call if the owner domain is dom_io, since it means the call is
>> coming directly from Xen.
>>
>> Signed-off-by: Luca Fancellu <luca.fancellu@xxxxxxx>
>> Signed-off-by: Mykyta Poturai <mykyta_poturai@xxxxxxxx>
>> ---
>> (cherry picked from commit eff51e50021b75f5a50533f7de681b2ce044f5bd from
>>   the downstream branch poc/pci-passthrough from
>>   https://gitlab.com/xen-project/people/bmarquis/xen-arm-poc.git
>>
>> v1->v2:
>> * integrate add_discovered_pci_devices into existing routines
>> * better explain the need for dom_io
> 
> What I continue to miss is an explanation of why devices can't go to their
> ultimate "destination" domain right away (once those have been created),
> i.e. why the dom_io intermediary is necessary in the first place.
> 
> Jan

I've done some testing and indeed everything seems to work if we call 
pci_add_device directly during domain construction instead of 
reassigning them. Do you think this would be a better approach? If so 
then I guess this series needs to be dropped, and I will prepare a new 
one with direct device assignment to DomUs.

-- 
Mykyta

 


Rackspace

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