Skip to contentSkip to conversation

Add Broadcom SPU Crypto Driver

PATCH Superseded Rob Rice 3 participants 11 messages Nov 30, 2016 – Dec 14, 2016

Subsystems (2)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Rob Rice

author
#0 lore raw

cover Add Broadcom SPU Crypto Driver

The Broadcom SPU crypto driver provides access to SPU hardware for symmetric crypto offload. The driver supports ablkcipher, ahash, and aead operations. The driver supports several Broadcom SoCs with different revisions of the SPU hardware. The driver supports SPU-M and SPU2 hardware revisions, and a couple versions of each hw revision, each version with minor differences.

The device tree entries for the SPU depends on device tree entries for the Broadcom PDC driver. The PDC DT entries have been accepted upstream, but are not yet included in the crypto repo. See commit e79249143f468f8d3365dbbd1642c045bdcc98c5.

Rob Rice (3):
crypto: brcm: DT documentation for Broadcom SPU driver
crypto: brcm: Add Broadcom SPU driver
crypto: brcm: Add Broadcom SPU driver DT entry.

 .../devicetree/bindings/crypto/brcm,spu-crypto.txt |   25 +
 arch/arm64/boot/dts/broadcom/ns2.dtsi              |   12 +
 drivers/crypto/Kconfig                             |   10 +
 drivers/crypto/Makefile                            |    1 +
 drivers/crypto/bcm/Makefile                        |   15 +
 drivers/crypto/bcm/cipher.c                        | 4943 ++++++++++++++++++++
 drivers/crypto/bcm/cipher.h                        |  472 ++
 drivers/crypto/bcm/spu.c                           | 1252 +++++
 drivers/crypto/bcm/spu.h                           |  288 ++
 drivers/crypto/bcm/spu2.c                          | 1402 ++++++
 drivers/crypto/bcm/spu2.h                          |  228 +
 drivers/crypto/bcm/spum.h                          |  174 +
 drivers/crypto/bcm/util.c                          |  584 +++
 drivers/crypto/bcm/util.h                          |  117 +
 14 files changed, 9523 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/crypto/brcm,spu-crypto.txt
 create mode 100644 drivers/crypto/bcm/Makefile
 create mode 100644 drivers/crypto/bcm/cipher.c
 create mode 100644 drivers/crypto/bcm/cipher.h
 create mode 100644 drivers/crypto/bcm/spu.c
 create mode 100644 drivers/crypto/bcm/spu.h
 create mode 100644 drivers/crypto/bcm/spu2.c
 create mode 100644 drivers/crypto/bcm/spu2.h
 create mode 100644 drivers/crypto/bcm/spum.h
 create mode 100644 drivers/crypto/bcm/util.c
 create mode 100644 drivers/crypto/bcm/util.h

--
2.1.0

author
#1 lore raw

PATCH 1/3 crypto: brcm: DT documentation for Broadcom SPU driver

Device tree documentation for Broadcom Secure Processing Unit (SPU) crypto driver.

---
 .../devicetree/bindings/crypto/brcm,spu-crypto.txt | 25 ++++++++++++++++++++++
 1 file changed, 25 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/crypto/brcm,spu-crypto.txt
Documentation/devicetree/bindings/crypto/brcm,spu-crypto.txt new file +25 -0
new file mode 100644
index 0000000..e5fe942
@@ -0,0 +1,25 @@
+The Broadcom Secure Processing Unit (SPU) driver supports symmetric
+cryptographic offload for Broadcom SoCs with SPU hardware. A SoC may have
+multiple SPU hardware blocks.
+
+Required properties:
+- compatible : Should be "brcm,spum-crypto" for devices with SPU-M hardware
+  (e.g., Northstar2) or "brcm,spum-nsp-crypto" for the Northstar Plus variant
+  of the SPU-M hardware.
+
+- reg: Should contain SPU registers location and length.
+- mboxes: A list of mailbox channels to be used by the kernel driver. Mailbox
+channels correspond to DMA rings on the device.
+
+Example:
+	spu-crypto at 612d0000 {
+		compatible = "brcm,spum-crypto";
+		reg = <0 0x612d0000 0 0x900>,    /* SPU 0 control regs */
+			<0 0x612f0000 0 0x900>,  /* SPU 1 control regs */
+			<0 0x61310000 0 0x900>,  /* SPU 2 control regs */
+			<0 0x61330000 0 0x900>;  /* SPU 3 control regs */
+		mboxes = <&pdc0 0>,
+			<&pdc1 0>,
+			<&pdc2 0>,
+			<&pdc3 0>;
+	};

--
2.1.0

#2 lore raw

Re: [PATCH 1/3] crypto: brcm: DT documentation for Broadcom SPU driver

Quoted 16 lines · Rob Rice

Device tree documentation for Broadcom Secure Processing Unit (SPU) crypto driver.

---
 .../devicetree/bindings/crypto/brcm,spu-crypto.txt | 25 ++++++++++++++++++++++
 1 file changed, 25 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/crypto/brcm,spu-crypto.txt
Documentation/devicetree/bindings/crypto/brcm,spu-crypto.txt new file +0 -0
new file mode 100644
index 0000000..e5fe942

Documentation/devicetree/bindings/crypto/brcm,spu-crypto.txt line 3

Quoted 3 lines
Documentation/devicetree/bindings/crypto/brcm,spu-crypto.txt new file +3 -0
@@ -0,0 +1,25 @@
+The Broadcom Secure Processing Unit (SPU) driver supports symmetric
+cryptographic offload for Broadcom SoCs with SPU hardware. A SoC may have
+multiple SPU hardware blocks.

Bindings shound describe *hardware*, not *drivers*. Please drop mention of the driver, and just decribe the hardware.

Quoted 6 lines
Documentation/devicetree/bindings/crypto/brcm,spu-crypto.txt new file +6 -0
+Required properties:
+- compatible : Should be "brcm,spum-crypto" for devices with SPU-M hardware
+  (e.g., Northstar2) or "brcm,spum-nsp-crypto" for the Northstar Plus variant
+  of the SPU-M hardware.
+
+- reg: Should contain SPU registers location and length.

Documentation/devicetree/bindings/crypto/brcm,spu-crypto.txt line 20

Quoted 10 lines
Documentation/devicetree/bindings/crypto/brcm,spu-crypto.txt new file +10 -0
+- mboxes: A list of mailbox channels to be used by the kernel driver. Mailbox
+channels correspond to DMA rings on the device.
+
+Example:
+	spu-crypto at 612d0000 {
+		compatible = "brcm,spum-crypto";
+		reg = <0 0x612d0000 0 0x900>,    /* SPU 0 control regs */
+			<0 0x612f0000 0 0x900>,  /* SPU 1 control regs */
+			<0 0x61310000 0 0x900>,  /* SPU 2 control regs */
+			<0 0x61330000 0 0x900>;  /* SPU 3 control regs */

The above didn't mention there were several register sets, and the comment beside each makes them sound like they're separate SPU instances, so I don't think it makes sense to group them as one node.

What's going on here?

Documentation/devicetree/bindings/crypto/brcm,spu-crypto.txt line 24

Quoted 4 lines
Documentation/devicetree/bindings/crypto/brcm,spu-crypto.txt new file +4 -0
+		mboxes = <&pdc0 0>,
+			<&pdc1 0>,
+			<&pdc2 0>,
+			<&pdc3 0>;

Does each mbox correspond to one of the SPUs above? Or is there a shared pool?

Thanks,
Mark.

#3 lore raw

Re: [PATCH 1/3] crypto: brcm: DT documentation for Broadcom SPU driver

Mark,

Thanks for your comments. Replies below.

Rob

Quoted 11 lines · Mark Rutland
Quoted 10 lines · Rob Rice

Device tree documentation for Broadcom Secure Processing Unit (SPU) crypto driver.

---
  .../devicetree/bindings/crypto/brcm,spu-crypto.txt | 25 ++++++++++++++++++++++
  1 file changed, 25 insertions(+)

create mode 100644 Documentation/devicetree/bindings/crypto/brcm,spu-crypto.txt

Quoted 11 lines

Documentation/devicetree/bindings/crypto/brcm,spu-crypto.txt line 3

Quoted 9 lines
Documentation/devicetree/bindings/crypto/brcm,spu-crypto.txt new file +3 -0
new file mode 100644
index 0000000..e5fe942
@@ -0,0 +1,25 @@
+The Broadcom Secure Processing Unit (SPU) driver supports symmetric
+cryptographic offload for Broadcom SoCs with SPU hardware. A SoC may have
+multiple SPU hardware blocks.

Bindings shound describe *hardware*, not *drivers*. Please drop mention of the driver, and just decribe the hardware.

Makes sense. I'll change it.

Quoted 21 lines
Quoted 7 lines
Documentation/devicetree/bindings/crypto/brcm,spu-crypto.txt new file +6 -0
+Required properties:
+- compatible : Should be "brcm,spum-crypto" for devices with SPU-M hardware
+  (e.g., Northstar2) or "brcm,spum-nsp-crypto" for the Northstar Plus variant
+  of the SPU-M hardware.
+
+- reg: Should contain SPU registers location and length.

Documentation/devicetree/bindings/crypto/brcm,spu-crypto.txt line 20

Quoted 10 lines
Documentation/devicetree/bindings/crypto/brcm,spu-crypto.txt new file +10 -0
+- mboxes: A list of mailbox channels to be used by the kernel driver. Mailbox
+channels correspond to DMA rings on the device.
+
+Example:
+	spu-crypto at 612d0000 {
+		compatible = "brcm,spum-crypto";
+		reg = <0 0x612d0000 0 0x900>,    /* SPU 0 control regs */
+			<0 0x612f0000 0 0x900>,  /* SPU 1 control regs */
+			<0 0x61310000 0 0x900>,  /* SPU 2 control regs */
+			<0 0x61330000 0 0x900>;  /* SPU 3 control regs */

The above didn't mention there were several register sets, and the comment beside each makes them sound like they're separate SPU instances, so I don't think it makes sense to group them as one node.

Quoted 1 line

What's going on here?

That's right. For the SoC I used as the example, there are four SPU hardware blocks. The driver round robins crypto requests to the hardware blocks to handle requests in parallel and increase throughput. I want one instance of the SPU driver that registers algos once with the crypto API and manages all the mailbox channels. Maybe I can achieve that with separate device tree entries for each SPU block, I'm not sure. I'll look into it.

Quoted 7 lines

Documentation/devicetree/bindings/crypto/brcm,spu-crypto.txt line 24

Quoted 5 lines
Documentation/devicetree/bindings/crypto/brcm,spu-crypto.txt new file +4 -0
+		mboxes = <&pdc0 0>,
+			<&pdc1 0>,
+			<&pdc2 0>,
+			<&pdc3 0>;

Does each mbox correspond to one of the SPUs above? Or is there a shared pool?

Yes, each of these mailbox channels corresponds to a different SPU. PDC is a DMA ring manager for DMAs to the SPUs.

Quoted 3 lines

Thanks,
Mark.

author
#4 lore raw

PATCH 2/3 crypto: brcm: Add Broadcom SPU driver

In reply to Rob Rice

Add Broadcom Secure Processing Unit (SPU) crypto driver for SPU hardware crypto offload. The driver supports ablkcipher, ahash, and aead symmetric crypto operations.

---
 drivers/crypto/Kconfig      |   10 +
 drivers/crypto/Makefile     |    1 +
 drivers/crypto/bcm/Makefile |   15 +
 drivers/crypto/bcm/cipher.c | 4943 +++++++++++++++++++++++++++++++++++++++++++
 drivers/crypto/bcm/cipher.h |  472 +++++
 drivers/crypto/bcm/spu.c    | 1252 +++++++++++
 drivers/crypto/bcm/spu.h    |  288 +++
 drivers/crypto/bcm/spu2.c   | 1402 ++++++++++++
 drivers/crypto/bcm/spu2.h   |  228 ++
 drivers/crypto/bcm/spum.h   |  174 ++
 drivers/crypto/bcm/util.c   |  584 +++++
 drivers/crypto/bcm/util.h   |  117 +
 12 files changed, 9486 insertions(+)
 create mode 100644 drivers/crypto/bcm/Makefile
 create mode 100644 drivers/crypto/bcm/cipher.c
 create mode 100644 drivers/crypto/bcm/cipher.h
 create mode 100644 drivers/crypto/bcm/spu.c
 create mode 100644 drivers/crypto/bcm/spu.h
 create mode 100644 drivers/crypto/bcm/spu2.c
 create mode 100644 drivers/crypto/bcm/spu2.h
 create mode 100644 drivers/crypto/bcm/spum.h
 create mode 100644 drivers/crypto/bcm/util.c
 create mode 100644 drivers/crypto/bcm/util.h
drivers/crypto/Kconfig +10 -0
index 4d2b81f..9ec5bde 100644
@@ -555,4 +555,14 @@ config CRYPTO_DEV_ROCKCHIP
 
 source "drivers/crypto/chelsio/Kconfig"
 
+config CRYPTO_DEV_BCM_SPU
+	tristate "Broadcom symmetric crypto/hash acceleration support"
+	depends on ARCH_BCM_IPROC
+	depends on BCM_PDC_MBOX
+	default m
+	help
+	This driver provides support for Broadcom crypto acceleration using the
+	Secure Processing Unit (SPU). The SPU driver registers ablkcipher,
+	ahash, and aead algorithms with the kernel cryptographic API.
+
 endif # CRYPTO_HW
drivers/crypto/Makefile +1 -0
index ad7250f..2702650 100644
@@ -32,3 +32,4 @@ obj-$(CONFIG_CRYPTO_DEV_VMX) += vmx/
 obj-$(CONFIG_CRYPTO_DEV_SUN4I_SS) += sunxi-ss/
 obj-$(CONFIG_CRYPTO_DEV_ROCKCHIP) += rockchip/
 obj-$(CONFIG_CRYPTO_DEV_CHELSIO) += chelsio/
+obj-$(CONFIG_CRYPTO_DEV_BCM_SPU) += bcm/
drivers/crypto/bcm/Makefile new file +15 -0
new file mode 100644
index 0000000..13cb80e
@@ -0,0 +1,15 @@
+# File: drivers/crypto/bcm/Makefile
+#
+# Makefile for crypto acceleration files for Broadcom SPU driver
+#
+# Uncomment to enable debug tracing in the SPU driver.
+# CFLAGS_util.o := -DDEBUG
+# CFLAGS_cipher.o := -DDEBUG
+# CFLAGS_spu.o := -DDEBUG
+# CFLAGS_spu2.o := -DDEBUG
+
+obj-$(CONFIG_CRYPTO_DEV_BCM_SPU) := bcm_crypto_spu.o
+
+bcm_crypto_spu-objs :=  util.o spu.o spu2.o cipher.o
+
+ccflags-y += -I. -DBCMDRIVER
drivers/crypto/bcm/cipher.c new file +4943 -0

2,967 lines not on this page · raw message

drivers/crypto/bcm/cipher.h new file +472 -0

472 lines not on this page · raw message

drivers/crypto/bcm/spu.c new file +1252 -0

1,252 lines not on this page · raw message

drivers/crypto/bcm/spu.h new file +288 -0

288 lines not on this page · raw message

drivers/crypto/bcm/spu2.c new file +1402 -0

1,402 lines not on this page · raw message

drivers/crypto/bcm/spu2.h new file +228 -0

228 lines not on this page · raw message

drivers/crypto/bcm/spum.h new file +174 -0

174 lines not on this page · raw message

drivers/crypto/bcm/util.c new file +584 -0

584 lines not on this page · raw message

drivers/crypto/bcm/util.h new file +117 -0

117 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

--
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

Part of the diff is not shown here. View the raw message.

#5 lore raw

Re: [PATCH 2/3] crypto: brcm: Add Broadcom SPU driver

reproduce: wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree…

Hi Rob,

[auto build test ERROR on cryptodev/master]
[also build test ERROR on v4.9-rc7 next-20161201]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Rob-Rice/crypto-brcm-DT-documentation-for-Broadcom-SPU-driver/20161202-010038
base:   https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git master
config: arm64-defconfig (attached as .config)
compiler: aarch64-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705

reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=arm64

All errors (new ones prefixed by >>):

>> ERROR: "des_ekey" [drivers/crypto/bcm/bcm_crypto_spu.ko] undefined!

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 31957 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20161202/f5e756e2/attachment-0001.gz>

#6 lore raw

Re: [PATCH 2/3] crypto: brcm: Add Broadcom SPU driver

In reply to Rob Rice
Quoted 7 lines · Rob Rice
drivers/crypto/bcm/cipher.c new file +7 -0
+static const struct of_device_id bcm_spu_dt_ids[] = {
+	{
+		.compatible = "brcm,spum-crypto",
+		.data = &spum_ns2_types,
+	},
+	{
+		.compatible = "brcm,spum-nsp-crypto",

drivers/crypto/bcm/cipher.c line 4780

Quoted 10 lines
drivers/crypto/bcm/cipher.c new file +10 -0
+		.data = &spum_nsp_types,
+	},
+	{
+		.compatible = "brcm,spu2-crypto",
+		.data = &spu2_types,
+	},
+	{
+		.compatible = "brcm,spu2-v2-crypto",
+		.data = &spu2_v2_types,
+	},

These last two weren't in the binding document.

Quoted 11 lines
drivers/crypto/bcm/cipher.c new file +11 -0
+	{ /* sentinel */ }
+};
+
+MODULE_DEVICE_TABLE(of, bcm_spu_dt_ids);
+
+static int spu_dt_read(struct platform_device *pdev)
+{
+	struct device *dev = &pdev->dev;
+	struct spu_hw *spu = &iproc_priv.spu;
+	struct device_node *dn = pdev->dev.of_node;
+	struct resource *spu_ctrl_regs;

drivers/crypto/bcm/cipher.c line 4801

Quoted 10 lines
drivers/crypto/bcm/cipher.c new file +10 -0
+	const struct of_device_id *match;
+	struct spu_type_subtype *matched_spu_type;
+	void __iomem *spu_reg_vbase[MAX_SPUS];
+	int i;
+	int err;
+
+	if (!of_device_is_available(dn)) {
+		dev_crit(dev, "SPU device not available");
+		return -ENODEV;
+	}

How can this happen?

drivers/crypto/bcm/cipher.c line 4808

Quoted 6 lines
drivers/crypto/bcm/cipher.c new file +6 -0
+	/* Count number of mailbox channels */
+	spu->num_chan = of_count_phandle_with_args(dn, "mboxes", "#mbox-cells");
+	dev_dbg(dev, "Device has %d SPU channels", spu->num_chan);
+
+	match = of_match_device(of_match_ptr(bcm_spu_dt_ids), dev);
+	matched_spu_type = (struct spu_type_subtype *)match->data;

This cast usn't necessary.

Quoted 13 lines
drivers/crypto/bcm/cipher.c new file +13 -0
+	spu->spu_type = matched_spu_type->type;
+	spu->spu_subtype = matched_spu_type->subtype;
+
+	/* Read registers and count number of SPUs */
+	i = 0;
+	while ((i < MAX_SPUS) && ((spu_ctrl_regs =
+		platform_get_resource(pdev, IORESOURCE_MEM, i)) != NULL)) {
+		dev_dbg(dev,
+			"SPU %d control register region res.start = %#x, res.end = %#x",
+			i,
+			(unsigned int)spu_ctrl_regs->start,
+			(unsigned int)spu_ctrl_regs->end);
+

drivers/crypto/bcm/cipher.c line 4831

Quoted 10 lines
drivers/crypto/bcm/cipher.c new file +10 -0
+		spu_reg_vbase[i] = devm_ioremap_resource(dev, spu_ctrl_regs);
+		if (IS_ERR(spu_reg_vbase[i])) {
+			err = PTR_ERR(spu_reg_vbase[i]);
+			dev_err(&pdev->dev, "Failed to map registers: %d\n",
+				err);
+			spu_reg_vbase[i] = NULL;
+			return err;
+		}
+		i++;
+	}

These *really* sound like independent devices. There are no shared registers, and each has its own mbox.

Why do we group them like this?

Thanks,
Mark.

#7 lore raw

Re: [PATCH 2/3] crypto: brcm: Add Broadcom SPU driver

Mark,

Thanks for the comments. Replies below.

Rob

Quoted 11 lines · Mark Rutland
Quoted 10 lines · Rob Rice
drivers/crypto/bcm/cipher.c new file +10 -0
+static const struct of_device_id bcm_spu_dt_ids[] = {
+	{
+		.compatible = "brcm,spum-crypto",
+		.data = &spum_ns2_types,
+	},
+	{
+		.compatible = "brcm,spum-nsp-crypto",
+		.data = &spum_nsp_types,
+	},
+	{
Quoted 8 lines

drivers/crypto/bcm/cipher.c line 4780

Quoted 7 lines
drivers/crypto/bcm/cipher.c new file +7 -0
+		.compatible = "brcm,spu2-crypto",
+		.data = &spu2_types,
+	},
+	{
+		.compatible = "brcm,spu2-v2-crypto",
+		.data = &spu2_v2_types,
+	},

These last two weren't in the binding document.

yes, I'll add them.

Quoted 15 lines
Quoted 15 lines
drivers/crypto/bcm/cipher.c new file +14 -0
+	{ /* sentinel */ }
+};
+
+MODULE_DEVICE_TABLE(of, bcm_spu_dt_ids);
+
+static int spu_dt_read(struct platform_device *pdev)
+{
+	struct device *dev = &pdev->dev;
+	struct spu_hw *spu = &iproc_priv.spu;
+	struct device_node *dn = pdev->dev.of_node;
+	struct resource *spu_ctrl_regs;
+	const struct of_device_id *match;
+	struct spu_type_subtype *matched_spu_type;
+	void __iomem *spu_reg_vbase[MAX_SPUS];
Quoted 8 lines

drivers/crypto/bcm/cipher.c line 4801

Quoted 7 lines
drivers/crypto/bcm/cipher.c new file +7 -0
+	int i;
+	int err;
+
+	if (!of_device_is_available(dn)) {
+		dev_crit(dev, "SPU device not available");
+		return -ENODEV;
+	}

How can this happen?

You are correct. This is unnecessary. I will remove.

Quoted 8 lines

drivers/crypto/bcm/cipher.c line 4808

Quoted 7 lines
drivers/crypto/bcm/cipher.c new file +6 -0
+	/* Count number of mailbox channels */
+	spu->num_chan = of_count_phandle_with_args(dn, "mboxes", "#mbox-cells");
+	dev_dbg(dev, "Device has %d SPU channels", spu->num_chan);
+
+	match = of_match_device(of_match_ptr(bcm_spu_dt_ids), dev);
+	matched_spu_type = (struct spu_type_subtype *)match->data;

This cast usn't necessary.

Ok, will remove.

Quoted 27 lines
Quoted 14 lines
drivers/crypto/bcm/cipher.c new file +13 -0
+	spu->spu_type = matched_spu_type->type;
+	spu->spu_subtype = matched_spu_type->subtype;
+
+	/* Read registers and count number of SPUs */
+	i = 0;
+	while ((i < MAX_SPUS) && ((spu_ctrl_regs =
+		platform_get_resource(pdev, IORESOURCE_MEM, i)) != NULL)) {
+		dev_dbg(dev,
+			"SPU %d control register region res.start = %#x, res.end = %#x",
+			i,
+			(unsigned int)spu_ctrl_regs->start,
+			(unsigned int)spu_ctrl_regs->end);
+

drivers/crypto/bcm/cipher.c line 4831

Quoted 10 lines
drivers/crypto/bcm/cipher.c new file +10 -0
+		spu_reg_vbase[i] = devm_ioremap_resource(dev, spu_ctrl_regs);
+		if (IS_ERR(spu_reg_vbase[i])) {
+			err = PTR_ERR(spu_reg_vbase[i]);
+			dev_err(&pdev->dev, "Failed to map registers: %d\n",
+				err);
+			spu_reg_vbase[i] = NULL;
+			return err;
+		}
+		i++;
+	}

These *really* sound like independent devices. There are no shared registers, and each has its own mbox.

Quoted 1 line

Why do we group them like this?

As I said in the previous email, I want one instance of the driver to register crypto algos once with the crypto API and to distribute crypto requests among all available SPU hw blocks.

Quoted 3 lines

Thanks,
Mark.

author
#8 lore raw

PATCH 3/3 crypto: brcm: Add Broadcom SPU driver DT entry.

In reply to Rob Rice

Add Northstar2 device tree entry for Broadcom Secure Processing Unit (SPU) crypto driver.

---
 arch/arm64/boot/dts/broadcom/ns2.dtsi | 12 ++++++++++++
 1 file changed, 12 insertions(+)
arch/arm64/boot/dts/broadcom/ns2.dtsi +12 -0
index d95dc40..8b81b0d 100644
@@ -191,6 +191,18 @@
 
 		#include "ns2-clock.dtsi"
 
+		spu-crypto at 612d0000 {
+			compatible = "brcm,spum-crypto";
+			reg = <0x612d0000 0x900>,    /* SPU 0 control regs */
+				<0x612f0000 0x900>,  /* SPU 1 control regs */
+				<0x61310000 0x900>,  /* SPU 2 control regs */
+				<0x61330000 0x900>;  /* SPU 3 control regs */
+			mboxes = <&pdc0 0>,
+				<&pdc1 0>,
+				<&pdc2 0>,
+				<&pdc3 0>;
+		};
+
 		dma0: dma at 61360000 {
 			compatible = "arm,pl330", "arm,primecell";
 			reg = <0x61360000 0x1000>;

--
2.1.0

#9 lore raw

Re: [PATCH 3/3] crypto: brcm: Add Broadcom SPU driver DT entry.

reproduce: wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree…

Hi Rob,

[auto build test ERROR on cryptodev/master]
[also build test ERROR on v4.9-rc8]
[cannot apply to next-20161209]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Rob-Rice/crypto-brcm-DT-documentation-for-Broadcom-SPU-driver/20161202-010038
base:   https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git master
config: arm64-defconfig (attached as .config)
compiler: aarch64-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705

reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=arm64

All errors (new ones prefixed by >>):

>> ERROR: Input tree has errors, aborting (use -f to force output)

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 31957 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20161211/bead5da1/attachment-0001.gz>

#10 lore raw

Re: [PATCH 3/3] crypto: brcm: Add Broadcom SPU driver DT entry.

I will rebase to Herbert's latest when I submit v3 to address Mark Rutland's DT comments (and any others that come in).

Rob

Quoted 23 lines · kbuild test robot

Hi Rob,

[auto build test ERROR on cryptodev/master]
[also build test ERROR on v4.9-rc8]
[cannot apply to next-20161209]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Rob-Rice/crypto-brcm-DT-documentation-for-Broadcom-SPU-driver/20161202-010038
base:   https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git master
config: arm64-defconfig (attached as .config)
compiler: aarch64-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705

reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=arm64

All errors (new ones prefixed by >>):

Quoted 1 line
Quoted 1 line

ERROR: Input tree has errors, aborting (use -f to force output)

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation