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

Re: [RFC XEN PATCH v2 3/3] tools: Add new function to get gsi from irq


  • To: Roger Pau Monné <roger.pau@xxxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>
  • From: "Chen, Jiqian" <Jiqian.Chen@xxxxxxx>
  • Date: Thu, 30 Nov 2023 06:57:12 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.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=saCOegEOwLC+inAkfamsQ/cbBDf5/mbcumTDtjD4vr4=; b=EC3i0ABj6ih/huH6tjWioOieSrDu2iQACs1gEE+Fw1NRiESiodi6elcoLElmWAh0lw7U12A2OyoOJhZ2BrJZkfG36jCFVB9ax+fvSuic9jWaqQh6G2/Z24s9IdMJkLJ+SiOi8yaXnThX/j8GmQUxBZdQXZpi/D+a5OVVsvCygAvb/d07rBwkH5lTauH5n1DwMlr+z9nQ3/zAg3jqdMn9CH7irWRZVbsPAzQ9cDf1n632DpYhw747D+1EdrywYMxyY919aQPNco4X2JmO8D0YiJBEKr54Stvt0gIs5AQ9vqCxhTDUiiK3DhpvyWTksO++YyAkPZbxiNYnmw8xuymLLg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iH7V33AbmL8wztgAEG7Ylj+4kAkYhNEuqneuZ+AeWaERuxygW/eWlZH79kLZkPV0zothc2Wtg3LRWNS2XfZ/B2O1teOKDhYB/bWnpnJLoWRjS25z1TScbCwHvCgIh+ti7UVUHul/h0rjypb51dyG+rmy1bTZcfesPMXK6cdrZxXkOCmcmYkpQEVffy6zQJJ8ckL3PKJ4EEnzkcjtUZR/JbyDNsPyJUOyPfUS7dE+kAX5uF60j/fcRvyZKYE1ULNzD8vGYJO2vyjQ5tiCI8jjVwYpFNoXEnlT3/LEYvDoFKAehtQRGWgvwDGzOkL6S61xhTZmdJgsWvUvzb4JvBd0YQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com;
  • Cc: "Chen, Jiqian" <Jiqian.Chen@xxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Wei Liu <wl@xxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, "Hildebrand, Stewart" <Stewart.Hildebrand@xxxxxxx>, "Deucher, Alexander" <Alexander.Deucher@xxxxxxx>, "Ragiadakou, Xenia" <Xenia.Ragiadakou@xxxxxxx>, "Stabellini, Stefano" <stefano.stabellini@xxxxxxx>, "Huang, Ray" <Ray.Huang@xxxxxxx>, "Huang, Honglei1" <Honglei1.Huang@xxxxxxx>, "Zhang, Julia" <Julia.Zhang@xxxxxxx>
  • Delivery-date: Thu, 30 Nov 2023 06:57:22 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHaHsLpM7vOINXdREip1dGZpT1r3bCPz92AgAAE2ICAABjFAIADD7UA
  • Thread-topic: [RFC XEN PATCH v2 3/3] tools: Add new function to get gsi from irq

On 2023/11/29 00:11, Roger Pau Monné wrote:
> On Tue, Nov 28, 2023 at 03:42:31PM +0100, Juergen Gross wrote:
>> On 28.11.23 15:25, Roger Pau Monné wrote:
>>> On Fri, Nov 24, 2023 at 06:41:36PM +0800, Jiqian Chen wrote:
>>>> In PVH dom0, it uses the linux local interrupt mechanism,
>>>> when it allocs irq for a gsi, it is dynamic, and follow
>>>> the principle of applying first, distributing first. And
>>>> if you debug the kernel codes, you will find the irq
>>>> number is alloced from small to large, but the applying
>>>> gsi number is not, may gsi 38 comes before gsi 28, that
>>>> causes the irq number is not equal with the gsi number.
>>>> And when we passthrough a device, QEMU will use its gsi
>>>> number to do mapping actions, see xen_pt_realize->
>>>> xc_physdev_map_pirq, but the gsi number is got from file
>>>> /sys/bus/pci/devices/xxxx:xx:xx.x/irq in current code,
>>>> so it will fail when mapping.
>>>> And in current codes, there is no method to translate
>>>> irq to gsi for userspace.
>>>
>>> I think it would be cleaner to just introduce a new sysfs node that
>>> contains the gsi if a device is using one (much like the irq sysfs
>>> node)?
>>>
>>> Such ioctl to translate from IRQ to GSI has nothing to do with Xen, so
>>> placing it in privcmd does seem quite strange to me.  I understand
>>> that for passthrough we need the GSI, but such translation layer from
>>> IRQ to GSI is all Linux internal, and it would be much simpler to just
>>> expose the GSI in sysfs IMO.
>>
>> You are aware that we have a Xen specific variant of acpi_register_gsi()?
>>
>> It is the Xen event channel driver being responsible for the GSI<->IRQ
>> mapping.
> 
> I'm kind of lost, this translation function is specifically needed for
> PVH which doesn't use the Xen specific variant of acpi_register_gsi(),
> and hence the IRQ <-> GSI relation is whatever the Linux kernel does
> on native.
> 
> I do understand that on a PV dom0 the proposed sysfs gsi node would
> match the irq node, but that doesn't seem like an issue to me.
> 
> Note also that PVH doesn't use acpi_register_gsi_xen_hvm() because
> XENFEAT_hvm_pirqs feature is not exposed to PVH, so I expect it uses
> the x86 acpi_register_gsi_ioapic().
Yes, PVH use acpi_register_gsi_ioapic, thank Roger for explanation.

> 
> Thanks, Roger.

-- 
Best regards,
Jiqian Chen.

 


Rackspace

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