All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alistair Popple <alistair@popple.id.au>
To: minyard@acm.org
Cc: openipmi-developer@lists.sourceforge.net,
	linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 2/8] ipmi/powernv: Convert to irq event interface
Date: Mon, 11 May 2015 12:07:54 +1000	[thread overview]
Message-ID: <1756932.94IyepIzdi@mexican> (raw)
In-Reply-To: <554BA42F.6070001@acm.org>

[-- Attachment #1: Type: text/plain, Size: 3662 bytes --]

Hi,

On Thu, 7 May 2015 12:43:11 Corey Minyard wrote:
> 
> The only thing I would suggest is passing the irq level
> (IRQ_TYPE_LEVEL_HIGH) as
> part of the openfirmware data instead of hard-coding it.

I intend to do that in future once our firmware is updated to pass this information (via 
the device-tree). However systems with older firmware won't pass this information, 
hence we hard code it for the existing events.

- Alistair

> 
> Acked-by: Corey Minyard <cminyard@mvista.com>
> 
> >  drivers/char/ipmi/ipmi_powernv.c | 39
> >  ++++++++++++++++++++++----------------- 1 file changed, 22
> >  insertions(+), 17 deletions(-)
> > 
> > diff --git a/drivers/char/ipmi/ipmi_powernv.c
> > b/drivers/char/ipmi/ipmi_powernv.c index 8753b0f..9b409c0 100644
> > --- a/drivers/char/ipmi/ipmi_powernv.c
> > +++ b/drivers/char/ipmi/ipmi_powernv.c
> > @@ -15,6 +15,8 @@
> > 
> >  #include <linux/list.h>
> >  #include <linux/module.h>
> >  #include <linux/of.h>
> > 
> > +#include <linux/of_irq.h>
> > +#include <linux/interrupt.h>
> > 
> >  #include <asm/opal.h>
> > 
> > @@ -23,8 +25,7 @@ struct ipmi_smi_powernv {
> > 
> >  	u64			interface_id;
> >  	struct ipmi_device_id	ipmi_id;
> >  	ipmi_smi_t		intf;
> > 
> > -	u64			event;
> > -	struct notifier_block	event_nb;
> > +	unsigned int		irq;
> > 
> >  	/**
> >  	
> >  	 * We assume that there can only be one outstanding request, so
> > 
> > @@ -197,15 +198,12 @@ static struct ipmi_smi_handlers
> > ipmi_powernv_smi_handlers = {> 
> >  	.poll			= ipmi_powernv_poll,
> >  
> >  };
> > 
> > -static int ipmi_opal_event(struct notifier_block *nb,
> > -			  unsigned long events, void *change)
> > +static irqreturn_t ipmi_opal_event(int irq, void *data)
> > 
> >  {
> > 
> > -	struct ipmi_smi_powernv *smi = container_of(nb,
> > -					struct 
ipmi_smi_powernv, event_nb);
> > +	struct ipmi_smi_powernv *smi = data;
> > 
> > -	if (events & smi->event)
> > -		ipmi_powernv_recv(smi);
> > -	return 0;
> > +	ipmi_powernv_recv(smi);
> > +	return IRQ_HANDLED;
> > 
> >  }
> >  
> >  static int ipmi_powernv_probe(struct platform_device *pdev)
> > 
> > @@ -240,13 +238,16 @@ static int ipmi_powernv_probe(struct platform_device
> > *pdev)> 
> >  		goto err_free;
> >  	
> >  	}
> > 
> > -	ipmi->event = 1ull << prop;
> > -	ipmi->event_nb.notifier_call = ipmi_opal_event;
> > +	ipmi->irq = irq_of_parse_and_map(dev->of_node, 0);
> > +	if (!ipmi->irq) {
> > +		dev_info(dev, "Unable to map irq from device tree\n");
> > +		ipmi->irq = opal_event_request(prop);
> > +	}
> > 
> > -	rc = opal_notifier_register(&ipmi->event_nb);
> > -	if (rc) {
> > -		dev_warn(dev, "OPAL notifier registration failed 
(%d)\n", rc);
> > -		goto err_free;
> > +	if (request_irq(ipmi->irq, ipmi_opal_event, IRQ_TYPE_LEVEL_HIGH,
> > +				"opal-ipmi", ipmi)) {
> > +		dev_warn(dev, "Unable to request irq\n");
> > +		goto err_dispose;
> > 
> >  	}
> >  	
> >  	ipmi->opal_msg = devm_kmalloc(dev,
> > 
> > @@ -271,7 +272,9 @@ static int ipmi_powernv_probe(struct platform_device
> > *pdev)> 
> >  err_free_msg:
> >  	devm_kfree(dev, ipmi->opal_msg);
> >  
> >  err_unregister:
> > -	opal_notifier_unregister(&ipmi->event_nb);
> > +	free_irq(ipmi->irq, ipmi);
> > +err_dispose:
> > +	irq_dispose_mapping(ipmi->irq);
> > 
> >  err_free:
> >  	devm_kfree(dev, ipmi);
> >  	return rc;
> > 
> > @@ -282,7 +285,9 @@ static int ipmi_powernv_remove(struct platform_device
> > *pdev)> 
> >  	struct ipmi_smi_powernv *smi = dev_get_drvdata(&pdev->dev);
> >  	
> >  	ipmi_unregister_smi(smi->intf);
> > 
> > -	opal_notifier_unregister(&smi->event_nb);
> > +	free_irq(smi->irq, smi);
> > +	irq_dispose_mapping(smi->irq);
> > +
> > 
> >  	return 0;
> >  
> >  }

[-- Attachment #2: Type: text/html, Size: 23875 bytes --]

  reply	other threads:[~2015-05-11  2:07 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-07  3:16 [PATCH v3 1/8] powerpc/powernv: Add a virtual irqchip for opal events Alistair Popple
2015-05-07  3:16 ` Alistair Popple
2015-05-07  3:16 ` [PATCH v3 2/8] ipmi/powernv: Convert to irq event interface Alistair Popple
2015-05-07  3:16   ` Alistair Popple
2015-05-07 17:43   ` Corey Minyard
2015-05-07 17:43     ` Corey Minyard
2015-05-11  2:07     ` Alistair Popple [this message]
2015-05-07  3:16 ` [PATCH v3 3/8] hvc: Convert to using interrupts instead of opal events Alistair Popple
2015-05-07  3:16   ` Alistair Popple
2015-05-07  3:16 ` [PATCH v3 4/8] powernv/eeh: Update the EEH code to use the opal irq domain Alistair Popple
2015-05-07  3:16   ` Alistair Popple
2015-05-07  3:16 ` [PATCH v3 5/8] powernv/opal: Convert opal message events to " Alistair Popple
2015-05-07  3:16   ` Alistair Popple
2015-05-11  9:18   ` [v3, " Michael Ellerman
2015-05-07  3:16 ` [PATCH v3 6/8] powernv/elog: Convert elog " Alistair Popple
2015-05-07  3:16   ` Alistair Popple
2015-05-07  3:16 ` [PATCH v3 7/8] powernv/opal-dump: Convert to " Alistair Popple
2015-05-07  3:16   ` Alistair Popple
2015-05-07  3:16 ` [PATCH v3 8/8] opal: Remove events notifier Alistair Popple
2015-05-07  3:16   ` Alistair Popple

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=1756932.94IyepIzdi@mexican \
    --to=alistair@popple.id.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=minyard@acm.org \
    --cc=openipmi-developer@lists.sourceforge.net \
    /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.