All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nathan Fontenot <nfont@linux.vnet.ibm.com>
To: John Allen <jallen@linux.vnet.ibm.com>,
	Michael Ellerman <mpe@ellerman.id.au>,
	linuxppc-dev@lists.ozlabs.org
Cc: Michael Roth <mdroth@linux.vnet.ibm.com>
Subject: Re: [PATCH 2/3] powerpc/pseries: Add support for hotplug interrupt source
Date: Mon, 11 Jul 2016 10:49:56 -0500	[thread overview]
Message-ID: <5783C024.6030700@linux.vnet.ibm.com> (raw)
In-Reply-To: <a8defb03-2f61-a46c-a323-d3a722cef12c@linux.vnet.ibm.com>

On 07/07/2016 10:03 AM, John Allen wrote:
> Add handler for new hotplug interrupt. For memory and CPU hotplug events,
> we will add the hotplug errorlog to the hotplug workqueue. Since PCI
> hotplug is not currently supported in the kernel, PCI hotplug events are
> written to the rtas_log_bug and are handled by rtas_errd.
> 
> Signed-off-by: John Allen <jallen@linux.vnet.ibm.com>

Reviewed-by: Nathan Fontenot <nfont@linux.vnet.ibm.com>

> ---
>  arch/powerpc/platforms/pseries/pseries.h |    2 ++
>  arch/powerpc/platforms/pseries/ras.c     |   38 ++++++++++++++++++++++++++++++
>  2 files changed, 40 insertions(+)
> 
> diff --git a/arch/powerpc/platforms/pseries/pseries.h b/arch/powerpc/platforms/pseries/pseries.h
> index ddb9aa5..bba3285 100644
> --- a/arch/powerpc/platforms/pseries/pseries.h
> +++ b/arch/powerpc/platforms/pseries/pseries.h
> @@ -56,6 +56,8 @@ extern int dlpar_detach_node(struct device_node *);
>  extern int dlpar_acquire_drc(u32 drc_index);
>  extern int dlpar_release_drc(u32 drc_index);
> 
> +void queue_hotplug_event(struct pseries_hp_errorlog *hp_errlog,
> +			 struct completion *hotplug_done, int *rc);
>  #ifdef CONFIG_MEMORY_HOTPLUG
>  int dlpar_memory(struct pseries_hp_errorlog *hp_elog);
>  #else
> diff --git a/arch/powerpc/platforms/pseries/ras.c b/arch/powerpc/platforms/pseries/ras.c
> index 9a3e27b..d11e8ca 100644
> --- a/arch/powerpc/platforms/pseries/ras.c
> +++ b/arch/powerpc/platforms/pseries/ras.c
> @@ -43,6 +43,7 @@ static int ras_check_exception_token;
>  /* EPOW events counter variable */
>  static int num_epow_events;
> 
> +static irqreturn_t ras_hotplug_interrupt(int irq, void *dev_id);
>  static irqreturn_t ras_epow_interrupt(int irq, void *dev_id);
>  static irqreturn_t ras_error_interrupt(int irq, void *dev_id);
> 
> @@ -65,6 +66,14 @@ static int __init init_ras_IRQ(void)
>  		of_node_put(np);
>  	}
> 
> +	/* Hotplug Events */
> +	np = of_find_node_by_path("/event-sources/hot-plug-events");
> +	if (np != NULL) {
> +		request_event_sources_irqs(np, ras_hotplug_interrupt,
> +					   "RAS_HOTPLUG");
> +		of_node_put(np);
> +	}
> +
>  	/* EPOW Events */
>  	np = of_find_node_by_path("/event-sources/epow-events");
>  	if (np != NULL) {
> @@ -190,6 +199,35 @@ static void rtas_parse_epow_errlog(struct rtas_error_log *log)
>  		num_epow_events++;
>  }
> 
> +static irqreturn_t ras_hotplug_interrupt(int irq, void *dev_id)
> +{
> +	struct pseries_errorlog *pseries_log;
> +	struct pseries_hp_errorlog *hp_elog;
> +
> +	spin_lock(&ras_log_buf_lock);
> +
> +	rtas_call(ras_check_exception_token, 6, 1, NULL,
> +		  RTAS_VECTOR_EXTERNAL_INTERRUPT, virq_to_hw(irq),
> +		  RTAS_HOTPLUG_EVENTS, 0, __pa(&ras_log_buf),
> +		  rtas_get_error_log_max());
> +
> +	pseries_log = get_pseries_errorlog((struct rtas_error_log *)ras_log_buf,
> +					   PSERIES_ELOG_SECT_ID_HOTPLUG);
> +	hp_elog = (struct pseries_hp_errorlog *)pseries_log->data;
> +
> +	/* Since PCI hotplug is not currently supported on pseries, put
> +	 * PCI hotplug events on the ras_log_buf to be handled by rtas_errd
> +	 */
> +	if (hp_elog->resource == PSERIES_HP_ELOG_RESOURCE_MEM ||
> +	    hp_elog->resource == PSERIES_HP_ELOG_RESOURCE_CPU)
> +		queue_hotplug_event(hp_elog, NULL, NULL);
> +	else
> +		log_error(ras_log_buf, ERR_TYPE_RTAS_LOG, 0);
> +
> +	spin_unlock(&ras_log_buf_lock);
> +	return IRQ_HANDLED;
> +}
> +
>  /* Handle environmental and power warning (EPOW) interrupts. */
>  static irqreturn_t ras_epow_interrupt(int irq, void *dev_id)
>  {
> 
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev
> 

  reply	other threads:[~2016-07-11 15:50 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-07 14:57 [PATCH 0/3] powerpc/pseries: Add pseries hotplug queue and PowerVM/PowerKVM use cases John Allen
2016-07-07 15:00 ` [PATCH 1/3] powerpc/pseries: Add pseries hotplug workqueue John Allen
2016-07-11 15:48   ` Nathan Fontenot
2016-07-20  9:10   ` [1/3] " Michael Ellerman
2016-07-07 15:03 ` [PATCH 2/3] powerpc/pseries: Add support for hotplug interrupt source John Allen
2016-07-11 15:49   ` Nathan Fontenot [this message]
2016-07-07 15:05 ` [PATCH 3/3] powerpc/pseries: Use kernel hotplug queue for PowerVM hotplug events John Allen
2016-07-11 15:52   ` Nathan Fontenot

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=5783C024.6030700@linux.vnet.ibm.com \
    --to=nfont@linux.vnet.ibm.com \
    --cc=jallen@linux.vnet.ibm.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mdroth@linux.vnet.ibm.com \
    --cc=mpe@ellerman.id.au \
    /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.