Skip to contentSkip to conversation

driver: char: bfin_crc: CRC hardware accelerator driver for BF60x family processors.

PATCH In review [email protected] 3 participants 7 messages May 16, 2012 – May 17, 2012 Char and misc drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 driver: char: bfin_crc: CRC hardware accelerator driver for BF60x family processors.

From: Sonic Zhang <[email protected]>

The CRC peripheral is a hardware block used to compute the CRC of the block of data. This is based on a CRC32 engine which computes the CRC value of 32b data words presented to it. For data words of < 32b in size, it is the responsibility of the application to pack the data into 32b data units.

This driver defines data strcture crc_info and 4 IOCTL interfaces for applciations.
1) CRC Memory Scan
2) CRC Memory Transfer
3) CRC Data Verify
4) CRC Data Fill

---
 drivers/char/Kconfig    |    8 +
 drivers/char/Makefile   |    1 +
 drivers/char/bfin_crc.c |  537 +++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 546 insertions(+), 0 deletions(-)
 create mode 100644 drivers/char/bfin_crc.c
drivers/char/Kconfig +8 -0
index ee94686..69980ea 100644
@@ -94,6 +94,14 @@ config BFIN_OTP_WRITE_ENABLE
 
 	  If unsure, say N.
 
+config BFIN_CRC
+	tristate "Blackfin hardware CRC driver"
+	depends on BF60x
+	default y
+	help
+	  This is a hardware CRC driver for BF60x. It is added to accelerate
+	  CRC calculation individually or within DMA in user applications.
+
 config PRINTER
 	tristate "Parallel printer support"
 	depends on PARPORT
drivers/char/Makefile +1 -0
index 0dc5d7c..500033e 100644
@@ -17,6 +17,7 @@ obj-$(CONFIG_VIOTAPE)		+= viotape.o
 obj-$(CONFIG_IBM_BSR)		+= bsr.o
 obj-$(CONFIG_SGI_MBCS)		+= mbcs.o
 obj-$(CONFIG_BFIN_OTP)		+= bfin-otp.o
+obj-$(CONFIG_BFIN_CRC)		+= bfin_crc.o
 
 obj-$(CONFIG_PRINTER)		+= lp.o
 
drivers/char/bfin_crc.c new file +537 -0

537 lines not on this page · raw message

Signature · 1 line
1.7.0.4
#1 lore raw
Quoted 13 lines · On Wed, May 16, 2012 at 04:26:07PM +0800, [email protected] wrote:

From: Sonic Zhang <[email protected]>

The CRC peripheral is a hardware block used to compute the CRC of the block of data. This is based on a CRC32 engine which computes the CRC value of 32b data words presented to it. For data words of < 32b in size, it is the responsibility of the application to pack the data into 32b data units.

This driver defines data strcture crc_info and 4 IOCTL interfaces for applciations.
1) CRC Memory Scan
2) CRC Memory Transfer
3) CRC Data Verify
4) CRC Data Fill

Quoted 7 lines
---
 drivers/char/Kconfig    |    8 +
 drivers/char/Makefile   |    1 +
 drivers/char/bfin_crc.c |  537 +++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 546 insertions(+), 0 deletions(-)
 create mode 100644 drivers/char/bfin_crc.c

Why is this a char driver, and not a crypto driver, using the existing crypto userspace api for things like this?

drivers/char/bfin_crc.c line 6

Quoted 12 lines
drivers/char/bfin_crc.c new file +6 -0
new file mode 100644
index 0000000..3f7d1d8
@@ -0,0 +1,537 @@
+/*
+ * Blackfin On-Chip hardware CRC Driver
+ *
+ * Copyright 2011 Analog Devices Inc.
+ *
+ * Licensed under the GPL-2 or later.

Do you really mean "or later"? It's fine if you do, just checking.

thanks,

greg k-h

maintainer
#2 lore raw
Quoted 22 lines · Greg Kroah-Hartman
Quoted 13 lines · On Wed, May 16, 2012 at 04:26:07PM +0800, [email protected] wrote:

From: Sonic Zhang <[email protected]>

The CRC peripheral is a hardware block used to compute the CRC of the block of data. This is based on a CRC32 engine which computes the CRC value of 32b data words presented to it. For data words of < 32b in size, it is the responsibility of the application to pack the data into 32b data units.

This driver defines data strcture crc_info and 4 IOCTL interfaces for applciations.
1) CRC Memory Scan
2) CRC Memory Transfer
3) CRC Data Verify
4) CRC Data Fill

Quoted 7 lines
---
 drivers/char/Kconfig    |    8 +
 drivers/char/Makefile   |    1 +
 drivers/char/bfin_crc.c |  537 +++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 546 insertions(+), 0 deletions(-)
 create mode 100644 drivers/char/bfin_crc.c
Quoted 2 lines

Why is this a char driver, and not a crypto driver, using the existing crypto userspace api for things like this?

Do we have a userspace crypto API these days? The last I remember every attempt to add one so far was abandoned before it got merged. There is drivers/s390/crypto/zcrypt*, which has a nonportable API, and then there is the in-kernel crypto layer in drivers/crypto that has no user interface at all.

I agree that having another private driver for bfin_crc is not a good idea, but I also don't have a better one.

About the driver itself, the submission seems incomplete (missing at least the bfin_crc.h file) and the driver has a number of shortcomings that we should discuss in case we decide to merge it.

Arnd

#3 lore raw
Quoted 23 lines · Arnd Bergmann
Quoted 22 lines · Greg Kroah-Hartman
Quoted 20 lines · On Wed, May 16, 2012 at 04:26:07PM +0800, [email protected] wrote:

From: Sonic Zhang <[email protected]>

The CRC peripheral is a hardware block used to compute the CRC of the block of data. This is based on a CRC32 engine which computes the CRC value of 32b data words presented to it. For data words of < 32b in size, it is the responsibility of the application to pack the data into 32b data units.

This driver defines data strcture crc_info and 4 IOCTL interfaces for applciations.
1) CRC Memory Scan
2) CRC Memory Transfer
3) CRC Data Verify
4) CRC Data Fill

---
 drivers/char/Kconfig    |    8 +
 drivers/char/Makefile   |    1 +
 drivers/char/bfin_crc.c |  537 +++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 546 insertions(+), 0 deletions(-)
 create mode 100644 drivers/char/bfin_crc.c
Quoted 8 lines
Quoted 2 lines

Why is this a char driver, and not a crypto driver, using the existing crypto userspace api for things like this?

Do we have a userspace crypto API these days? The last I remember every attempt to add one so far was abandoned before it got merged. There is drivers/s390/crypto/zcrypt*, which has a nonportable API, and then there is the in-kernel crypto layer in drivers/crypto that has no user interface at all.

What is CONFIG_CRYPTO_USER for then, with the matching, crypto/crypto_user.c file?

Quoted 6 lines

I agree that having another private driver for bfin_crc is not a good idea, but I also don't have a better one.

About the driver itself, the submission seems incomplete (missing at least the bfin_crc.h file) and the driver has a number of shortcomings that we should discuss in case we decide to merge it.

I suggest at least tieing into the in-kernel crypto api first, and then worrying about the userspace side of things, right?

thanks,

greg k-h

maintainer
#4 lore raw
Quoted 8 lines · Greg Kroah-Hartman
Quoted 5 lines

Do we have a userspace crypto API these days? The last I remember every attempt to add one so far was abandoned before it got merged. There is drivers/s390/crypto/zcrypt*, which has a nonportable API, and then there is the in-kernel crypto layer in drivers/crypto that has no user interface at all.

What is CONFIG_CRYPTO_USER for then, with the matching, crypto/crypto_user.c file?

Ah, I completely missed that going in and looked in the wrong place when trying to find it now (/drivers/crypto, not /crypto). I'm glad that part is resolved.

Quoted 9 lines
Quoted 6 lines

I agree that having another private driver for bfin_crc is not a good idea, but I also don't have a better one.

About the driver itself, the submission seems incomplete (missing at least the bfin_crc.h file) and the driver has a number of shortcomings that we should discuss in case we decide to merge it.

I suggest at least tieing into the in-kernel crypto api first, and then worrying about the userspace side of things, right?

Absolutely.

Arnd

#5 lore raw
In reply to Greg Kroah-Hartman

Hi Greg,

Quoted 27 lines

-----Original Message-----
From: Greg Kroah-Hartman [mailto:[email protected]]
Sent: Wednesday, May 16, 2012 8:13 PM
To: Zhang, Sonic
Cc: Arnd Bergmann; LKML; [email protected]
Subject: Re: [PATCH] driver: char: bfin_crc: CRC hardware accelerator driver for BF60x family processors.

Quoted 13 lines · On Wed, May 16, 2012 at 04:26:07PM +0800, [email protected] wrote:

From: Sonic Zhang <[email protected]>

The CRC peripheral is a hardware block used to compute the CRC of the block of data. This is based on a CRC32 engine which computes the CRC value of 32b data words presented to it. For data words of < 32b in size, it is the responsibility of the application to pack the data into 32b data units.

This driver defines data strcture crc_info and 4 IOCTL interfaces for applciations.
1) CRC Memory Scan
2) CRC Memory Transfer
3) CRC Data Verify
4) CRC Data Fill

Quoted 5 lines
---
 drivers/char/Kconfig    |    8 +
 drivers/char/Makefile   |    1 +
 drivers/char/bfin_crc.c |  537
Quoted 7 lines

+++++++++++++++++++++++++++++++++++++++++++++++

Quoted 2 lines
 3 files changed, 546 insertions(+), 0 deletions(-)
 create mode 100644 drivers/char/bfin_crc.c

Why is this a char driver, and not a crypto driver, using the existing crypto userspace api for things like this?

It looks only the CRC memory scan mode can be implemented as a crypto ahash driver. The other 3 functions are not supported in the crypto framework. I will post a crypto driver for the CRC memory scan mode later.

Sonic

Quoted 18 lines

drivers/char/bfin_crc.c line 6

Quoted 12 lines
drivers/char/bfin_crc.c new file +6 -0
new file mode 100644
index 0000000..3f7d1d8
@@ -0,0 +1,537 @@
+/*
+ * Blackfin On-Chip hardware CRC Driver
+ *
+ * Copyright 2011 Analog Devices Inc.
+ *
+ * Licensed under the GPL-2 or later.

Do you really mean "or later"? It's fine if you do, just checking.

thanks,

greg k-h

#6 lore raw
Quoted 33 lines · Sonic

Hi Greg,

Quoted 31 lines

-----Original Message-----
From: Greg Kroah-Hartman [mailto:[email protected]]
Sent: Wednesday, May 16, 2012 8:13 PM
To: Zhang, Sonic
Cc: Arnd Bergmann; LKML; [email protected]
Subject: Re: [PATCH] driver: char: bfin_crc: CRC hardware accelerator driver for BF60x family processors.

Quoted 13 lines · On Wed, May 16, 2012 at 04:26:07PM +0800, [email protected] wrote:

From: Sonic Zhang <[email protected]>

The CRC peripheral is a hardware block used to compute the CRC of the block of data. This is based on a CRC32 engine which computes the CRC value of 32b data words presented to it. For data words of < 32b in size, it is the responsibility of the application to pack the data into 32b data units.

This driver defines data strcture crc_info and 4 IOCTL interfaces for applciations.
1) CRC Memory Scan
2) CRC Memory Transfer
3) CRC Data Verify
4) CRC Data Fill

Quoted 5 lines
---
 drivers/char/Kconfig    |    8 +
 drivers/char/Makefile   |    1 +
 drivers/char/bfin_crc.c |  537

+++++++++++++++++++++++++++++++++++++++++++++++

Quoted 2 lines
 3 files changed, 546 insertions(+), 0 deletions(-)
 create mode 100644 drivers/char/bfin_crc.c
Quoted 8 lines
Quoted 3 lines

Why is this a char driver, and not a crypto driver, using the existing crypto userspace api for things like this?

It looks only the CRC memory scan mode can be implemented as a crypto ahash driver. The other 3 functions are not supported in the crypto framework. I will post a crypto driver for the CRC memory scan mode later.

Then why not extend the crypto framework to handle these 3 other functions?

greg k-h