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

Re: [RFC KERNEL PATCH v4 3/3] PCI/sysfs: Add gsi sysfs for pci_dev


  • To: Bjorn Helgaas <bhelgaas@xxxxxxxxxx>, "linux-pci@xxxxxxxxxxxxxxx" <linux-pci@xxxxxxxxxxxxxxx>
  • From: "Chen, Jiqian" <Jiqian.Chen@xxxxxxx>
  • Date: Mon, 22 Jan 2024 06:36:07 +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=hdzwDsk14qB6pL+Ld3c8GFeYAxqZWeAzUBmUl9/QhUM=; b=CeFv5Yoyal/zmg2StmQCMYCsVtOf+S7DpvM/zF8g6RnOctIf0wc/bbvFNG6xYL+cbCopD75Byn6s+exYta4F9we2eaO19zfB//yowJm/2GyyM4VHKtrchKvIqtPXk3eRqQU9hNeHtsn3S2tE+e3ClNbVKNwTU6JIKF7U/U5tuoZfhaGByXIUHU/Cr89xCBZZNtEuBVRETwpqoBB7Ciihj93teyAJ0MNaC9458kd+ucaJR0vxPGMdqTWy5N/nrXbNk44GlQToxFSkukyQHU1pNLxPZ+3Qc28ZS3cJQp2Uv7dRpVUQ0zFWqFmXywT+13nRJVYA1f/om6+dhiQJYNS41g==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=S5DBsruXseLpU3zdRyLwerkzt9oJBnMDkFyWLO7s3D6DoOAaGN4X1HM3khozq7xDjVMHSxYQApfvyUZ5F2XGHqMzHdJWUJHxl590jOsAfCF2k/23FNBCWy+YKRmcWkIujuyrcjqE04ca6NL0/JKzOktglsTvxltvxc0+w7VMUHRgccmPpZ9TPslPD0whqe85ateAcbbhBobq8CiPuGgrbunY/wldj+UkHSKQa7NvD3Ga4Eb7uZqI/gzzyFFycBEleSSb1Sypc0GVZ6Tvp7ajcoIcBa0SHeFTfjw1/Z3/+LCIaVGOtekyb4LnPbDf3yTt3OuTqWowu3lLnUUMy5xR+A==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com;
  • Cc: "Rafael J . Wysocki" <rafael@xxxxxxxxxx>, Len Brown <lenb@xxxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Oleksandr Tyshchenko <oleksandr_tyshchenko@xxxxxxxx>, Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, "linux-kernel@xxxxxxxxxxxxxxx" <linux-kernel@xxxxxxxxxxxxxxx>, "linux-acpi@xxxxxxxxxxxxxxx" <linux-acpi@xxxxxxxxxxxxxxx>, "Hildebrand, Stewart" <Stewart.Hildebrand@xxxxxxx>, "Huang, Ray" <Ray.Huang@xxxxxxx>, "Chen, Jiqian" <Jiqian.Chen@xxxxxxx>
  • Delivery-date: Mon, 22 Jan 2024 06:36:29 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHaP5+doYjSbLzTtkiUcLxinuNXV7DmALcA
  • Thread-topic: [RFC KERNEL PATCH v4 3/3] PCI/sysfs: Add gsi sysfs for pci_dev

Hi Bjorn Helgaas,

Do you have any comments on this patch?

On 2024/1/5 14:22, Chen, Jiqian wrote:
> There is a need for some scenarios to use gsi sysfs.
> For example, when xen passthrough a device to dumU, it will
> use gsi to map pirq, but currently userspace can't get gsi
> number.
> So, add gsi sysfs for that and for other potential scenarios.
> 
> Co-developed-by: Huang Rui <ray.huang@xxxxxxx>
> Signed-off-by: Jiqian Chen <Jiqian.Chen@xxxxxxx>
> ---
>  drivers/acpi/pci_irq.c  |  1 +
>  drivers/pci/pci-sysfs.c | 11 +++++++++++
>  include/linux/pci.h     |  2 ++
>  3 files changed, 14 insertions(+)
> 
> diff --git a/drivers/acpi/pci_irq.c b/drivers/acpi/pci_irq.c
> index 630fe0a34bc6..739a58755df2 100644
> --- a/drivers/acpi/pci_irq.c
> +++ b/drivers/acpi/pci_irq.c
> @@ -449,6 +449,7 @@ int acpi_pci_irq_enable(struct pci_dev *dev)
>               kfree(entry);
>               return 0;
>       }
> +     dev->gsi = gsi;
>  
>       rc = acpi_register_gsi(&dev->dev, gsi, triggering, polarity);
>       if (rc < 0) {
> diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
> index 2321fdfefd7d..c51df88d079e 100644
> --- a/drivers/pci/pci-sysfs.c
> +++ b/drivers/pci/pci-sysfs.c
> @@ -71,6 +71,16 @@ static ssize_t irq_show(struct device *dev,
>  }
>  static DEVICE_ATTR_RO(irq);
>  
> +static ssize_t gsi_show(struct device *dev,
> +                     struct device_attribute *attr,
> +                     char *buf)
> +{
> +     struct pci_dev *pdev = to_pci_dev(dev);
> +
> +     return sysfs_emit(buf, "%u\n", pdev->gsi);
> +}
> +static DEVICE_ATTR_RO(gsi);
> +
>  static ssize_t broken_parity_status_show(struct device *dev,
>                                        struct device_attribute *attr,
>                                        char *buf)
> @@ -596,6 +606,7 @@ static struct attribute *pci_dev_attrs[] = {
>       &dev_attr_revision.attr,
>       &dev_attr_class.attr,
>       &dev_attr_irq.attr,
> +     &dev_attr_gsi.attr,
>       &dev_attr_local_cpus.attr,
>       &dev_attr_local_cpulist.attr,
>       &dev_attr_modalias.attr,
> diff --git a/include/linux/pci.h b/include/linux/pci.h
> index dea043bc1e38..0618d4a87a50 100644
> --- a/include/linux/pci.h
> +++ b/include/linux/pci.h
> @@ -529,6 +529,8 @@ struct pci_dev {
>  
>       /* These methods index pci_reset_fn_methods[] */
>       u8 reset_methods[PCI_NUM_RESET_METHODS]; /* In priority order */
> +
> +     unsigned int    gsi;
>  };
>  
>  static inline struct pci_dev *pci_physfn(struct pci_dev *dev)

-- 
Best regards,
Jiqian Chen.

 


Rackspace

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