From: Krzysztof Kozlowski <krzk@kernel.org>
To: ysionneau@kalrayinc.com, linux-kernel@vger.kernel.org,
Thomas Gleixner <tglx@linutronix.de>
Cc: Jonathan Borne <jborne@kalrayinc.com>,
Julian Vetter <jvetter@kalrayinc.com>,
Clement Leger <clement@clement-leger.fr>,
Vincent Chardon <vincent.chardon@elsys-design.com>
Subject: Re: [RFC PATCH v3 20/37] irqchip: Add irq-kvx-itgen driver
Date: Mon, 22 Jul 2024 14:30:55 +0200 [thread overview]
Message-ID: <214fef44-f4d0-47e9-bcab-9c8b38e68d20@kernel.org> (raw)
In-Reply-To: <20240722094226.21602-21-ysionneau@kalrayinc.com>
On 22/07/2024 11:41, ysionneau@kalrayinc.com wrote:
> From: Yann Sionneau <ysionneau@kalrayinc.com>
>
> The Kalray Coolidge SoC contains several interrupt generators (itgen).
> The itgen is both an interrupt-controller and a msi-client.
>
> Peripheral Controllers such as PCIe, I2C, SPI, GPIO, etc.
> need to send interrupts to the Compute Clusters.
> The purpose of this module is to forward interrupts to the compute clusters
> through the AXI interconnect.
...
> +#define ITGEN_UNSUPPORTED_TYPES (IRQ_TYPE_LEVEL_LOW | IRQ_TYPE_EDGE_FALLING)
> +
> +static int kvx_itgen_domain_alloc(struct irq_domain *domain, unsigned int virq,
> + unsigned int nr_irqs, void *args)
> +{
> + int i, err;
> + struct irq_fwspec *fwspec = args;
> + int hwirq = fwspec->param[0];
> + int type = IRQ_TYPE_NONE;
> + struct kvx_itgen *itgen;
> +
> + if (fwspec->param_count >= 2)
> + type = fwspec->param[1];
> +
> + WARN_ON(type & ITGEN_UNSUPPORTED_TYPES);
How is this possible?
> +
> +
> +static void kvx_itgen_write_msg(struct msi_desc *desc, struct msi_msg *msg)
> +{
> + struct irq_data *d = irq_get_irq_data(desc->irq);
> + struct kvx_itgen *itgen = irq_data_get_irq_chip_data(d);
> + uint32_t cfg_val = 0;
> + uintptr_t dest_addr = ((uint64_t) msg->address_hi << 32) |
> + msg->address_lo;
> + void __iomem *cfg = get_itgen_cfg_offset(itgen, irqd_to_hwirq(d));
> +
> + /*
> + * The address passed in the msi data is the address of the target
> + * mailbox. The itgen however writes to the mailbox based on the mppa
> + * id, cluster id and mailbox id instead of an address. So, extract
> + * these information from the mailbox address.
> + */
> +
> + cfg_val |= (((kvx_sfr_get(PCR) & KVX_SFR_PCR_CID_MASK) >>
> + KVX_SFR_PCR_CID_SHIFT)
> + << KVX_ITGEN_CFG_TARGET_CLUSTER_SHIFT);
> + cfg_val |= ((dest_addr >> MB_ADDR_MAILBOX_SHIFT) &
> + KVX_ITGEN_CFG_TARGET_MAILBOX_MASK)
> + << KVX_ITGEN_CFG_TARGET_MAILBOX_SHIFT;
> +
> + /*
> + * msg->data contains the bit number to be written and is included in
> + * the itgen config
> + */
> + cfg_val |= ((msg->data << KVX_ITGEN_CFG_TARGET_SELECT_BIT_SHIFT)
> + & KVX_ITGEN_CFG_TARGET_SELECT_BIT_MASK);
> +
> + dev_dbg(&itgen->pdev->dev,
> + "Writing dest_addr %lx, value %x to cfg %p\n",
> + dest_addr, cfg_val, cfg);
> +
> + writel(cfg_val, cfg);
> +}
> +
> +static int
Why is this wrapped? Does not look like exceeding 80.
> +kvx_itgen_device_probe(struct platform_device *pdev)
> +{
> + struct kvx_itgen *itgen;
> + u32 it_count;
> + struct resource *mem;
> +
> + itgen = devm_kzalloc(&pdev->dev, sizeof(*itgen), GFP_KERNEL);
> + if (!itgen)
> + return -ENOMEM;
> +
> + mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> + itgen->base = devm_ioremap_resource(&pdev->dev, mem);
Use proper wrapper over these two.
> + if (IS_ERR(itgen->base))
> + return dev_err_probe(&pdev->dev, PTR_ERR(itgen->base),
> + "Failed to ioremap itgen\n");
> +
> + itgen->pdev = pdev;
> + it_count = readl(get_itgen_param_offset(itgen) +
> + KVX_ITGEN_PARAM_IT_NUM_OFFSET);
> +
> + itgen->domain = platform_msi_create_device_domain(&pdev->dev,
> + it_count,
> + kvx_itgen_write_msg,
> + &itgen_domain_ops,
> + itgen);
> + if (!itgen->domain) {
> + dev_err(&pdev->dev, "Failed to create device domain\n");
> + return -ENOMEM;
> + }
> +
> + platform_set_drvdata(pdev, itgen);
> +
> + return 0;
> +}
> +
> +static const struct of_device_id itgen_of_match[] = {
> + { .compatible = "kalray,coolidge-itgen" },
> + { /* END */ }
Drop comment, that's really obvious.
Best regards,
Krzysztof
next prev parent reply other threads:[~2024-07-22 12:30 UTC|newest]
Thread overview: 97+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-22 9:41 [RFC PATCH v3 00/37] Upstream kvx Linux port ysionneau
2024-07-22 9:41 ` [RFC PATCH v3 01/37] Documentation: kvx: Add basic documentation ysionneau
2024-07-22 9:41 ` [RFC PATCH v3 02/37] dt-bindings: soc: kvx: Add binding for kalray,coolidge-pwr-ctrl ysionneau
2024-07-22 9:47 ` Krzysztof Kozlowski
2024-07-31 14:31 ` Yann Sionneau
2024-07-22 18:41 ` Rob Herring (Arm)
2024-07-22 9:41 ` [RFC PATCH v3 03/37] dt-bindings: Add binding for kalray,kv3-1-intc ysionneau
2024-07-22 9:51 ` Krzysztof Kozlowski
2024-07-31 14:47 ` Yann Sionneau
2024-08-07 7:55 ` Krzysztof Kozlowski
2024-07-23 20:49 ` Rob Herring
2024-07-22 9:41 ` [RFC PATCH v3 04/37] dt-bindings: Add binding for kalray,coolidge-apic-gic ysionneau
2024-07-22 18:41 ` Rob Herring (Arm)
2024-07-22 9:41 ` [RFC PATCH v3 05/37] dt-bindings: Add binding for kalray,coolidge-apic-mailbox ysionneau
2024-07-22 18:41 ` Rob Herring (Arm)
2024-07-22 20:47 ` Rob Herring
2024-09-04 15:07 ` Yann Sionneau
2024-07-22 9:41 ` [RFC PATCH v3 06/37] dt-bindings: Add binding for kalray,coolidge-itgen ysionneau
2024-07-22 18:41 ` Rob Herring (Arm)
2024-07-22 9:41 ` [RFC PATCH v3 07/37] dt-bindings: Add binding for kalray,coolidge-ipi-ctrl ysionneau
2024-07-22 18:41 ` Rob Herring (Arm)
2024-07-22 20:50 ` Rob Herring
2024-09-04 15:37 ` Yann Sionneau
2024-07-22 9:41 ` [RFC PATCH v3 08/37] dt-bindings: Add binding for kalray,coolidge-dsu-clock ysionneau
2024-07-22 18:41 ` Rob Herring (Arm)
2024-07-22 21:45 ` Stephen Boyd
2024-07-22 9:41 ` [RFC PATCH v3 09/37] dt-bindings: Add binding for kalray,kv3-1-timer ysionneau
2024-07-23 20:52 ` Rob Herring
2024-07-22 9:41 ` [RFC PATCH v3 10/37] dt-bindings: kalray: Add CPU bindings for Kalray kvx ysionneau
2024-07-22 18:41 ` Rob Herring (Arm)
2024-07-22 20:58 ` Rob Herring
2024-07-22 9:41 ` [RFC PATCH v3 11/37] dt-bindings: kalray: Add Kalray SoC board compatibles ysionneau
2024-07-22 9:41 ` [RFC PATCH v3 12/37] kvx: Add ELF-related definitions ysionneau
2024-07-22 9:41 ` [RFC PATCH v3 13/37] kvx: Add build infrastructure ysionneau
2024-07-23 9:46 ` Arnd Bergmann
2024-07-22 9:41 ` [RFC PATCH v3 14/37] kvx: Add CPU definition headers ysionneau
2024-07-22 9:41 ` [RFC PATCH v3 15/37] kvx: Add atomic/locking headers ysionneau
2024-07-23 8:26 ` Arnd Bergmann
2024-07-22 9:41 ` [RFC PATCH v3 16/37] kvx: Add other common headers ysionneau
2024-07-22 9:41 ` [RFC PATCH v3 17/37] kvx: Add boot and setup routines ysionneau
2024-07-23 8:44 ` Arnd Bergmann
2024-07-27 14:31 ` Thomas Gleixner
2024-07-22 9:41 ` [RFC PATCH v3 18/37] kvx: Add exception/interrupt handling ysionneau
2024-07-22 9:41 ` [RFC PATCH v3 19/37] irqchip: Add irq-kvx-apic-gic driver ysionneau
2024-07-22 12:28 ` Krzysztof Kozlowski
2024-08-23 12:37 ` Yann Sionneau
2024-07-27 13:10 ` Thomas Gleixner
2024-07-22 9:41 ` [RFC PATCH v3 20/37] irqchip: Add irq-kvx-itgen driver ysionneau
2024-07-22 12:30 ` Krzysztof Kozlowski [this message]
2024-08-23 12:42 ` Yann Sionneau
2024-07-27 13:18 ` Thomas Gleixner
2024-07-22 9:41 ` [RFC PATCH v3 21/37] irqchip: Add irq-kvx-apic-mailbox driver ysionneau
2024-07-27 13:35 ` Thomas Gleixner
2024-07-22 9:41 ` [RFC PATCH v3 22/37] irqchip: Add kvx-core-intc core interrupt controller driver ysionneau
2024-07-22 12:32 ` Krzysztof Kozlowski
2024-08-23 12:54 ` Yann Sionneau
2024-07-27 13:37 ` Thomas Gleixner
2024-07-22 9:41 ` [RFC PATCH v3 23/37] kvx: Add process management ysionneau
2024-07-22 9:41 ` [RFC PATCH v3 24/37] kvx: Add memory management ysionneau
2024-07-22 14:58 ` Christoph Hellwig
2024-07-30 13:48 ` Robin Murphy
2024-08-23 16:02 ` Yann Sionneau
2024-07-22 9:41 ` [RFC PATCH v3 25/37] kvx: Add system call support ysionneau
2024-07-23 9:20 ` Arnd Bergmann
2024-07-22 9:41 ` [RFC PATCH v3 26/37] kvx: Add signal handling support ysionneau
2024-07-22 9:41 ` [RFC PATCH v3 27/37] kvx: Add ELF relocations and module support ysionneau
2024-07-22 9:41 ` [RFC PATCH v3 28/37] kvx: Add misc common routines ysionneau
2024-07-23 8:50 ` Arnd Bergmann
2024-07-23 9:58 ` Arnd Bergmann
2024-07-22 9:41 ` [RFC PATCH v3 29/37] kvx: Add some library functions ysionneau
2024-07-23 9:26 ` Arnd Bergmann
2024-07-22 9:41 ` [RFC PATCH v3 30/37] kvx: Add multi-processor (SMP) support ysionneau
2024-07-27 14:22 ` Thomas Gleixner
2024-07-22 9:41 ` [RFC PATCH v3 31/37] kvx: Add kvx default config file ysionneau
2024-07-23 8:55 ` Arnd Bergmann
2024-07-22 9:41 ` [RFC PATCH v3 32/37] kvx: Add debugging related support ysionneau
2024-07-22 9:41 ` [RFC PATCH v3 33/37] kvx: Add support for cpuinfo ysionneau
2024-07-22 12:35 ` Krzysztof Kozlowski
2024-08-23 13:00 ` Yann Sionneau
2024-07-22 9:41 ` [RFC PATCH v3 34/37] kvx: Add power controller driver ysionneau
2024-07-22 12:37 ` Krzysztof Kozlowski
2024-08-23 13:07 ` Yann Sionneau
2024-07-22 9:41 ` [RFC PATCH v3 35/37] kvx: Add IPI driver ysionneau
2024-07-22 12:39 ` Krzysztof Kozlowski
2024-08-23 14:46 ` Yann Sionneau
2024-09-07 13:20 ` Krzysztof Kozlowski
2024-07-27 14:08 ` Thomas Gleixner
2024-07-22 9:41 ` [RFC PATCH v3 36/37] kvx: dts: DeviceTree for qemu emulated Coolidge SoC ysionneau
2024-07-22 9:55 ` Krzysztof Kozlowski
2024-07-22 11:12 ` Conor Dooley
2024-07-31 15:38 ` Yann Sionneau
2024-07-31 16:57 ` Krzysztof Kozlowski
2024-07-22 9:41 ` [RFC PATCH v3 37/37] Add Kalray Inc. to the list of vendor-prefixes.yaml ysionneau
2024-07-22 9:56 ` Krzysztof Kozlowski
2024-08-01 7:35 ` Yann Sionneau
2024-07-24 7:59 ` [RFC PATCH v3 00/37] Upstream kvx Linux port Arnd Bergmann
2024-07-25 10:07 ` Yann Sionneau
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=214fef44-f4d0-47e9-bcab-9c8b38e68d20@kernel.org \
--to=krzk@kernel.org \
--cc=clement@clement-leger.fr \
--cc=jborne@kalrayinc.com \
--cc=jvetter@kalrayinc.com \
--cc=linux-kernel@vger.kernel.org \
--cc=tglx@linutronix.de \
--cc=vincent.chardon@elsys-design.com \
--cc=ysionneau@kalrayinc.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
all inboxes | Powered by JetHome®