Skip to contentSkip to conversation

Testing the geode-aes driver with the tcrypt module completely freezes the machine

DISCUSSION Martin Schiller 4 participants 8 messages Apr 26, 2007 – May 3, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hello,

here is what I do:

- I have an AEWIN CB-6971 with an AMD Geode LX800.

- Testing with kernel 2.6.21-rc7-git5.

- When the geode_aes module is loaded and I am loading the tcrypt module, the machine freezes completely.

- When the geode_aes module is NOT loaded and I am loading the tcrypt module,
the test works well.

Has anyone else tried to test the geode-aes driver with the tcrypt module?

I am also not able to use the geode-aes driver with openswan-2.4.7 on kernel 2.6.19 (with patched-in geode driver).

Regards,
Martin

--------------------------

Martin Schiller
Dipl.-Inf. FH
Development

T.D.T. Transfer Data Test GmbH
Siemensstrasse 18
Gewerbegebiet Altheim
84051 Essenbach
Germany

[email protected]
www.tdt.de

tel: +49 8703 929 00
fax: +49 8703 929 201

Geschäftsführer: Elisabeth Pickhardt & Michael Pickhardt Registergericht Landshut, HRB: 1193

#1 lore raw
Quoted 2 lines · * Martin Schiller | 2007-04-26 11:04:21 [+0200]:

- When the geode_aes module is loaded and I am loading the tcrypt module, the machine freezes completely.

could you modify the tcrpto module to test only ecb(aes) enc/dec with keysize = 16 (1 instead of AES_ENC_TEST_VECTORS) and see if it is still freezing?

Sebastian

#2 lore raw
Quoted 9 lines · Sebastian Siewior
Quoted 2 lines · * Martin Schiller | 2007-04-26 11:04:21 [+0200]:

- When the geode_aes module is loaded and I am loading the tcrypt module, the machine freezes completely.

could you modify the tcrpto module to test only ecb(aes) enc/dec with keysize = 16 (1 instead of AES_ENC_TEST_VECTORS) and see if it is still freezing?

Tried it and it's still freezing.

Any other suggestions?

Regards,
Martin

--------------------------------
Martin Schiller
Dipl.-Inf. FH
Entwicklung / Development

T.D.T. Transfer Data Test GmbH
Siemensstrasse 18
Gewerbegebiet Altheim
84051 Essenbach
Germany

[email protected]
www.tdt.de

tel: +49 8703 929 00
fax: +49 8703 929 201

Geschäftsführer: Elisabeth Pickhardt & Michael Pickhardt Registergericht Landshut, HRB: 1193

maintainer
#3 lore raw
In reply to Martin Schiller
Quoted 10 lines · Martin Schiller

here is what I do:

- I have an AEWIN CB-6971 with an AMD Geode LX800.

- Testing with kernel 2.6.21-rc7-git5.

- When the geode_aes module is loaded and I am loading the tcrypt module, the machine freezes completely.

Quoted 8 lines

- When the geode_aes module is NOT loaded and I am loading the tcrypt module,
the test works well.

Has anyone else tried to test the geode-aes driver with the tcrypt module?

I am also not able to use the geode-aes driver with openswan-2.4.7 on kernel 2.6.19 (with patched-in geode driver).

Jordan, do you have any ideas why this is happening?

Cheers,

Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
#4 lore raw
Quoted 6 lines · Herbert Xu
Quoted 4 lines

Has anyone else tried to test the geode-aes driver with the tcrypt module?

I am also not able to use the geode-aes driver with openswan-2.4.7 on kernel 2.6.19 (with patched-in geode driver).

Jordan, do you have any ideas why this is happening?

Could it be compiler problem and broken hardware?
Martin, can you test attached patch?

drivers/crypto/geode-aes.c +4 -2
index 6d3840e..724169b 100644
@@ -78,7 +78,7 @@ static int
 do_crypt(void *src, void *dst, int len, u32 flags)
 {
 	u32 status;
-	u32 counter = AES_OP_TIMEOUT;
+	int counter = AES_OP_TIMEOUT;
 
 	iowrite32(virt_to_phys(src), _iobase + AES_SOURCEA_REG);
 	iowrite32(virt_to_phys(dst), _iobase + AES_DSTA_REG);
@@ -89,7 +89,9 @@ do_crypt(void *src, void *dst, int len, u32 flags)
 
 	do
 		status = ioread32(_iobase + AES_INTR_REG);
-	while(!(status & AES_INTRA_PENDING) && --counter);
+	while(--counter > 0 && !(status & AES_INTRA_PENDING));
+
+	WARN_ON(!counter);
 
 	/* Clear the event */
 	iowrite32((status & 0xFF) | AES_INTRA_PENDING, _iobase + AES_INTR_REG);
Signature · 1 line
	Evgeniy Polyakov
#5 lore raw
Quoted 10 lines · Evgeniy Polyakov
Quoted 6 lines · Herbert Xu
Quoted 4 lines

Has anyone else tried to test the geode-aes driver with the tcrypt module?

I am also not able to use the geode-aes driver with openswan-2.4.7 on kernel 2.6.19 (with patched-in geode driver).

Jordan, do you have any ideas why this is happening?

Could it be compiler problem and broken hardware?
Martin, can you test attached patch?

Or better this one:

drivers/crypto/geode-aes.c +4 -2
index 6d3840e..724169b 100644
@@ -78,7 +78,7 @@ static int
 do_crypt(void *src, void *dst, int len, u32 flags)
 {
 	u32 status;
-	u32 counter = AES_OP_TIMEOUT;
+	int counter = 0x1000;
 
 	iowrite32(virt_to_phys(src), _iobase + AES_SOURCEA_REG);
 	iowrite32(virt_to_phys(dst), _iobase + AES_DSTA_REG);
@@ -89,7 +89,9 @@ do_crypt(void *src, void *dst, int len, u32 flags)
 
 	do
 		status = ioread32(_iobase + AES_INTR_REG);
-	while(!(status & AES_INTRA_PENDING) && --counter);
+	while(--counter > 0 && !(status & AES_INTRA_PENDING));
+
+	WARN_ON(!counter);
 
 	/* Clear the event */
 	iowrite32((status & 0xFF) | AES_INTRA_PENDING, _iobase + AES_INTR_REG);
Signature · 1 line
	Evgeniy Polyakov
#6 lore raw
In reply to Herbert Xu
Quoted 19 lines · Evgeniy Polyakov
Quoted 2 lines

Could it be compiler problem and broken hardware?
Martin, can you test attached patch?

Or better this one:

drivers/crypto/geode-aes.c +1 -1
index 6d3840e..724169b 100644
@@ -78,7 +78,7 @@ static int
 do_crypt(void *src, void *dst, int len, u32 flags)
 {
       u32 status;
-       u32 counter = AES_OP_TIMEOUT;
+       int counter = 0x1000;
 
       iowrite32(virt_to_phys(src), _iobase + AES_SOURCEA_REG);
       iowrite32(virt_to_phys(dst), _iobase + AES_DSTA_REG);

drivers/crypto/geode-aes.c do_crypt(void *src, void *dst, int len, u32 flags) · line 97

Quoted 10 lines
drivers/crypto/geode-aes.c +3 -1
@@ -89,7 +89,9 @@ do_crypt(void *src, void *dst, int len, u32 flags)
 
       do
               status = ioread32(_iobase + AES_INTR_REG);
-       while(!(status & AES_INTRA_PENDING) && --counter);
+       while(--counter > 0 && !(status & AES_INTRA_PENDING));
+
+       WARN_ON(!counter);
 
       /* Clear the event */
       iowrite32((status & 0xFF) | AES_INTRA_PENDING, _iobase +

AES_INTR_REG);

Quoted 1 line

Hi Evgeniy,

Sorry for my late answer, but I didn't get your message because I haven't subscribed to the mailing-list.
I've "found" it yesterday on the mailing-list archive. So please, could you reply directly to me and to the mailing-list on any further messages?

I've tested the patch now, but nothing changed. When doing any aes cipher tests with the tcrypt test module, the machine freezes without any error.

Regards,
Martin

#7 lore raw
Quoted 1 line · Martin Schiller

Hi Evgeniy,

Hi Martin.

Quoted 4 lines

Sorry for my late answer, but I didn't get your message because I haven't subscribed to the mailing-list.
I've "found" it yesterday on the mailing-list archive. So please, could you reply directly to me and to the mailing-list on any further messages?

I did, but your mail server bounced message.
This message is also sent to you directly, hope it will pass through. Btw, AMD list bounces too.

Quoted 2 lines

I've tested the patch now, but nothing changed. When doing any aes cipher tests with the tcrypt test module, the machine freezes without any error.

Hmm, that means that main waiting loop of the driver is not an issue. Since it is PCI, likely bus is locked by incorrect written value into the space. Can you run with this patch (it will freeze too, but at least with some useful info), since AMD keeps silence, we will go hard way:

drivers/crypto/geode-aes.c +13 -2
index 6d3840e..6ddfab9 100644
@@ -61,8 +61,10 @@ static inline void
 _writefield(u32 offset, void *value)
 {
 	int i;
+	printk("%s: start, offset: %x.\n", __func__, offset);
 	for(i = 0; i < 4; i++)
 		iowrite32(((u32 *) value)[i], _iobase + offset + (i * 4));
+	printk("%s: finish, offset: %x.\n", __func__, offset);
 }
 
 /* Read a 128 bit field (either a writable key or IV) */
@@ -70,8 +72,10 @@ static inline void
 _readfield(u32 offset, void *value)
 {
 	int i;
+	printk("%s: start, offset: %x.\n", __func__, offset);
 	for(i = 0; i < 4; i++)
 		((u32 *) value)[i] = ioread32(_iobase + offset + (i * 4));
+	printk("%s: finish, offset: %x.\n", __func__, offset);
 }
 
 static int
@@ -80,19 +84,24 @@ do_crypt(void *src, void *dst, int len, u32 flags)
 	u32 status;
 	u32 counter = AES_OP_TIMEOUT;
 
+	printk("%s: src: %p, dst: %p, len: %d, flags: %x\n", __func__, src, dst, len, flags);
 	iowrite32(virt_to_phys(src), _iobase + AES_SOURCEA_REG);
 	iowrite32(virt_to_phys(dst), _iobase + AES_DSTA_REG);
 	iowrite32(len,  _iobase + AES_LENA_REG);
 
+	printk("%s: start op, likely will freeze.\n", __func__);
 	/* Start the operation */
 	iowrite32(AES_CTRL_START | flags, _iobase + AES_CTRLA_REG);
+	printk("%s: started, but we are stil alive.\n", __func__);
 
-	do
+	do {
 		status = ioread32(_iobase + AES_INTR_REG);
-	while(!(status & AES_INTRA_PENDING) && --counter);
+		printk("%s: status: %x, counter: %u.\n", __func__, status, counter);
+	} while(!(status & AES_INTRA_PENDING) && --counter);
 
 	/* Clear the event */
 	iowrite32((status & 0xFF) | AES_INTRA_PENDING, _iobase + AES_INTR_REG);
+	printk("%s: completed.\n", __func__);
 	return counter ? 0 : 1;
 }
 
@@ -113,6 +122,7 @@ geode_aes_crypt(struct geode_aes_op *op)
 
 	/* Start the critical section */
 
+	printk("%s: start.\n", __func__);
 	spin_lock_irqsave(&lock, iflags);
 
 	if (op->mode == AES_MODE_CBC) {
@@ -131,6 +141,7 @@ geode_aes_crypt(struct geode_aes_op *op)
 		_readfield(AES_WRITEIV0_REG, op->iv);
 
 	spin_unlock_irqrestore(&lock, iflags);
+	printk("%s: completed.\n", __func__);
 
 	return op->len;
 }
Signature · 1 line
	Evgeniy Polyakov