linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Bjorn Helgaas <bhelgaas@google.com>
To: Bharat Bhushan <r65777@freescale.com>
Cc: agraf@suse.de, joro@8bytes.org, linux-kernel@vger.kernel.org,
	iommu@lists.linux-foundation.org,
	Bharat Bhushan <Bharat.Bhushan@freescale.com>,
	alex.williamson@redhat.com, linux-pci@vger.kernel.org,
	scottwood@freescale.com, linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH 1/7] powerpc: Add interface to get msi region information
Date: Tue, 24 Sep 2013 17:58:12 -0600	[thread overview]
Message-ID: <20130924235812.GD9302@google.com> (raw)
In-Reply-To: <1379575763-2091-2-git-send-email-Bharat.Bhushan@freescale.com>

On Thu, Sep 19, 2013 at 12:59:17PM +0530, Bharat Bhushan wrote:
> This patch adds interface to get following information
>   - Number of MSI regions (which is number of MSI banks for powerpc).
>   - Get the region address range: Physical page which have the
>      address/addresses used for generating MSI interrupt
>      and size of the page.
> 
> These are required to create IOMMU (Freescale PAMU) mapping for
> devices which are directly assigned using VFIO.
> 
> Signed-off-by: Bharat Bhushan <bharat.bhushan@freescale.com>
> ---
>  arch/powerpc/include/asm/machdep.h |    8 +++++++
>  arch/powerpc/include/asm/pci.h     |    2 +
>  arch/powerpc/kernel/msi.c          |   18 ++++++++++++++++
>  arch/powerpc/sysdev/fsl_msi.c      |   39 +++++++++++++++++++++++++++++++++--
>  arch/powerpc/sysdev/fsl_msi.h      |   11 ++++++++-
>  drivers/pci/msi.c                  |   26 ++++++++++++++++++++++++
>  include/linux/msi.h                |    8 +++++++
>  include/linux/pci.h                |   13 ++++++++++++
>  8 files changed, 120 insertions(+), 5 deletions(-)
> 
> ...

> diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
> index aca7578..6d85c15 100644
> --- a/drivers/pci/msi.c
> +++ b/drivers/pci/msi.c
> @@ -30,6 +30,20 @@ static int pci_msi_enable = 1;
>  
>  /* Arch hooks */
>  
> +#ifndef arch_msi_get_region_count
> +int arch_msi_get_region_count(void)
> +{
> +	return 0;
> +}
> +#endif
> +
> +#ifndef arch_msi_get_region
> +int arch_msi_get_region(int region_num, struct msi_region *region)
> +{
> +	return 0;
> +}
> +#endif

This #define strategy is gone; see 4287d824 ("PCI: use weak functions for
MSI arch-specific functions").  Please use the weak function strategy
for your new MSI region functions.

> +
>  #ifndef arch_msi_check_device
>  int arch_msi_check_device(struct pci_dev *dev, int nvec, int type)
>  {
> @@ -903,6 +917,18 @@ void pci_disable_msi(struct pci_dev *dev)
>  }
>  EXPORT_SYMBOL(pci_disable_msi);
>  
> +int msi_get_region_count(void)
> +{
> +	return arch_msi_get_region_count();
> +}
> +EXPORT_SYMBOL(msi_get_region_count);
> +
> +int msi_get_region(int region_num, struct msi_region *region)
> +{
> +	return arch_msi_get_region(region_num, region);
> +}
> +EXPORT_SYMBOL(msi_get_region);

Please split these interface additions, i.e., the drivers/pci/msi.c,
include/linux/msi.h, and include/linux/pci.h changes, into a separate
patch.

I don't know enough about VFIO to understand why these new interfaces
are needed.  Is this the first VFIO IOMMU driver?  I see
vfio_iommu_spapr_tce.c and vfio_iommu_type1.c but I don't know if
they're comparable to the Freescale PAMU.  Do other VFIO IOMMU
implementations support MSI?  If so, do they handle the problem of
mapping the MSI regions in a different way?

>  /**
>   * pci_msix_table_size - return the number of device's MSI-X table entries
>   * @dev: pointer to the pci_dev data structure of MSI-X device function
> diff --git a/include/linux/msi.h b/include/linux/msi.h
> index ee66f3a..ae32601 100644
> --- a/include/linux/msi.h
> +++ b/include/linux/msi.h
> @@ -50,6 +50,12 @@ struct msi_desc {
>  	struct kobject kobj;
>  };
>  
> +struct msi_region {
> +	int region_num;
> +	dma_addr_t addr;
> +	size_t size;
> +};

This needs some sort of explanatory comment.

>  /*
>   * The arch hook for setup up msi irqs
>   */
> @@ -58,5 +64,7 @@ void arch_teardown_msi_irq(unsigned int irq);
>  int arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type);
>  void arch_teardown_msi_irqs(struct pci_dev *dev);
>  int arch_msi_check_device(struct pci_dev* dev, int nvec, int type);
> +int arch_msi_get_region_count(void);
> +int arch_msi_get_region(int region_num, struct msi_region *region);
>  
>  #endif /* LINUX_MSI_H */
> diff --git a/include/linux/pci.h b/include/linux/pci.h
> index 186540d..2b26a59 100644
> --- a/include/linux/pci.h
> +++ b/include/linux/pci.h
> @@ -1126,6 +1126,7 @@ struct msix_entry {
>  	u16	entry;	/* driver uses to specify entry, OS writes */
>  };
>  
> +struct msi_region;
>  
>  #ifndef CONFIG_PCI_MSI
>  static inline int pci_enable_msi_block(struct pci_dev *dev, unsigned int nvec)
> @@ -1168,6 +1169,16 @@ static inline int pci_msi_enabled(void)
>  {
>  	return 0;
>  }
> +
> +static inline int msi_get_region_count(void)
> +{
> +	return 0;
> +}
> +
> +static inline int msi_get_region(int region_num, struct msi_region *region)
> +{
> +	return 0;
> +}
>  #else
>  int pci_enable_msi_block(struct pci_dev *dev, unsigned int nvec);
>  int pci_enable_msi_block_auto(struct pci_dev *dev, unsigned int *maxvec);
> @@ -1180,6 +1191,8 @@ void pci_disable_msix(struct pci_dev *dev);
>  void msi_remove_pci_irq_vectors(struct pci_dev *dev);
>  void pci_restore_msi_state(struct pci_dev *dev);
>  int pci_msi_enabled(void);
> +int msi_get_region_count(void);
> +int msi_get_region(int region_num, struct msi_region *region);
>  #endif
>  
>  #ifdef CONFIG_PCIEPORTBUS
> -- 
> 1.7.0.4
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pci" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2013-09-24 23:58 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-19  7:29 [PATCH 0/7] vfio-pci: add support for Freescale IOMMU (PAMU) Bharat Bhushan
2013-09-19  7:29 ` [PATCH 1/7] powerpc: Add interface to get msi region information Bharat Bhushan
2013-09-24 23:58   ` Bjorn Helgaas [this message]
2013-10-04  5:19     ` Bhushan Bharat-R65777
2013-10-08 16:47       ` Bjorn Helgaas
2013-10-08 17:02         ` joro
2013-10-08 17:09           ` Bhushan Bharat-R65777
2013-10-10 21:13             ` Sethi Varun-B16395
2013-10-08 17:09         ` Scott Wood
2013-10-08 22:57   ` Scott Wood
2013-10-08 23:25     ` Bjorn Helgaas
2013-10-08 23:35       ` Scott Wood
2013-10-09  4:47     ` Bhushan Bharat-R65777
2013-09-19  7:29 ` [PATCH 2/7] iommu: add api to get iommu_domain of a device Bharat Bhushan
2013-09-25 16:45   ` Alex Williamson
2013-10-04  9:54     ` Bhushan Bharat-R65777
2013-10-04 15:45       ` Alex Williamson
2013-10-04 16:47         ` Bhushan Bharat-R65777
2013-10-04 17:12           ` Alex Williamson
2013-10-04 17:23             ` Bhushan Bharat-R65777
2013-10-04 18:12               ` Alex Williamson
2013-10-07  5:46                 ` Bhushan Bharat-R65777
2013-10-08  3:13                   ` Alex Williamson
2013-10-08  3:42                     ` Bhushan Bharat-R65777
2013-10-10 20:09                     ` Sethi Varun-B16395
2013-10-10 20:41                       ` Alex Williamson
2013-10-14 12:58                         ` Sethi Varun-B16395
2013-10-14 14:20                           ` Alex Williamson
2013-10-04 10:42     ` Bhushan Bharat-R65777
2013-09-19  7:29 ` [PATCH 3/7] fsl iommu: add get_dev_iommu_domain Bharat Bhushan
2013-09-19  7:29 ` [PATCH 4/7] powerpc: translate msi addr to iova if iommu is in use Bharat Bhushan
2013-09-19  7:29 ` [PATCH 5/7] iommu: supress loff_t compilation error on powerpc Bharat Bhushan
2013-09-25 16:40   ` Alex Williamson
2013-09-26  3:53     ` Bhushan Bharat-R65777
2013-09-26 22:20       ` Scott Wood
2013-09-19  7:29 ` [PATCH 6/7] vfio: moving some functions in common file Bharat Bhushan
2013-09-25 17:02   ` Alex Williamson
2013-09-26  3:57     ` Bhushan Bharat-R65777
2013-09-19  7:29 ` [PATCH 7/7] vfio pci: Add vfio iommu implementation for FSL_PAMU Bharat Bhushan
2013-09-25 19:06   ` Alex Williamson
2013-09-26  5:27     ` Bhushan Bharat-R65777

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130924235812.GD9302@google.com \
    --to=bhelgaas@google.com \
    --cc=Bharat.Bhushan@freescale.com \
    --cc=agraf@suse.de \
    --cc=alex.williamson@redhat.com \
    --cc=iommu@lists.linux-foundation.org \
    --cc=joro@8bytes.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=r65777@freescale.com \
    --cc=scottwood@freescale.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).