All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Talel Shenhar <talel@amazon.com>
Cc: nicolas.ferre@microchip.com, jason@lakedaemon.net,
	marc.zyngier@arm.com, mark.rutland@arm.com,
	mchehab+samsung@kernel.org, robh+dt@kernel.org,
	davem@davemloft.net, shawn.lin@rock-chips.com,
	tglx@linutronix.de, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, dwmw@amazon.co.uk,
	benh@kernel.crashing.org, jonnyc@amazon.com, hhhawa@amazon.com,
	ronenk@amazon.com, hanochu@amazon.com, barakw@amazon.com
Subject: Re: [PATCH 3/3] irqchip: al-fic: Introducing support for MSI-X
Date: Wed, 5 Jun 2019 09:59:58 +0200	[thread overview]
Message-ID: <20190605075958.GB9693@kroah.com> (raw)
In-Reply-To: <1559717653-11258-4-git-send-email-talel@amazon.com>

On Wed, Jun 05, 2019 at 09:54:13AM +0300, Talel Shenhar wrote:
> The FIC supports either a (single) wired output, or generation of an MSI-X
> interrupt per input (for cases where it is embedded in a PCIe device,
> hence, allowing the PCIe drivers to call this API).
> This patch introduces the support for allowing the configuration of MSI-X
> instead of a wire interrupt.
> 
> Signed-off-by: Talel Shenhar <talel@amazon.com>
> ---
>  drivers/irqchip/irq-al-fic.c   | 48 +++++++++++++++++++++++++++++++++++++++---
>  include/linux/irqchip/al-fic.h |  2 ++
>  2 files changed, 47 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/irqchip/irq-al-fic.c b/drivers/irqchip/irq-al-fic.c
> index d881d42..e49b912 100644
> --- a/drivers/irqchip/irq-al-fic.c
> +++ b/drivers/irqchip/irq-al-fic.c
> @@ -19,6 +19,7 @@
>  #define AL_FIC_MASK		0x10
>  #define AL_FIC_CONTROL		0x28
>  
> +#define CONTROL_AUTO_CLEAR	BIT(2)
>  #define CONTROL_TRIGGER_RISING	BIT(3)
>  #define CONTROL_MASK_MSI_X	BIT(5)
>  
> @@ -193,9 +194,11 @@ struct irq_domain *al_fic_wire_get_domain(struct al_fic *fic)
>  }
>  EXPORT_SYMBOL_GPL(al_fic_wire_get_domain);
>  
> -static void al_fic_hw_init(struct al_fic *fic)
> +static void al_fic_hw_init(struct al_fic *fic,
> +			   int use_msi)
>  {
> -	u32 control = CONTROL_MASK_MSI_X;
> +	u32 control = (use_msi ? (CONTROL_AUTO_CLEAR | CONTROL_TRIGGER_RISING) :
> +		       CONTROL_MASK_MSI_X);
>  
>  	/* mask out all interrupts */
>  	writel(0xFFFFFFFF, fic->base + AL_FIC_MASK);
> @@ -240,7 +243,7 @@ struct al_fic *al_fic_wire_init(struct device_node *node,
>  	fic->parent_irq = parent_irq;
>  	fic->name = (name ?: "al-fic-wire");
>  
> -	al_fic_hw_init(fic);
> +	al_fic_hw_init(fic, false);
>  
>  	ret = al_fic_register(node, fic);
>  	if (ret) {
> @@ -260,6 +263,45 @@ struct al_fic *al_fic_wire_init(struct device_node *node,
>  EXPORT_SYMBOL_GPL(al_fic_wire_init);
>  
>  /**
> + * al_fic_msi_x_init() - initialize and configure fic in msi-x mode
> + * @base: mmio to fic register
> + * @name: name of the fic
> + *
> + * This API will configure the fic hardware to to work in msi-x mode.
> + * msi-x fic is to be configured for fics that are embedded inside AL PCIE EP.
> + * Those kind of fic are aware of the fact that they live inside PCIE and
> + * familiar with the MSI-X table which is configured as part of
> + * pci_enable_msix_range() and friends.
> + * Interrupt can be generated based on a positive edge or level - configuration
> + * is to be determined based on connected hardware to this fic.
> + *
> + * Returns pointer to fic context or ERR_PTR in case of error.
> + */
> +struct al_fic *al_fic_msi_x_init(void __iomem *base,
> +				 const char *name)
> +{
> +	struct al_fic *fic;
> +
> +	if (!base)
> +		return ERR_PTR(-EINVAL);
> +
> +	fic = kzalloc(sizeof(*fic), GFP_KERNEL);
> +	if (!fic)
> +		return ERR_PTR(-ENOMEM);
> +
> +	fic->base = base;
> +	fic->name = (name ?: "al-fic-full-fledged");
> +
> +	al_fic_hw_init(fic, true);
> +
> +	pr_debug("%s initialized successfully in Full-Fledged mode\n",
> +		 fic->name);
> +
> +	return fic;
> +}
> +EXPORT_SYMBOL_GPL(al_fic_msi_x_init);
> +
> +/**
>   * al_fic_cleanup() - free all resources allocated by fic
>   * @fic: pointer to fic context
>   *
> diff --git a/include/linux/irqchip/al-fic.h b/include/linux/irqchip/al-fic.h
> index 0833749..a2e89ff 100644
> --- a/include/linux/irqchip/al-fic.h
> +++ b/include/linux/irqchip/al-fic.h
> @@ -16,6 +16,8 @@ struct al_fic *al_fic_wire_init(struct device_node *node,
>  				void __iomem *base,
>  				const char *name,
>  				unsigned int parent_irq);
> +struct al_fic *al_fic_msi_x_init(void __iomem *base,
> +				 const char *name);

Who uses this new function?

thanks,

greg k-h

      reply	other threads:[~2019-06-05  8:00 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-05  6:54 [PATCH 0/3] Amazon's Annapurna Labs Fabric Interrupt Controller Talel Shenhar
2019-06-05  6:54 ` Talel Shenhar
2019-06-05  6:54 ` [PATCH 1/3] dt-bindings: interrupt-controller: Amazon's Annapurna Labs FIC Talel Shenhar
2019-06-05  6:54   ` Talel Shenhar
2019-06-05  6:54 ` [PATCH 2/3] irqchip: al-fic: Introduce Amazon's Annapurna Labs Fabric Interrupt Controller Driver Talel Shenhar
2019-06-05  6:54   ` Talel Shenhar
2019-06-05  7:59   ` Greg KH
2019-06-05 21:55     ` Benjamin Herrenschmidt
2019-06-06  6:37       ` Greg KH
2019-06-06  6:47         ` Benjamin Herrenschmidt
2019-06-06  7:04           ` Benjamin Herrenschmidt
2019-06-05  6:54 ` [PATCH 3/3] irqchip: al-fic: Introducing support for MSI-X Talel Shenhar
2019-06-05  6:54   ` Talel Shenhar
2019-06-05  7:59   ` Greg KH [this message]

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=20190605075958.GB9693@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=barakw@amazon.com \
    --cc=benh@kernel.crashing.org \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=dwmw@amazon.co.uk \
    --cc=hanochu@amazon.com \
    --cc=hhhawa@amazon.com \
    --cc=jason@lakedaemon.net \
    --cc=jonnyc@amazon.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marc.zyngier@arm.com \
    --cc=mark.rutland@arm.com \
    --cc=mchehab+samsung@kernel.org \
    --cc=nicolas.ferre@microchip.com \
    --cc=robh+dt@kernel.org \
    --cc=ronenk@amazon.com \
    --cc=shawn.lin@rock-chips.com \
    --cc=talel@amazon.com \
    --cc=tglx@linutronix.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.