lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <646d0941a2a48_afb77294c@dwillia2-xfh.jf.intel.com.notmuch>
Date:   Tue, 23 May 2023 11:43:13 -0700
From:   Dan Williams <dan.j.williams@...el.com>
To:     Davidlohr Bueso <dave@...olabs.net>, <dan.j.williams@...el.com>
CC:     <dave.jiang@...el.com>, <alison.schofield@...el.com>,
        <vishal.l.verma@...el.com>, <ira.weiny@...el.com>,
        <Jonathan.Cameron@...wei.com>, <fan.ni@...sung.com>,
        <a.manzanares@...sung.com>, <dave@...olabs.net>,
        <linux-cxl@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH 3/4] cxl/pci: Introduce cxl_request_irq()

Davidlohr Bueso wrote:
> Factor out common functionality/semantics for cxl shared interrupts
> into a new helper on top of devm_request_irq().
> 
> Suggested-by: Dan Williams <dan.j.williams@...el.com>
> Signed-off-by: Davidlohr Bueso <dave@...olabs.net>
> ---
>  drivers/cxl/pci.c | 39 +++++++++++++++++++++++----------------
>  1 file changed, 23 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/cxl/pci.c b/drivers/cxl/pci.c
> index f2039fe0805d..18b8f3ce680c 100644
> --- a/drivers/cxl/pci.c
> +++ b/drivers/cxl/pci.c
> @@ -84,6 +84,27 @@ static int cxl_pci_mbox_wait_for_doorbell(struct cxl_dev_state *cxlds)
>  			    status & CXLMDEV_DEV_FATAL ? " fatal" : "",        \
>  			    status & CXLMDEV_FW_HALT ? " firmware-halt" : "")
>  
> +struct cxl_dev_id {
> +	struct cxl_dev_state *cxlds;
> +};
> +
> +static int cxl_request_irq(struct cxl_dev_state *cxlds, int irq,
> +			   irq_handler_t handler, irq_handler_t thread_fn)
> +{
> +	struct device *dev = cxlds->dev;
> +	struct cxl_dev_id *dev_id;
> +
> +	/* dev_id must be globally unique and must contain the cxlds */
> +	dev_id = devm_kzalloc(dev, sizeof(*dev_id), GFP_KERNEL);
> +	if (!dev_id)
> +		return -ENOMEM;
> +	dev_id->cxlds = cxlds;
> +
> +	return devm_request_threaded_irq(dev, irq, handler, thread_fn,
> +					 IRQF_SHARED | IRQF_ONESHOT,
> +					 NULL, dev_id);

I was going to say drop the IRQF_ONESHOT in the case where @thread_fn is
NULL, but I could not convince myself that was safe. I assume that
pci_request_irq() gets away with that because most drivers are not
mixing combinations of @handler and @thread_fn being set to NULL.

So, with that, this looks good to me.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ