public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* s390 kvm_virtio.c build error
@ 2008-05-03 17:47 Adrian Bunk
  2008-05-04 19:25 ` Heiko Carstens
  2008-05-05  0:19 ` Rusty Russell
  0 siblings, 2 replies; 10+ messages in thread
From: Adrian Bunk @ 2008-05-03 17:47 UTC (permalink / raw)
  To: Christian Borntraeger, Martin Schwidefsky, Carsten Otte,
	Avi Kivity, Rusty Russell
  Cc: kvm-devel, linux-s390, linux-kernel

Commit c45a6816c19dee67b8f725e6646d428901a6dc24
(virtio: explicit advertisement of driver features)
and commit e976a2b997fc4ad70ccc53acfe62811c4aaec851
(s390: KVM guest: virtio device support, and kvm hypercalls)
don't like each other:

<--  snip  -->

...
  CC      drivers/s390/kvm/kvm_virtio.o
/home/bunk/linux/kernel-2.6/git/linux-2.6/drivers/s390/kvm/kvm_virtio.c:224: error: unknown field 'feature' specified in initializer
/home/bunk/linux/kernel-2.6/git/linux-2.6/drivers/s390/kvm/kvm_virtio.c:224: warning: initialization from incompatible pointer type
make[3]: *** [drivers/s390/kvm/kvm_virtio.o] Error 1

<--  snip  -->

cu
Adrian

-- 

       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed

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

* Re: s390 kvm_virtio.c build error
  2008-05-03 17:47 s390 kvm_virtio.c build error Adrian Bunk
@ 2008-05-04 19:25 ` Heiko Carstens
  2008-05-05 12:29   ` Christian Borntraeger
  2008-05-05  0:19 ` Rusty Russell
  1 sibling, 1 reply; 10+ messages in thread
From: Heiko Carstens @ 2008-05-04 19:25 UTC (permalink / raw)
  To: Adrian Bunk
  Cc: Carsten Otte, linux-s390, kvm-devel, linux-kernel, Avi Kivity,
	Christian Borntraeger, Martin Schwidefsky

On Sat, May 03, 2008 at 08:47:17PM +0300, Adrian Bunk wrote:
> Commit c45a6816c19dee67b8f725e6646d428901a6dc24
> (virtio: explicit advertisement of driver features)
> and commit e976a2b997fc4ad70ccc53acfe62811c4aaec851
> (s390: KVM guest: virtio device support, and kvm hypercalls)
> don't like each other:
> 
> <--  snip  -->
> 
> ...
>   CC      drivers/s390/kvm/kvm_virtio.o
> /home/bunk/linux/kernel-2.6/git/linux-2.6/drivers/s390/kvm/kvm_virtio.c:224: error: unknown field 'feature' specified in initializer
> /home/bunk/linux/kernel-2.6/git/linux-2.6/drivers/s390/kvm/kvm_virtio.c:224: warning: initialization from incompatible pointer type
> make[3]: *** [drivers/s390/kvm/kvm_virtio.o] Error 1
> 
> <--  snip  -->

Hmm... this should help:

---
 drivers/s390/kvm/kvm_virtio.c |   40 +++++++++++++++++++++++-----------------
 1 file changed, 23 insertions(+), 17 deletions(-)

Index: linux-2.6/drivers/s390/kvm/kvm_virtio.c
===================================================================
--- linux-2.6.orig/drivers/s390/kvm/kvm_virtio.c
+++ linux-2.6/drivers/s390/kvm/kvm_virtio.c
@@ -78,27 +78,32 @@ static unsigned desc_size(const struct k
 		+ desc->config_len;
 }
 
-/*
- * This tests (and acknowleges) a feature bit.
- */
-static bool kvm_feature(struct virtio_device *vdev, unsigned fbit)
+/* This gets the device's feature bits. */
+static u32 kvm_get_features(struct virtio_device *vdev)
 {
+	unsigned int i;
+	u32 features = 0;
 	struct kvm_device_desc *desc = to_kvmdev(vdev)->desc;
-	u8 *features;
+	u8 *in_features = kvm_vq_features(desc);
 
-	if (fbit / 8 > desc->feature_len)
-		return false;
+	for (i = 0; i < min(desc->feature_len * 8, 32); i++)
+		if (in_features[i / 8] & (1 << (i % 8)))
+			features |= (1 << i);
+	return features;
+}
 
-	features = kvm_vq_features(desc);
-	if (!(features[fbit / 8] & (1 << (fbit % 8))))
-		return false;
+static void kvm_set_features(struct virtio_device *vdev, u32 features)
+{
+	unsigned int i;
+	struct kvm_device_desc *desc = to_kvmdev(vdev)->desc;
+	/* Second half of bitmap is features we accept. */
+	u8 *out_features = kvm_vq_features(desc) + desc->feature_len;
 
-	/*
-	 * We set the matching bit in the other half of the bitmap to tell the
-	 * Host we want to use this feature.
-	 */
-	features[desc->feature_len + fbit / 8] |= (1 << (fbit % 8));
-	return true;
+	memset(out_features, 0, desc->feature_len);
+	for (i = 0; i < min(desc->feature_len * 8, 32); i++) {
+		if (features & (1 << i))
+			out_features[i / 8] |= (1 << (i % 8));
+	}
 }
 
 /*
@@ -221,7 +226,8 @@ static void kvm_del_vq(struct virtqueue 
  * The config ops structure as defined by virtio config
  */
 static struct virtio_config_ops kvm_vq_configspace_ops = {
-	.feature = kvm_feature,
+	.get_features = kvm_get_features,
+	.set_features = kvm_set_features,
 	.get = kvm_get,
 	.set = kvm_set,
 	.get_status = kvm_get_status,

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone

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

* Re: s390 kvm_virtio.c build error
  2008-05-03 17:47 s390 kvm_virtio.c build error Adrian Bunk
  2008-05-04 19:25 ` Heiko Carstens
@ 2008-05-05  0:19 ` Rusty Russell
  1 sibling, 0 replies; 10+ messages in thread
From: Rusty Russell @ 2008-05-05  0:19 UTC (permalink / raw)
  To: Adrian Bunk
  Cc: linux-s390, Carsten Otte, kvm-devel, linux-kernel, Avi Kivity,
	Christian Borntraeger, Martin Schwidefsky

On Sunday 04 May 2008 03:47:17 Adrian Bunk wrote:
> Commit c45a6816c19dee67b8f725e6646d428901a6dc24
> (virtio: explicit advertisement of driver features)
> and commit e976a2b997fc4ad70ccc53acfe62811c4aaec851
> (s390: KVM guest: virtio device support, and kvm hypercalls)
> don't like each other:

Yep, I broke s390.  This was kind of expected, but I didn't want to try to
fix it as I am unable to test.

It would look something like this:

virtio: Attempt to fix kvm_virtio after feature management changes

Very similar to lguest code: set and get feature are now separate callbacks.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

diff -r 219d6c116996 drivers/s390/kvm/kvm_virtio.c
--- a/drivers/s390/kvm/kvm_virtio.c	Mon May 05 10:03:16 2008 +1000
+++ b/drivers/s390/kvm/kvm_virtio.c	Mon May 05 10:17:25 2008 +1000
@@ -78,27 +78,34 @@ static unsigned desc_size(const struct k
 		+ desc->config_len;
 }
 
-/*
- * This tests (and acknowleges) a feature bit.
- */
-static bool kvm_feature(struct virtio_device *vdev, unsigned fbit)
+/* This gets the device's feature bits. */
+static u32 kvm_get_features(struct virtio_device *vdev)
 {
+	unsigned int i;
+	u32 features = 0;
 	struct kvm_device_desc *desc = to_kvmdev(vdev)->desc;
-	u8 *features;
+	u8 *in_features = kvm_vq_features(desc);
 
-	if (fbit / 8 > desc->feature_len)
-		return false;
+	/* We do this the slow but generic way. */
+	for (i = 0; i < min(desc->feature_len * 8, 32); i++)
+		if (in_features[i / 8] & (1 << (i % 8)))
+			features |= (1 << i);
 
-	features = kvm_vq_features(desc);
-	if (!(features[fbit / 8] & (1 << (fbit % 8))))
-		return false;
+	return features;
+}
 
-	/*
-	 * We set the matching bit in the other half of the bitmap to tell the
-	 * Host we want to use this feature.
-	 */
-	features[desc->feature_len + fbit / 8] |= (1 << (fbit % 8));
-	return true;
+static void kvm_set_features(struct virtio_device *vdev, u32 features)
+{
+	unsigned int i;
+	struct kvm_device_desc *desc = to_kvmdev(vdev)->desc;
+	/* Second half of bitmap is features we accept. */
+	u8 *out_features = kvm_vq_features(desc) + desc->feature_len;
+
+	memset(out_features, 0, desc->feature_len);
+	for (i = 0; i < min(desc->feature_len * 8, 32); i++) {
+		if (features & (1 << i))
+			out_features[i / 8] |= (1 << (i % 8));
+	}
 }
 
 /*
@@ -221,7 +228,8 @@ static void kvm_del_vq(struct virtqueue 
  * The config ops structure as defined by virtio config
  */
 static struct virtio_config_ops kvm_vq_configspace_ops = {
-	.feature = kvm_feature,
+	.get_features = kvm_get_features,
+	.set_features = kvm_set_features,
 	.get = kvm_get,
 	.set = kvm_set,
 	.get_status = kvm_get_status,

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone

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

* Re: s390 kvm_virtio.c build error
  2008-05-04 19:25 ` Heiko Carstens
@ 2008-05-05 12:29   ` Christian Borntraeger
  2008-05-05 13:00     ` Avi Kivity
  0 siblings, 1 reply; 10+ messages in thread
From: Christian Borntraeger @ 2008-05-05 12:29 UTC (permalink / raw)
  To: Heiko Carstens
  Cc: Adrian Bunk, Martin Schwidefsky, Carsten Otte, Avi Kivity,
	Rusty Russell, kvm-devel, linux-s390, linux-kernel

> Hmm... this should help:
> 
> ---
>  drivers/s390/kvm/kvm_virtio.c |   40 
+++++++++++++++++++++++-----------------
>  1 file changed, 23 insertions(+), 17 deletions(-)

Thanks Heiko.
I did a short test and it seems to work.

Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>

This looks almost identical to Rusty's patch. Who is going to send this (or 
Rustys) patch to Linus?

Christian

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

* Re: s390 kvm_virtio.c build error
  2008-05-05 12:29   ` Christian Borntraeger
@ 2008-05-05 13:00     ` Avi Kivity
  2008-05-05 13:06       ` Martin Schwidefsky
  2008-05-14 10:37       ` Christian Borntraeger
  0 siblings, 2 replies; 10+ messages in thread
From: Avi Kivity @ 2008-05-05 13:00 UTC (permalink / raw)
  To: Christian Borntraeger
  Cc: Heiko Carstens, Adrian Bunk, Martin Schwidefsky, Carsten Otte,
	Rusty Russell, kvm-devel, linux-s390, linux-kernel

Christian Borntraeger wrote:
>> Hmm... this should help:
>>
>> ---
>>  drivers/s390/kvm/kvm_virtio.c |   40 
>>     
> +++++++++++++++++++++++-----------------
>   
>>  1 file changed, 23 insertions(+), 17 deletions(-)
>>     
>
> Thanks Heiko.
> I did a short test and it seems to work.
>
> Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
>
> This looks almost identical to Rusty's patch. Who is going to send this (or 
> Rustys) patch to Linus?
>   

I can, but tell me which one.  Also, the patch (Heiko's) needs a 
changelog entry and a signoff.

-- 
error compiling committee.c: too many arguments to function

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

* Re: s390 kvm_virtio.c build error
  2008-05-05 13:00     ` Avi Kivity
@ 2008-05-05 13:06       ` Martin Schwidefsky
  2008-05-05 13:20         ` Carsten Otte
  2008-05-06 14:39         ` Avi Kivity
  2008-05-14 10:37       ` Christian Borntraeger
  1 sibling, 2 replies; 10+ messages in thread
From: Martin Schwidefsky @ 2008-05-05 13:06 UTC (permalink / raw)
  To: Avi Kivity
  Cc: Christian Borntraeger, Heiko Carstens, Adrian Bunk, Carsten Otte,
	Rusty Russell, kvm-devel, linux-s390, linux-kernel

On Mon, 2008-05-05 at 16:00 +0300, Avi Kivity wrote:
> Christian Borntraeger wrote:
> >> Hmm... this should help:
> >>
> >> ---
> >>  drivers/s390/kvm/kvm_virtio.c |   40 
> >>     
> > +++++++++++++++++++++++-----------------
> >   
> >>  1 file changed, 23 insertions(+), 17 deletions(-)
> >>     
> >
> > Thanks Heiko.
> > I did a short test and it seems to work.
> >
> > Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
> >
> > This looks almost identical to Rusty's patch. Who is going to send this (or 
> > Rustys) patch to Linus?
> >   
> 
> I can, but tell me which one.  Also, the patch (Heiko's) needs a 
> changelog entry and a signoff.

I've added Heiko's patch to my patchqueue. But since this is
drivers/s390/kvm this should go in over the kvm.git. See patch below.

-- 
blue skies,
  Martin.

"Reality continues to ruin my life." - Calvin.

---
Subject: [PATCH] kvm/s390 compile error

From: Heiko Carstens <heiko.carstens@de.ibm.com>

Fix kvm compile error:

Commit c45a6816c19dee67b8f725e6646d428901a6dc24
(virtio: explicit advertisement of driver features)
and commit e976a2b997fc4ad70ccc53acfe62811c4aaec851
(s390: KVM guest: virtio device support, and kvm hypercalls)
don't like each other:

  CC      drivers/s390/kvm/kvm_virtio.o
drivers/s390/kvm/kvm_virtio.c:224: error: unknown field 'feature' specified in initializer
drivers/s390/kvm/kvm_virtio.c:224: warning: initialization from incompatible pointer type
make[3]: *** [drivers/s390/kvm/kvm_virtio.o] Error 1

Cc: Adrian Bunk <bunk@kernel.org>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
---

 drivers/s390/kvm/kvm_virtio.c |   40 +++++++++++++++++++++++-----------------
 1 file changed, 23 insertions(+), 17 deletions(-)

diff -urpN linux-2.6/drivers/s390/kvm/kvm_virtio.c linux-2.6-patched/drivers/s390/kvm/kvm_virtio.c
--- linux-2.6/drivers/s390/kvm/kvm_virtio.c	2008-05-05 13:20:45.000000000 +0200
+++ linux-2.6-patched/drivers/s390/kvm/kvm_virtio.c	2008-05-05 13:20:48.000000000 +0200
@@ -78,27 +78,32 @@ static unsigned desc_size(const struct k
 		+ desc->config_len;
 }
 
-/*
- * This tests (and acknowleges) a feature bit.
- */
-static bool kvm_feature(struct virtio_device *vdev, unsigned fbit)
+/* This gets the device's feature bits. */
+static u32 kvm_get_features(struct virtio_device *vdev)
 {
+	unsigned int i;
+	u32 features = 0;
 	struct kvm_device_desc *desc = to_kvmdev(vdev)->desc;
-	u8 *features;
+	u8 *in_features = kvm_vq_features(desc);
 
-	if (fbit / 8 > desc->feature_len)
-		return false;
+	for (i = 0; i < min(desc->feature_len * 8, 32); i++)
+		if (in_features[i / 8] & (1 << (i % 8)))
+			features |= (1 << i);
+	return features;
+}
 
-	features = kvm_vq_features(desc);
-	if (!(features[fbit / 8] & (1 << (fbit % 8))))
-		return false;
+static void kvm_set_features(struct virtio_device *vdev, u32 features)
+{
+	unsigned int i;
+	struct kvm_device_desc *desc = to_kvmdev(vdev)->desc;
+	/* Second half of bitmap is features we accept. */
+	u8 *out_features = kvm_vq_features(desc) + desc->feature_len;
 
-	/*
-	 * We set the matching bit in the other half of the bitmap to tell the
-	 * Host we want to use this feature.
-	 */
-	features[desc->feature_len + fbit / 8] |= (1 << (fbit % 8));
-	return true;
+	memset(out_features, 0, desc->feature_len);
+	for (i = 0; i < min(desc->feature_len * 8, 32); i++) {
+		if (features & (1 << i))
+			out_features[i / 8] |= (1 << (i % 8));
+	}
 }
 
 /*
@@ -221,7 +226,8 @@ static void kvm_del_vq(struct virtqueue 
  * The config ops structure as defined by virtio config
  */
 static struct virtio_config_ops kvm_vq_configspace_ops = {
-	.feature = kvm_feature,
+	.get_features = kvm_get_features,
+	.set_features = kvm_set_features,
 	.get = kvm_get,
 	.set = kvm_set,
 	.get_status = kvm_get_status,

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

* Re: s390 kvm_virtio.c build error
  2008-05-05 13:06       ` Martin Schwidefsky
@ 2008-05-05 13:20         ` Carsten Otte
  2008-05-06 14:39         ` Avi Kivity
  1 sibling, 0 replies; 10+ messages in thread
From: Carsten Otte @ 2008-05-05 13:20 UTC (permalink / raw)
  To: mschwid2
  Cc: linux-s390, Adrian Bunk, kvm-devel, heicars2, linux-kernel,
	borntrae, Avi Kivity

mschwid2@linux.vnet.ibm.com wrote:
> I've added Heiko's patch to my patchqueue. But since this is
> drivers/s390/kvm this should go in over the kvm.git. See patch below.
Acked-by: Carsten Otte <cotte@de.ibm.com>


-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone

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

* Re: s390 kvm_virtio.c build error
  2008-05-05 13:06       ` Martin Schwidefsky
  2008-05-05 13:20         ` Carsten Otte
@ 2008-05-06 14:39         ` Avi Kivity
  1 sibling, 0 replies; 10+ messages in thread
From: Avi Kivity @ 2008-05-06 14:39 UTC (permalink / raw)
  To: schwidefsky
  Cc: Carsten Otte, Adrian Bunk, linux-s390, kvm-devel, Heiko Carstens,
	linux-kernel, Christian Borntraeger

Martin Schwidefsky wrote:
> I've added Heiko's patch to my patchqueue. But since this is
> drivers/s390/kvm this should go in over the kvm.git. See patch below.
>
>   

Thanks, I added this to my queue as well.

-- 
Do not meddle in the internals of kernels, for they are subtle and quick to panic.


-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone

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

* Re: s390 kvm_virtio.c build error
  2008-05-05 13:00     ` Avi Kivity
  2008-05-05 13:06       ` Martin Schwidefsky
@ 2008-05-14 10:37       ` Christian Borntraeger
  2008-05-14 12:34         ` Avi Kivity
  1 sibling, 1 reply; 10+ messages in thread
From: Christian Borntraeger @ 2008-05-14 10:37 UTC (permalink / raw)
  To: Avi Kivity; +Cc: kvm-devel, Adrian Bunk, Heiko Carstens

Am Montag, 5. Mai 2008 schrieb Avi Kivity:
> I can, but tell me which one.  Also, the patch (Heiko's) needs a 
> changelog entry and a signoff.

Avi,

as this patch is now in your queue, can you push this change
---
commit eee4646877b748afbfd34d8dbe6ea9b454a65745
Author: Heiko Carstens <heiko.carstens@de.ibm.com>
Date:   Tue May 6 17:38:30 2008 +0300

    s390: KVM guest: fix compile error
---

soon to Linus? kvm still does not compile on s390.

Thank you

Christian

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft 
Defy all challenges. Microsoft(R) Visual Studio 2008. 
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

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

* Re: s390 kvm_virtio.c build error
  2008-05-14 10:37       ` Christian Borntraeger
@ 2008-05-14 12:34         ` Avi Kivity
  0 siblings, 0 replies; 10+ messages in thread
From: Avi Kivity @ 2008-05-14 12:34 UTC (permalink / raw)
  To: Christian Borntraeger; +Cc: kvm-devel, Adrian Bunk, Heiko Carstens

Christian Borntraeger wrote:
> as this patch is now in your queue, can you push this change
> ---
> commit eee4646877b748afbfd34d8dbe6ea9b454a65745
> Author: Heiko Carstens <heiko.carstens@de.ibm.com>
> Date:   Tue May 6 17:38:30 2008 +0300
>
>     s390: KVM guest: fix compile error
> ---
>
> soon to Linus? kvm still does not compile on s390.
>   

Certainly; I plan to push my queue in a day or two.


-- 
error compiling committee.c: too many arguments to function


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft 
Defy all challenges. Microsoft(R) Visual Studio 2008. 
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

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

end of thread, other threads:[~2008-05-14 12:34 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-03 17:47 s390 kvm_virtio.c build error Adrian Bunk
2008-05-04 19:25 ` Heiko Carstens
2008-05-05 12:29   ` Christian Borntraeger
2008-05-05 13:00     ` Avi Kivity
2008-05-05 13:06       ` Martin Schwidefsky
2008-05-05 13:20         ` Carsten Otte
2008-05-06 14:39         ` Avi Kivity
2008-05-14 10:37       ` Christian Borntraeger
2008-05-14 12:34         ` Avi Kivity
2008-05-05  0:19 ` Rusty Russell

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