[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>
- From: "Chen, Jiqian" <Jiqian.Chen@xxxxxxx>
- Date: Thu, 30 Nov 2023 06:53:30 +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=EezSsxZ4tkCfJItiT+9LHeMa823D64eMgN+lr9hpYv8=; b=RWXBGMqZjxjiPjGfHGhA98NfQJpu2QF25cvnF+ykB7YLBLlz7skmYQwpjStdRGgP2GLjm54+j73W7Bej0UonlxK6T5pajsvOeLyi7STOMqEii/uyrH3C/6iPDSzsZiwE8biwHArvl2EUhN3hH7zEWrqSBmDXIWR4ZgWppB2HYk/5mMYGEX3jgRlgNEUCplh96hDkergdSVA8BP15ltGufGLJdfFwjyqiIKWd5KTLZi/4wZoqWisG7mItQulyEIl8GBBoiCnrA478qbe0ImlNRjvAv65p1w7q6aH2TemrHFiB4MNSJ2YoKeuVLT0P+53rcDAk729j2ZyJQUknCtDxhA==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bIcyoE3EWVgD3WEtNNkfqkiOMNwbjSkNz+AyV6khZJpER0U0e34aE8yNEY21uDitDbj44bBGb6+ebGZFGsax6p+LCdMWSAE3WkJjdtEvsWAeFUMkGq5oTTpYC0i8Xr3/QgjXcwUSRDN4MdWPd9uu3kojrFBHcsjRFky3iNYCkCt8HY5dKtWu+0vmTxurH+2K/QKKZvCc/y2nN297g5WgPSGOikoGYokMqFeYtHqjfZUL3JxEwJzCs8wHNn0pfsWJ8NeTgqZ6IYtMSzZpxvNtk9aHOfSYubKPIH5nVJBeXOw7bIx1KkTH67IqMAU5JJZszmKs7gizGD4Ryw/KxaaN9w==
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com;
- Cc: Jan Beulich <jbeulich@xxxxxxxx>, Wei Liu <wl@xxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, 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>, "Chen, Jiqian" <Jiqian.Chen@xxxxxxx>
- Delivery-date: Thu, 30 Nov 2023 06:53:42 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
- Thread-index: AQHaHsLpM7vOINXdREip1dGZpT1r3bCPz92AgAMqIAA=
- Thread-topic: [RFC XEN PATCH v2 3/3] tools: Add new function to get gsi from irq
On 2023/11/28 22: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)?
Yes, I also ever thought this way. Add a sysfs node in
/sys/bus/pci/devices/xxxx:xx:xx.x/gsi.
But I am not sure sysfs or privcmd, which is better.
If use sysfs node, should I need to use the macro of Xen to wrap the codes? And
is it suitable to create it in function acpi_register_gsi_ioapic?
>
> 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.
>
> Thanks, Roger.
--
Best regards,
Jiqian Chen.
|