The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* Re: [PATCH] padlock: don't whinge when loaded on a non-VIA cpu
  2008-07-08 19:04 [PATCH] padlock: don't whinge when loaded on a non-VIA cpu Kyle McMartin
@ 2008-07-08 18:52 ` Alan Cox
  2008-07-08 19:37   ` Kyle McMartin
  2008-07-08 20:04 ` Krzysztof Halasa
  1 sibling, 1 reply; 7+ messages in thread
From: Alan Cox @ 2008-07-08 18:52 UTC (permalink / raw)
  To: kyle; +Cc: kmcmartin, linux-kernel

On Tue, 8 Jul 2008 15:04:27 -0400
Kyle McMartin <kmcmartin@redhat.com> wrote:

> I've become seriously tired of seeing these messages on every machine
> running an i386 Fedora kernel...
> 
> padlock: VIA PadLock not detected.
> padlock: VIA PadLock Hash Engine not detected.
> 
> So let's eliminate them!

Silly question - but why are they being printed even for older VIA
processors. We don't see the following on boot

i386: no CMOV instruction detected
i386: no SSE3 instruction detected

So I think your patch should be a bit more brutal ;)

Alan

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH] padlock: don't whinge when loaded on a non-VIA cpu
@ 2008-07-08 19:04 Kyle McMartin
  2008-07-08 18:52 ` Alan Cox
  2008-07-08 20:04 ` Krzysztof Halasa
  0 siblings, 2 replies; 7+ messages in thread
From: Kyle McMartin @ 2008-07-08 19:04 UTC (permalink / raw)
  To: linux-kernel

I've become seriously tired of seeing these messages on every machine
running an i386 Fedora kernel...

padlock: VIA PadLock not detected.
padlock: VIA PadLock Hash Engine not detected.

So let's eliminate them!

Signed-off-by: Kyle McMartin <kmcmartin@redhat.com>

---
diff --git a/drivers/crypto/padlock-aes.c b/drivers/crypto/padlock-aes.c
index bb30eb9..c11f456 100644
--- a/drivers/crypto/padlock-aes.c
+++ b/drivers/crypto/padlock-aes.c
@@ -384,6 +384,9 @@ static int __init padlock_init(void)
 {
 	int ret;
 
+	if (!(boot_cpu_data.x86_vendor == X86_VENDOR_CENTAUR))
+		return -ENODEV;
+
 	if (!cpu_has_xcrypt) {
 		printk(KERN_ERR PFX "VIA PadLock not detected.\n");
 		return -ENODEV;
diff --git a/drivers/crypto/padlock-sha.c b/drivers/crypto/padlock-sha.c
index c666b4e..9b360fb 100644
--- a/drivers/crypto/padlock-sha.c
+++ b/drivers/crypto/padlock-sha.c
@@ -253,6 +253,9 @@ static int __init padlock_init(void)
 {
 	int rc = -ENODEV;
 
+	if (!(boot_cpu_data.x86_vendor == X86_VENDOR_CENTAUR))
+		return -ENODEV;
+
 	if (!cpu_has_phe) {
 		printk(KERN_ERR PFX "VIA PadLock Hash Engine not detected.\n");
 		return -ENODEV;

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] padlock: don't whinge when loaded on a non-VIA cpu
  2008-07-08 18:52 ` Alan Cox
@ 2008-07-08 19:37   ` Kyle McMartin
  2008-07-08 21:21     ` Joe Perches
                       ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Kyle McMartin @ 2008-07-08 19:37 UTC (permalink / raw)
  To: Alan Cox; +Cc: kyle, kmcmartin, linux-kernel

On Tue, Jul 08, 2008 at 07:52:11PM +0100, Alan Cox wrote:
> On Tue, 8 Jul 2008 15:04:27 -0400
> Kyle McMartin <kmcmartin@redhat.com> wrote:
> 
> > I've become seriously tired of seeing these messages on every machine
> > running an i386 Fedora kernel...
> > 
> > padlock: VIA PadLock not detected.
> > padlock: VIA PadLock Hash Engine not detected.
> > 
> > So let's eliminate them!
> 
> Silly question - but why are they being printed even for older VIA
> processors. We don't see the following on boot
> 
> i386: no CMOV instruction detected
> i386: no SSE3 instruction detected
> 
> So I think your patch should be a bit more brutal ;)
> 

I completely agree, but I don't know anything about Centaur cpuids...

Something like this might suffice:

diff --git a/drivers/crypto/padlock-aes.c b/drivers/crypto/padlock-aes.c
index bb30eb9..0192de4 100644
--- a/drivers/crypto/padlock-aes.c
+++ b/drivers/crypto/padlock-aes.c
@@ -384,6 +384,10 @@ static int __init padlock_init(void)
 {
 	int ret;
 
+	if (!((boot_cpu_data.x86_vendor == X86_VENDOR_CENTAUR) &&
+	     (boot_cpu_data.x86 >= 6)))	/* only on VIA C3 and above */
+		return -ENODEV;
+
 	if (!cpu_has_xcrypt) {
 		printk(KERN_ERR PFX "VIA PadLock not detected.\n");
 		return -ENODEV;
diff --git a/drivers/crypto/padlock-sha.c b/drivers/crypto/padlock-sha.c
index c666b4e..70ec14b 100644
--- a/drivers/crypto/padlock-sha.c
+++ b/drivers/crypto/padlock-sha.c
@@ -253,6 +253,10 @@ static int __init padlock_init(void)
 {
 	int rc = -ENODEV;
 
+	if (!((boot_cpu_data.x86_vendor == X86_VENDOR_CENTAUR) &&
+	     (boot_cpu_data.x86 >= 6)))	/* only on VIA C3 and above */
+		return -ENODEV;
+
 	if (!cpu_has_phe) {
 		printk(KERN_ERR PFX "VIA PadLock Hash Engine not detected.\n");
 		return -ENODEV;

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] padlock: don't whinge when loaded on a non-VIA cpu
  2008-07-08 19:04 [PATCH] padlock: don't whinge when loaded on a non-VIA cpu Kyle McMartin
  2008-07-08 18:52 ` Alan Cox
@ 2008-07-08 20:04 ` Krzysztof Halasa
  1 sibling, 0 replies; 7+ messages in thread
From: Krzysztof Halasa @ 2008-07-08 20:04 UTC (permalink / raw)
  To: kyle; +Cc: linux-kernel

Kyle McMartin <kmcmartin@redhat.com> writes:

> --- a/drivers/crypto/padlock-aes.c
> +++ b/drivers/crypto/padlock-aes.c
> @@ -384,6 +384,9 @@ static int __init padlock_init(void)
>  {
>  	int ret;
>  
> +	if (!(boot_cpu_data.x86_vendor == X86_VENDOR_CENTAUR))
> +		return -ENODEV;
> +

BTW C has "!=" operator, may be useful.
-- 
Krzysztof Halasa

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] padlock: don't whinge when loaded on a non-VIA cpu
  2008-07-08 19:37   ` Kyle McMartin
@ 2008-07-08 21:21     ` Joe Perches
  2008-07-08 22:08     ` Rik van Riel
  2008-07-09  5:58     ` Herbert Xu
  2 siblings, 0 replies; 7+ messages in thread
From: Joe Perches @ 2008-07-08 21:21 UTC (permalink / raw)
  To: Kyle McMartin; +Cc: Alan Cox, kmcmartin, linux-kernel

On Tue, 2008-07-08 at 15:37 -0400, Kyle McMartin wrote:
> diff --git a/drivers/crypto/padlock-sha.c b/drivers/crypto/padlock-sha.c
> index c666b4e..70ec14b 100644
> --- a/drivers/crypto/padlock-sha.c
> +++ b/drivers/crypto/padlock-sha.c
> @@ -253,6 +253,10 @@ static int __init padlock_init(void)
>  {
>  	int rc = -ENODEV;
>  
> +	if (!((boot_cpu_data.x86_vendor == X86_VENDOR_CENTAUR) &&
> +	     (boot_cpu_data.x86 >= 6)))	/* only on VIA C3 and above */
> +		return -ENODEV;
> +
>  	if (!cpu_has_phe) {
>  		printk(KERN_ERR PFX "VIA PadLock Hash Engine not detected.\n");
>  		return -ENODEV;

int rc doesn't need to be initialized to -ENODEV either.

diff --git a/drivers/crypto/padlock-sha.c b/drivers/crypto/padlock-sha.c
--- a/drivers/crypto/padlock-sha.c
+++ b/drivers/crypto/padlock-sha.c
@@ -251,7 +251,7 @@ static struct crypto_alg sha256_alg = {
 
 static int __init padlock_init(void)
 {
-	int rc = -ENODEV;
+	int rc;
 
 	if (!cpu_has_phe) {
 		printk(KERN_ERR PFX "VIA PadLock Hash Engine not detected.\n");



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] padlock: don't whinge when loaded on a non-VIA cpu
  2008-07-08 19:37   ` Kyle McMartin
  2008-07-08 21:21     ` Joe Perches
@ 2008-07-08 22:08     ` Rik van Riel
  2008-07-09  5:58     ` Herbert Xu
  2 siblings, 0 replies; 7+ messages in thread
From: Rik van Riel @ 2008-07-08 22:08 UTC (permalink / raw)
  To: Kyle McMartin; +Cc: Alan Cox, kyle, kmcmartin, linux-kernel

On Tue, 8 Jul 2008 15:37:41 -0400
Kyle McMartin <kyle@mcmartin.ca> wrote:

> +	if (!((boot_cpu_data.x86_vendor == X86_VENDOR_CENTAUR) &&
> +	     (boot_cpu_data.x86 >= 6)))	/* only on VIA C3 and above */
> +		return -ENODEV;

Why add this?

>  	if (!cpu_has_xcrypt) {
>  		printk(KERN_ERR PFX "VIA PadLock not detected.\n");
>  		return -ENODEV;

When you could simply delete the printk lines?

-- 
All rights reversed.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] padlock: don't whinge when loaded on a non-VIA cpu
  2008-07-08 19:37   ` Kyle McMartin
  2008-07-08 21:21     ` Joe Perches
  2008-07-08 22:08     ` Rik van Riel
@ 2008-07-09  5:58     ` Herbert Xu
  2 siblings, 0 replies; 7+ messages in thread
From: Herbert Xu @ 2008-07-09  5:58 UTC (permalink / raw)
  To: Kyle McMartin; +Cc: alan, kyle, kmcmartin, linux-kernel, linux-crypto

Kyle McMartin <kyle@mcmartin.ca> wrote:
> 
> I completely agree, but I don't know anything about Centaur cpuids...
> 
> Something like this might suffice:

Please base your patch on top of cryptodev-2.6 which already has
a fix on this from Jeremy Katz.  Also I suggest you either remove
the printk completely or invert it so that it prints something
when the hardware is detected.

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2008-07-09  5:58 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-08 19:04 [PATCH] padlock: don't whinge when loaded on a non-VIA cpu Kyle McMartin
2008-07-08 18:52 ` Alan Cox
2008-07-08 19:37   ` Kyle McMartin
2008-07-08 21:21     ` Joe Perches
2008-07-08 22:08     ` Rik van Riel
2008-07-09  5:58     ` Herbert Xu
2008-07-08 20:04 ` Krzysztof Halasa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox