public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [patch 0/2] kvm-tools -- cleanup
@ 2011-05-05 19:06 Cyrill Gorcunov
  2011-05-05 19:06 ` [patch 1/2] kvm tools: Gather Virtio-PCI constants into one place Cyrill Gorcunov
  2011-05-05 19:06 ` [patch 2/2] kvm tools - Cleanup IRQs definitions for virtio pci devices Cyrill Gorcunov
  0 siblings, 2 replies; 10+ messages in thread
From: Cyrill Gorcunov @ 2011-05-05 19:06 UTC (permalink / raw)
  To: penberg, mingo; +Cc: asias.hejun, prasadjoshi124, kvm, levinsasha928

Please review, I hope I didn't miss anything. Testing is appereciated
and comments as well.

Thanks,
 Cyrill

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

* [patch 1/2] kvm tools: Gather Virtio-PCI constants into one place
  2011-05-05 19:06 [patch 0/2] kvm-tools -- cleanup Cyrill Gorcunov
@ 2011-05-05 19:06 ` Cyrill Gorcunov
  2011-05-05 19:11   ` Cyrill Gorcunov
  2011-05-05 20:09   ` Cyrill Gorcunov
  2011-05-05 19:06 ` [patch 2/2] kvm tools - Cleanup IRQs definitions for virtio pci devices Cyrill Gorcunov
  1 sibling, 2 replies; 10+ messages in thread
From: Cyrill Gorcunov @ 2011-05-05 19:06 UTC (permalink / raw)
  To: penberg, mingo
  Cc: asias.hejun, prasadjoshi124, kvm, levinsasha928, Cyrill Gorcunov

[-- Attachment #1: kvm-tools-virtio-pci --]
[-- Type: text/plain, Size: 8016 bytes --]

It's better than have them sprinkled in.c files. Note
that pin for ring device is changed so it no longer shared
with block device (it is done in a sake of simplicity).

Also comment style if a bit tuned up in virtio-pci.h
just to be consistent.

Reported-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
---
 tools/kvm/include/kvm/virtio-pci-dev.h |   40 +++++++++++++++++++++++++++++++++
 tools/kvm/include/kvm/virtio-pci.h     |   31 ++++++++++++++++++-------
 tools/kvm/virtio-blk.c                 |   11 ---------
 tools/kvm/virtio-console.c             |   10 --------
 tools/kvm/virtio-net.c                 |   10 --------
 tools/kvm/virtio-rng.c                 |   10 --------
 6 files changed, 67 insertions(+), 45 deletions(-)

Index: linux-2.6.git/tools/kvm/include/kvm/virtio-pci-dev.h
=====================================================================
--- /dev/null
+++ linux-2.6.git/tools/kvm/include/kvm/virtio-pci-dev.h
@@ -0,0 +1,40 @@
+#ifndef VIRTIO_PCI_DEV_H_
+#define VIRTIO_PCI_DEV_H_
+
+/*
+ * Virtio PCI device constants and resources
+ * they do use (such as irqs and pins).
+ */
+
+#define PCI_DEVICE_ID_VIRTIO_NET		0x1000
+#define PCI_DEVICE_ID_VIRTIO_BLK		0x1001
+#define PCI_DEVICE_ID_VIRTIO_CONSOLE		0x1003
+#define PCI_DEVICE_ID_VIRTIO_RNG		0x1004
+
+#define PCI_SUBSYSTEM_ID_VIRTIO_NET		0x0001
+#define PCI_SUBSYSTEM_ID_VIRTIO_BLK		0x0002
+#define PCI_SUBSYSTEM_ID_VIRTIO_CONSOLE		0x0003
+#define PCI_SUBSYSTEM_ID_VIRTIO_RNG		0x0004
+
+enum {
+	PCI_VIRTIO_BLK_DEVNUM			= 1,
+	PCI_VIRTIO_CONSOLE_DEVNUM		= 2,
+	PCI_VIRTIO_NET_DEVNUM			= 3,
+	PCI_VIRTIO_RNG_DEVNUM			= 4,
+};
+
+enum {
+	VIRTIO_BLK_PIN				= 1,
+	VIRTIO_CONSOLE_PIN			= 2,
+	VIRTIO_NET_PIN				= 3,
+	VIRTIO_RNG_PIN				= 4,
+};
+
+enum {
+	VIRTIO_RNG_IRQ				= 11,
+	VIRTIO_CONSOLE_IRQ			= 13,
+	VIRTIO_NET_IRQ				= 14,
+	VIRTIO_BLK_IRQ				= 15,
+};
+
+#endif /* VIRTIO_PCI_DEV_H_ */
Index: linux-2.6.git/tools/kvm/include/kvm/virtio-pci.h
=====================================================================
--- linux-2.6.git.orig/tools/kvm/include/kvm/virtio-pci.h
+++ linux-2.6.git/tools/kvm/include/kvm/virtio-pci.h
@@ -34,26 +34,41 @@
 /* A 16-bit r/w queue notifier */
 #define VIRTIO_PCI_QUEUE_NOTIFY		16
 
-/* An 8-bit device status register.  */
+/* An 8-bit device status register */
 #define VIRTIO_PCI_STATUS		18
 
-/* An 8-bit r/o interrupt status register.  Reading the value will return the
- * current contents of the ISR and will also clear it.  This is effectively
- * a read-and-acknowledge. */
+/*
+ * An 8-bit r/o interrupt status register.
+ *
+ * Reading the value will return the current contents of
+ * the ISR and will also clear it. This is effectively
+ * a read-and-acknowledge.
+ */
 #define VIRTIO_PCI_ISR			19
 
-/* MSI-X registers: only enabled if MSI-X is enabled. */
-/* A 16-bit vector for configuration changes. */
+/*
+ * MSI-X registers: only enabled if MSI-X is enabled.
+ */
+
+/* A 16-bit vector for configuration changes */
 #define VIRTIO_MSI_CONFIG_VECTOR        20
 
-/* A 16-bit vector for selected queue notifications. */
+/* A 16-bit vector for selected queue notifications */
 #define VIRTIO_MSI_QUEUE_VECTOR         22
 
 /* Vector value used to disable MSI for queue */
 #define VIRTIO_MSI_NO_VECTOR            0xffff
 
-/* Config space size */
+/*
+ * Config space size.
+ */
 #define VIRTIO_PCI_CONFIG_NOMSI         20
 #define VIRTIO_PCI_CONFIG_MSI           24
 
+/*
+ * Virtio config space constants.
+ */
+#define PCI_VENDOR_ID_REDHAT_QUMRANET		0x1af4
+#define PCI_SUBSYSTEM_VENDOR_ID_REDHAT_QUMRANET	0x1af4
+
 #endif /* _LINUX_VIRTIO_PCI_H */
Index: linux-2.6.git/tools/kvm/virtio-blk.c
=====================================================================
--- linux-2.6.git.orig/tools/kvm/virtio-blk.c
+++ linux-2.6.git/tools/kvm/virtio-blk.c
@@ -1,6 +1,7 @@
 #include "kvm/virtio-blk.h"
 
 #include "kvm/virtio-pci.h"
+#include "kvm/virtio-pci-dev.h"
 
 #include "kvm/disk-image.h"
 #include "kvm/virtio.h"
@@ -17,9 +18,6 @@
 #include <inttypes.h>
 #include <pthread.h>
 
-#define VIRTIO_BLK_IRQ		15
-#define VIRTIO_BLK_PIN		1
-
 #define NUM_VIRT_QUEUES		1
 
 #define VIRTIO_BLK_QUEUE_SIZE	128
@@ -223,11 +221,6 @@ static struct ioport_operations virtio_b
 	.io_out		= virtio_blk_pci_io_out,
 };
 
-#define PCI_VENDOR_ID_REDHAT_QUMRANET		0x1af4
-#define PCI_DEVICE_ID_VIRTIO_BLK		0x1001
-#define PCI_SUBSYSTEM_VENDOR_ID_REDHAT_QUMRANET	0x1af4
-#define PCI_SUBSYSTEM_ID_VIRTIO_BLK		0x0002
-
 static struct pci_device_header virtio_blk_pci_device = {
 	.vendor_id		= PCI_VENDOR_ID_REDHAT_QUMRANET,
 	.device_id		= PCI_DEVICE_ID_VIRTIO_BLK,
@@ -241,8 +234,6 @@ static struct pci_device_header virtio_b
 	.irq_line		= VIRTIO_BLK_IRQ,
 };
 
-#define PCI_VIRTIO_BLK_DEVNUM 1
-
 void virtio_blk__init(struct kvm *self)
 {
 	if (!self->disk_image)
Index: linux-2.6.git/tools/kvm/virtio-console.c
=====================================================================
--- linux-2.6.git.orig/tools/kvm/virtio-console.c
+++ linux-2.6.git/tools/kvm/virtio-console.c
@@ -1,5 +1,6 @@
 #include "kvm/virtio-console.h"
 #include "kvm/virtio-pci.h"
+#include "kvm/virtio-pci-dev.h"
 #include "kvm/disk-image.h"
 #include "kvm/virtio.h"
 #include "kvm/ioport.h"
@@ -23,14 +24,10 @@
 #include <unistd.h>
 #include <fcntl.h>
 
-#define VIRTIO_CONSOLE_IRQ		13
-#define VIRTIO_CONSOLE_PIN		2
-
 #define VIRTIO_CONSOLE_QUEUE_SIZE	128
 #define VIRTIO_CONSOLE_NUM_QUEUES	2
 #define VIRTIO_CONSOLE_RX_QUEUE		0
 #define VIRTIO_CONSOLE_TX_QUEUE		1
-#define PCI_VIRTIO_CONSOLE_DEVNUM	2
 
 struct console_device {
 	pthread_mutex_t			mutex;
@@ -227,11 +224,6 @@ static struct ioport_operations virtio_c
 	.io_out	= virtio_console_pci_io_out,
 };
 
-#define PCI_VENDOR_ID_REDHAT_QUMRANET		0x1af4
-#define PCI_DEVICE_ID_VIRTIO_CONSOLE		0x1003
-#define PCI_SUBSYSTEM_VENDOR_ID_REDHAT_QUMRANET	0x1af4
-#define PCI_SUBSYSTEM_ID_VIRTIO_CONSOLE		0x0003
-
 static struct pci_device_header virtio_console_pci_device = {
 	.vendor_id		= PCI_VENDOR_ID_REDHAT_QUMRANET,
 	.device_id		= PCI_DEVICE_ID_VIRTIO_CONSOLE,
Index: linux-2.6.git/tools/kvm/virtio-net.c
=====================================================================
--- linux-2.6.git.orig/tools/kvm/virtio-net.c
+++ linux-2.6.git/tools/kvm/virtio-net.c
@@ -1,5 +1,6 @@
 #include "kvm/virtio-net.h"
 #include "kvm/virtio-pci.h"
+#include "kvm/virtio-pci-dev.h"
 #include "kvm/virtio.h"
 #include "kvm/ioport.h"
 #include "kvm/types.h"
@@ -20,14 +21,10 @@
 #include <unistd.h>
 #include <sys/wait.h>
 
-#define VIRTIO_NET_IRQ		14
-#define VIRTIO_NET_PIN		3
-
 #define VIRTIO_NET_QUEUE_SIZE	128
 #define VIRTIO_NET_NUM_QUEUES	2
 #define VIRTIO_NET_RX_QUEUE	0
 #define VIRTIO_NET_TX_QUEUE	1
-#define PCI_VIRTIO_NET_DEVNUM	3
 
 struct net_device {
 	pthread_mutex_t			mutex;
@@ -263,11 +260,6 @@ static struct ioport_operations virtio_n
 	.io_out	= virtio_net_pci_io_out,
 };
 
-#define PCI_VENDOR_ID_REDHAT_QUMRANET		0x1af4
-#define PCI_DEVICE_ID_VIRTIO_NET		0x1000
-#define PCI_SUBSYSTEM_VENDOR_ID_REDHAT_QUMRANET	0x1af4
-#define PCI_SUBSYSTEM_ID_VIRTIO_NET		0x0001
-
 static struct pci_device_header virtio_net_pci_device = {
 	.vendor_id		= PCI_VENDOR_ID_REDHAT_QUMRANET,
 	.device_id		= PCI_DEVICE_ID_VIRTIO_NET,
Index: linux-2.6.git/tools/kvm/virtio-rng.c
=====================================================================
--- linux-2.6.git.orig/tools/kvm/virtio-rng.c
+++ linux-2.6.git/tools/kvm/virtio-rng.c
@@ -1,6 +1,7 @@
 #include "kvm/virtio-rng.h"
 
 #include "kvm/virtio-pci.h"
+#include "kvm/virtio-pci-dev.h"
 
 #include "kvm/disk-image.h"
 #include "kvm/virtio.h"
@@ -20,15 +21,6 @@
 #include <inttypes.h>
 #include <pthread.h>
 
-#define PCI_VENDOR_ID_REDHAT_QUMRANET			0x1af4
-#define PCI_DEVICE_ID_VIRTIO_RNG				0x1004
-#define PCI_SUBSYSTEM_VENDOR_ID_REDHAT_QUMRANET	0x1af4
-#define PCI_SUBSYSTEM_ID_VIRTIO_RNG				0x0004
-#define PCI_VIRTIO_RNG_DEVNUM 4
-
-#define VIRTIO_RNG_IRQ		11
-#define VIRTIO_RNG_PIN		1
-
 #define NUM_VIRT_QUEUES		1
 
 #define VIRTIO_RNG_QUEUE_SIZE	128


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

* [patch 2/2] kvm tools - Cleanup IRQs definitions for virtio pci devices
  2011-05-05 19:06 [patch 0/2] kvm-tools -- cleanup Cyrill Gorcunov
  2011-05-05 19:06 ` [patch 1/2] kvm tools: Gather Virtio-PCI constants into one place Cyrill Gorcunov
@ 2011-05-05 19:06 ` Cyrill Gorcunov
  2011-05-05 20:14   ` Pekka Enberg
  1 sibling, 1 reply; 10+ messages in thread
From: Cyrill Gorcunov @ 2011-05-05 19:06 UTC (permalink / raw)
  To: penberg, mingo
  Cc: asias.hejun, prasadjoshi124, kvm, levinsasha928, Cyrill Gorcunov

[-- Attachment #1: kvm-tools-virtio-pci-irqs --]
[-- Type: text/plain, Size: 4359 bytes --]

This also requires to tune up mptable code. Note the srcbusirq
need to follow specification convention, so we merge device
number and pin into one field inside mptable_set_default_int_src
helper.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
---
 tools/kvm/include/kvm/virtio-pci-dev.h |   16 +++++--
 tools/kvm/mptable.c                    |   67 ++++++++++++++++++++++++---------
 2 files changed, 61 insertions(+), 22 deletions(-)

Index: linux-2.6.git/tools/kvm/include/kvm/virtio-pci-dev.h
=====================================================================
--- linux-2.6.git.orig/tools/kvm/include/kvm/virtio-pci-dev.h
+++ linux-2.6.git/tools/kvm/include/kvm/virtio-pci-dev.h
@@ -30,11 +30,19 @@ enum {
 	VIRTIO_RNG_PIN				= 4,
 };
 
+/*
+ * The IRQ numbers should confirm Linux IRQ numbering
+ * scheme model, which supposes devices to start IRQs
+ * from 32 ... 127, but 0x30-0x3f are used for ISA
+ * interrupts so we choose 0x40 as the origin.
+ */
+#define VIRTIO_PCI_DEV_FIRST_IRQ		0x40
+
 enum {
-	VIRTIO_RNG_IRQ				= 11,
-	VIRTIO_CONSOLE_IRQ			= 13,
-	VIRTIO_NET_IRQ				= 14,
-	VIRTIO_BLK_IRQ				= 15,
+	VIRTIO_RNG_IRQ				= VIRTIO_PCI_DEV_FIRST_IRQ + 0,
+	VIRTIO_CONSOLE_IRQ			= VIRTIO_PCI_DEV_FIRST_IRQ + 1,
+	VIRTIO_NET_IRQ				= VIRTIO_PCI_DEV_FIRST_IRQ + 2,
+	VIRTIO_BLK_IRQ				= VIRTIO_PCI_DEV_FIRST_IRQ + 3,
 };
 
 #endif /* VIRTIO_PCI_DEV_H_ */
Index: linux-2.6.git/tools/kvm/mptable.c
=====================================================================
--- linux-2.6.git.orig/tools/kvm/mptable.c
+++ linux-2.6.git/tools/kvm/mptable.c
@@ -3,6 +3,7 @@
 #include "kvm/apic.h"
 #include "kvm/mptable.h"
 #include "kvm/util.h"
+#include "kvm/virtio-pci-dev.h"
 
 #include <linux/kernel.h>
 #include <string.h>
@@ -60,16 +61,17 @@ static unsigned int gen_cpu_flag(unsigne
  */
 #define MPTABLE_MAX_CPUS	255
 
-static void mptable_add_irq_src(struct mpc_intsrc *mpc_intsrc,
-				u16 srcbusid,	u16 srcbusirq,
-				u16 dstapic,	u16 dstirq)
+static void
+mptable_set_default_int_src(struct mpc_intsrc *dst,
+			    u8 dev, u8 pin, u16 srcbusid,
+			    u16 dstapic, u16 dstirq)
 {
-	*mpc_intsrc = (struct mpc_intsrc) {
+	*dst = (struct mpc_intsrc) {
 		.type		= MP_INTSRC,
 		.irqtype	= mp_INT,
 		.irqflag	= MP_IRQDIR_DEFAULT,
 		.srcbus		= srcbusid,
-		.srcbusirq	= srcbusirq,
+		.srcbusirq	= (dev << 2) | (pin - 1),
 		.dstapic	= dstapic,
 		.dstirq		= dstirq
 	};
@@ -186,28 +188,57 @@ void mptable_setup(struct kvm *kvm, unsi
 	 *
 	 * Also note we use PCI irqs here, no for ISA bus yet.
 	 */
-	mpc_intsrc		= last_addr;
 
-	/* src irq = virtio console irq pin, dst irq = virtio console irq */
-	mptable_add_irq_src(mpc_intsrc, pcibusid, 2, ioapicid, 13);
-	last_addr = (void *)&mpc_intsrc[1];
+	/*
+	 * Virtio console.
+	 */
+	mpc_intsrc		= last_addr;
+	mptable_set_default_int_src(mpc_intsrc,
+				    PCI_VIRTIO_CONSOLE_DEVNUM,
+				    VIRTIO_CONSOLE_PIN,
+				    pcibusid, ioapicid,
+				    VIRTIO_CONSOLE_IRQ);
+	last_addr		= (void *)&mpc_intsrc[1];
 	nentries++;
 
-	/* Currently we define 4 possible virtio-blk devices */
+	/*
+	 * Virtio block devices.
+	 *
+	 * Currently we define 4 possible virtio-blk devices.
+	 */
 	for (i = 0; i < 4; i++) {
-		mpc_intsrc		= last_addr;
-
-		/* src irq = virtio blk irq pin, dst irq = virtio blk irq */
-		mptable_add_irq_src(mpc_intsrc, pcibusid, 1, ioapicid, 9 + i);
-		last_addr = (void *)&mpc_intsrc[1];
+		mpc_intsrc	= last_addr;
+		mptable_set_default_int_src(mpc_intsrc,
+					    PCI_VIRTIO_BLK_DEVNUM,
+					    VIRTIO_BLK_PIN,
+					    pcibusid, ioapicid,
+					    VIRTIO_BLK_IRQ + i);
+		last_addr	= (void *)&mpc_intsrc[1];
 		nentries++;
 	}
 
+	/*
+	 * Virtio net device.
+	 */
 	mpc_intsrc		= last_addr;
+	mptable_set_default_int_src(mpc_intsrc,
+				    PCI_VIRTIO_NET_DEVNUM,
+				    VIRTIO_NET_PIN,
+				    pcibusid, ioapicid,
+				    VIRTIO_NET_IRQ);
+	last_addr		= (void *)&mpc_intsrc[1];
+	nentries++;
 
-	/* src irq = virtio net irq pin, dst irq = virtio net irq */
-	mptable_add_irq_src(mpc_intsrc, pcibusid, 3, ioapicid, 14);
-	last_addr = (void *)&mpc_intsrc[1];
+	/*
+	 * Virtio random number generator.
+	 */
+	mpc_intsrc		= last_addr;
+	mptable_set_default_int_src(mpc_intsrc,
+				    PCI_VIRTIO_RNG_DEVNUM,
+				    VIRTIO_RNG_PIN,
+				    pcibusid, ioapicid,
+				    VIRTIO_RNG_IRQ);
+	last_addr		= (void *)&mpc_intsrc[1];
 	nentries++;
 
 	/*


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

* Re: [patch 1/2] kvm tools: Gather Virtio-PCI constants into one place
  2011-05-05 19:06 ` [patch 1/2] kvm tools: Gather Virtio-PCI constants into one place Cyrill Gorcunov
@ 2011-05-05 19:11   ` Cyrill Gorcunov
  2011-05-05 20:09   ` Cyrill Gorcunov
  1 sibling, 0 replies; 10+ messages in thread
From: Cyrill Gorcunov @ 2011-05-05 19:11 UTC (permalink / raw)
  To: Cyrill Gorcunov
  Cc: penberg, mingo, asias.hejun, prasadjoshi124, kvm, levinsasha928

On 05/05/2011 11:06 PM, Cyrill Gorcunov wrote:
> It's better than have them sprinkled in.c files. Note
> that pin for ring device is changed so it no longer shared
> with block device (it is done in a sake of simplicity).
> 
> Also comment style if a bit tuned up in virtio-pci.h
                     ^^

Have no idea what 'if' is doing here O_o

> just to be consistent.
> 
> Reported-by: Ingo Molnar <mingo@elte.hu>
> Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
> ---

-- 
Thanks,
  Cyrill

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

* Re: [patch 1/2] kvm tools: Gather Virtio-PCI constants into one place
  2011-05-05 19:06 ` [patch 1/2] kvm tools: Gather Virtio-PCI constants into one place Cyrill Gorcunov
  2011-05-05 19:11   ` Cyrill Gorcunov
@ 2011-05-05 20:09   ` Cyrill Gorcunov
  1 sibling, 0 replies; 10+ messages in thread
From: Cyrill Gorcunov @ 2011-05-05 20:09 UTC (permalink / raw)
  To: penberg; +Cc: mingo, asias.hejun, prasadjoshi124, kvm, levinsasha928

On 05/05/2011 11:06 PM, Cyrill Gorcunov wrote:
> It's better than have them sprinkled in.c files. Note
> that pin for ring device is changed so it no longer shared
> with block device (it is done in a sake of simplicity).
> 
> Also comment style if a bit tuned up in virtio-pci.h
> just to be consistent.
> 
> Reported-by: Ingo Molnar <mingo@elte.hu>
> Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
> ---
...
> +
> +enum {
> +	VIRTIO_BLK_PIN				= 1,
> +	VIRTIO_CONSOLE_PIN			= 2,
> +	VIRTIO_NET_PIN				= 3,
> +	VIRTIO_RNG_PIN				= 4,
> +};
> +

Btw, probably the better way would be to make it like that

enum {
	PCI_INTA				= 1,
	PCI_INTB				= 2,
	PCI_INTC				= 3,
	PCI_INTD				= 4,
};

enum {
	VIRTIO_BLK_PIN				= PCI_INTA,
	VIRTIO_CONSOLE_PIN			= PCI_INTB,
	VIRTIO_NET_PIN				= PCI_INTC,
	VIRTIO_RNG_PIN				= PCI_INTD,
};

So we would know the connection way and pin shares if needed.

-- 
Thanks,
  Cyrill

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

* Re: [patch 2/2] kvm tools - Cleanup IRQs definitions for virtio pci devices
  2011-05-05 19:06 ` [patch 2/2] kvm tools - Cleanup IRQs definitions for virtio pci devices Cyrill Gorcunov
@ 2011-05-05 20:14   ` Pekka Enberg
  2011-05-05 20:15     ` Cyrill Gorcunov
  0 siblings, 1 reply; 10+ messages in thread
From: Pekka Enberg @ 2011-05-05 20:14 UTC (permalink / raw)
  To: Cyrill Gorcunov; +Cc: mingo, asias.hejun, prasadjoshi124, kvm, levinsasha928

On Thu, 5 May 2011, Cyrill Gorcunov wrote:
> This also requires to tune up mptable code. Note the srcbusirq
> need to follow specification convention, so we merge device
> number and pin into one field inside mptable_set_default_int_src
> helper.
>
> Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>

This seems to break virtio drivers on my box.

penberg@tiger:~/linux/tools/kvm$ ./kvm run --params="root=/dev/vda1" 
--image=/home/penberg/images/debian_squeeze_amd64_standard.img
   Warning: Config tap device error. Are you root?
[    0.000000] Linux version 2.6.39-rc6+ (penberg@tiger) (gcc version 
4.4.3 (Ubuntu 4.4.3-4ubuntu5) ) #29 SMP Wed May 4 20:32:24 EEST 2011
[    0.000000] Command line: notsc nolapic noacpi pci=conf1 console=ttyS0 
root=/dev/vda1
[    0.000000] BIOS-provided physical RAM map:
[    0.000000]  BIOS-e820: 0000000000000000 - 000000000009fc00 (usable)
[    0.000000]  BIOS-e820: 000000000009fc00 - 00000000000a0000 (reserved)
[    0.000000]  BIOS-e820: 00000000000f0000 - 00000000000fffff (reserved)
[    0.000000]  BIOS-e820: 0000000000100000 - 0000000004000000 (usable)
[    0.000000] NX (Execute Disable) protection: active
[    0.000000] DMI not present or invalid.
[    0.000000] No AGP bridge found
[    0.000000] last_pfn = 0x4000 max_arch_pfn = 0x400000000
[    0.000000] x86 PAT enabled: cpu 0, old 0x0, new 0x7010600070106
[    0.000000] CPU MTRRs all blank - virtualized system.
[    0.000000] found SMP MP-table at [ffff8800000f01f0] f01f0
[    0.000000] init_memory_mapping: 0000000000000000-0000000004000000
[    0.000000] ACPI Error: A valid RSDP was not found 
(20110316/tbxfroot-219)
[    0.000000] No NUMA configuration found
[    0.000000] Faking a node at 0000000000000000-0000000004000000
[    0.000000] Initmem setup node 0 0000000000000000-0000000004000000
[    0.000000]   NODE_DATA [0000000003ffb000 - 0000000003ffffff]
[    0.000000] kvm-clock: Using msrs 4b564d01 and 4b564d00
[    0.000000] kvm-clock: cpu 0, msr 0:1d112c1, boot clock
[    0.000000] Zone PFN ranges:
[    0.000000]   DMA      0x00000010 -> 0x00001000
[    0.000000]   DMA32    0x00001000 -> 0x00100000
[    0.000000]   Normal   empty
[    0.000000] Movable zone start PFN for each node
[    0.000000] early_node_map[2] active PFN ranges
[    0.000000]     0: 0x00000010 -> 0x0000009f
[    0.000000]     0: 0x00000100 -> 0x00004000
[    0.000000] Intel MultiProcessor Specification v1.4
[    0.000000] MPTABLE: OEM ID: KVMCPU00
[    0.000000] MPTABLE: Product ID: 0.1
[    0.000000] MPTABLE: APIC at: 0xFEE00000
[    0.000000] Processor #0 (Bootup-CPU)
[    0.000000] IOAPIC[0]: apic_id 2, version 17, address 0xfec00000, GSI 
0-23
[    0.000000] Processors: 1
[    0.000000] SMP: Allowing 1 CPUs, 0 hotplug CPUs
[    0.000000] PM: Registered nosave memory: 000000000009f000 - 
00000000000a0000
[    0.000000] PM: Registered nosave memory: 00000000000a0000 - 
00000000000f0000
[    0.000000] PM: Registered nosave memory: 00000000000f0000 - 
00000000000ff000
[    0.000000] PM: Registered nosave memory: 00000000000ff000 - 
0000000000100000
[    0.000000] Allocating PCI resources starting at 4000000 (gap: 
4000000:fc000000)
[    0.000000] Booting paravirtualized kernel on KVM
[    0.000000] setup_percpu: NR_CPUS:64 nr_cpumask_bits:64 nr_cpu_ids:1 
nr_node_ids:1
[    0.000000] PERCPU: Embedded 26 pages/cpu @ffff880003c00000 s77504 
r8192 d20800 u2097152
[    0.000000] kvm-clock: cpu 0, msr 0:3c122c1, primary cpu clock
[    0.000000] Built 1 zonelists in Node order, mobility grouping on. 
Total pages: 16042
[    0.000000] Policy zone: DMA32
[    0.000000] Kernel command line: notsc nolapic noacpi pci=conf1 
console=ttyS0 root=/dev/vda1
[    0.000000] notsc: Kernel compiled with CONFIG_X86_TSC, cannot disable 
TSC completely.
[    0.000000] PID hash table entries: 256 (order: -1, 2048 bytes)
[    0.000000] Checking aperture...
[    0.000000] No AGP bridge found
[    0.000000] Memory: 47768k/65536k available (7267k kernel code, 452k 
absent, 17316k reserved, 6033k data, 920k init)
[    0.000000] SLUB: Genslabs=15, HWalign=64, Order=0-3, MinObjects=0, 
CPUs=1, Nodes=1
[    0.000000] Hierarchical RCU implementation.
[    0.000000] 	RCU-based detection of stalled CPUs is disabled.
[    0.000000] NR_IRQS:4352 nr_irqs:256 16
[    0.000000] Console: colour *CGA 80x25
[    0.000000] console [ttyS0] enabled
[    0.000000] Detected 1995.237 MHz processor.
[    0.010000] Calibrating delay loop (skipped) preset value.. 3990.47 
BogoMIPS (lpj=19952370)
[    0.010000] pid_max: default: 32768 minimum: 301
[    0.010000] Dentry cache hash table entries: 8192 (order: 4, 65536 
bytes)
[    0.010000] Inode-cache hash table entries: 4096 (order: 3, 32768 
bytes)
[    0.010000] Mount-cache hash table entries: 256
[    0.010000] Initializing cgroup subsys ns
[    0.010029] ns_cgroup deprecated: consider using the 'clone_children' 
flag without the ns_cgroup.
[    0.012242] Initializing cgroup subsys freezer
[    0.013472] mce: CPU supports 32 MCE banks
[    0.014900] SMP alternatives: switching to UP code
[    0.202195] Freeing SMP alternatives: 24k freed
[    0.203506] ftrace: allocating 26766 entries in 105 pages
[    0.220152] SMP disabled
[    0.220822] Performance Events: unsupported p6 CPU model 15 no PMU 
driver, software events only.
[    0.231058] NMI watchdog disabled (cpu0): hardware events not enabled
[    0.232703] Brought up 1 CPUs
[    0.233450] Total of 1 processors activated (3990.47 BogoMIPS).
[    0.235382] print_constraints: dummy:
[    0.236561] Time: 20:12:16  Date: 05/05/11
[    0.237665] NET: Registered protocol family 16
[    0.238958] PCI: Using configuration type 1 for base access
[    0.241971] bio: create slab <bio-0> at 0
[    0.243110] ACPI: Interpreter disabled.
[    0.244119] vgaarb: loaded
[    0.244924] SCSI subsystem initialized
[    0.245994] usbcore: registered new interface driver usbfs
[    0.247402] usbcore: registered new interface driver hub
[    0.248755] usbcore: registered new device driver usb
[    0.250136] Advanced Linux Sound Architecture Driver Version 1.0.24.
[    0.251633] PCI: Probing PCI hardware
[    0.254610] Bluetooth: Core ver 2.16
[    0.255456] NET: Registered protocol family 31
[    0.256577] Bluetooth: HCI device and connection manager initialized
[    0.258187] Bluetooth: HCI socket layer initialized
[    0.260014] Bluetooth: L2CAP socket layer initialized
[    0.261323] Bluetooth: SCO socket layer initialized
[    0.262590] cfg80211: Calling CRDA to update world regulatory domain
[    0.264410] Switching to clocksource kvm-clock
[    0.268895] pnp: PnP ACPI: disabled
[    0.268895] Switched to NOHz mode on CPU #0
[    0.268895] NET: Registered protocol family 2
[    0.268895] IP route cache hash table entries: 512 (order: 0, 4096 
bytes)
[    0.269490] TCP established hash table entries: 2048 (order: 3, 32768 
bytes)
[    0.271306] TCP bind hash table entries: 2048 (order: 3, 32768 bytes)
[    0.272949] TCP: Hash tables configured (established 2048 bind 2048)
[    0.274531] TCP reno registered
[    0.275318] UDP hash table entries: 128 (order: 0, 4096 bytes)
[    0.276768] UDP-Lite hash table entries: 128 (order: 0, 4096 bytes)
[    0.278368] NET: Registered protocol family 1
[    0.279587] RPC: Registered udp transport module.
[    0.280696] RPC: Registered tcp transport module.
[    0.281755] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.283443] kvm: no hardware support
[    0.284298] platform rtc_cmos: registered platform RTC device (no PNP 
device found)
[    0.286456] audit: initializing netlink socket (disabled)
[    0.287845] type=2000 audit(1304626335.280:1): initialized
[    0.310777] HugeTLB registered 2 MB page size, pre-allocated 0 pages
[    0.314176] VFS: Disk quotas dquot_6.5.2
[    0.315246] Dquot-cache hash table entries: 512 (order 0, 4096 bytes)
[    0.317736] fuse init (API version 7.16)
[    0.318760] Installing v9fs 9p2000 file system support
[    0.319971] msgmni has been set to 93
[    0.321298] io scheduler noop registered
[    0.322339] io scheduler deadline registered
[    0.323444] io scheduler cfq registered (default)
[    0.324699] pci_hotplug: PCI Hot Plug PCI Core version: 0.5
[    0.326116] pciehp: PCI Express Hot Plug Controller Driver version: 0.4
[    0.327852] virtio-pci 0000:00:02.0: enabling device (0000 -> 0001)
[    0.329448] virtio-pci 0000:00:02.0: can't find IRQ for PCI INT B; 
please try using pci=biosirq
[    0.331788] virtio-pci 0000:00:0a.0: enabling device (0000 -> 0001)
[    0.333397] virtio-pci 0000:00:0a.0: can't find IRQ for PCI INT A; 
please try using pci=biosirq
[    0.335690] Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled
[    0.358999] serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
[    0.382317] serial8250: ttyS1 at I/O 0x2f8 (irq = 3) is a 16550A
[    0.405555] serial8250: ttyS2 at I/O 0x3e8 (irq = 4) is a 16550A
[    0.407353] virtio_console virtio0: Error -16 initializing vqs
[    0.408695] virtio_console: probe of virtio0 failed with error -16
[    0.410446] lp: driver loaded but no devices found
[    0.411776] ppdev: user-space parallel port driver
[    0.413003] Linux agpgart interface v0.103
[    0.414080] [drm] Initialized drm 1.1.0 20060810
[    0.416261] brd: module loaded
[    0.417546] loop: module loaded
[    0.418470] virtio_blk: probe of virtio1 failed with error -16
[    0.420806] Fixed MDIO Bus: probed
[    0.421717] sky2: driver version 1.28
[    0.422684] PPP generic driver version 2.4.2
[    0.423777] tun: Universal TUN/TAP device driver, 1.6
[    0.425037] tun: (C) 1999-2004 Max Krasnyansky <maxk@qualcomm.com>
[    0.426588] console [netcon0] enabled
[    0.427454] netconsole: network logging started
[    0.428536] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    0.430087] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    0.431484] uhci_hcd: USB Universal Host Controller Interface driver
[    0.433134] usbcore: registered new interface driver usbserial
[    0.434611] usbserial: USB Serial Driver core
[    0.435727] USB Serial support registered for pl2303
[    0.436931] usbcore: registered new interface driver pl2303
[    0.438214] pl2303: Prolific PL2303 USB to serial adaptor driver
[    0.439730] usbcore: registered new interface driver isight_firmware
[    0.441390] usbcore: registered new interface driver sisusb
[    0.442838] i8042: PNP: No PS/2 controller found. Probing ports 
directly.
[    1.016545] i8042: Can't read CTR while initializing i8042
[    1.017954] i8042: probe of i8042 failed with error -5
[    1.019305] mousedev: PS/2 mouse device common for all mice
[    1.020764] usbcore: registered new interface driver appletouch
[    1.022547] rtc_cmos rtc_cmos: rtc core: registered rtc_cmos as rtc0
[    1.024189] rtc0: alarms up to one day, 114 bytes nvram
[    1.025490] applesmc: supported laptop not found!
[    1.026560] applesmc: driver init failed (ret=-19)!
[    1.027745] device-mapper: uevent: version 1.0.3
[    1.028871] device-mapper: ioctl: 4.20.0-ioctl (2011-02-02) 
initialised: dm-devel@redhat.com
[    1.031040] device-mapper: multipath: version 1.3.0 loaded
[    1.032514] device-mapper: multipath round-robin: version 1.0.0 loaded
[    1.034229] Bluetooth: Generic Bluetooth USB driver ver 0.6
[    1.035647] usbcore: registered new interface driver btusb
[    1.037031] cpuidle: using governor ladder
[    1.038056] cpuidle: using governor menu
[    1.039027] EFI Variables Facility v0.08 2004-May-17
[    1.040495] usbcore: registered new interface driver usbhid
[    1.041746] usbhid: USB HID core driver
[    1.043358] ALSA device list:
[    1.044042]   #0: Virtual MIDI Card 1
[    1.044903] nf_conntrack version 0.5.0 (373 buckets, 1492 max)
[    1.046694] ip_tables: (C) 2000-2006 Netfilter Core Team
[    1.047912] TCP cubic registered
[    1.048820] NET: Registered protocol family 10
[    1.050518] ip6_tables: (C) 2000-2006 Netfilter Core Team
[    1.051879] NET: Registered protocol family 17
[    1.053066] Bridge firewalling registered
[    1.054164] Bluetooth: RFCOMM TTY layer initialized
[    1.055401] Bluetooth: RFCOMM socket layer initialized
[    1.056696] Bluetooth: RFCOMM ver 1.11
[    1.057633] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[    1.058964] Bluetooth: BNEP filters: protocol multicast
[    1.060340] Installing 9P2000 support
[    1.061301] Registering the dns_resolver key type
[    1.062595] registered taskstats version 1
[    1.063689]   Magic number: 11:657:244
[    1.064801] rtc_cmos rtc_cmos: setting system clock to 2011-05-05 
20:12:16 UTC (1304626336)
[    1.066872] BIOS EDD facility v0.16 2004-Jun-25, 0 devices found
[    1.068349] EDD information not available.
[    1.069666] md: Waiting for all devices to be available before 
autodetect
[    1.071386] md: If you don't use raid, use raid=noautodetect
[    1.072930] md: Autodetecting RAID arrays.
[    1.073947] md: Scanned 0 and added 0 devices.
[    1.075044] md: autorun ...
[    1.075750] md: ... autorun DONE.
[    1.076662] VFS: Cannot open root device "vda1" or unknown-block(0,0)
[    1.078252] Please append a correct "root=" boot option; here are the 
available partitions:
[    1.080293] Kernel panic - not syncing: VFS: Unable to mount root fs on 
unknown-block(0,0)
[    1.082157] Pid: 1, comm: swapper Not tainted 2.6.39-rc6+ #29
[    1.083437] Call Trace:
[    1.084000]  [<ffffffff81709759>] panic+0x91/0x1a8
[    1.085116]  [<ffffffff817098b1>] ? printk+0x41/0x48
[    1.086358]  [<ffffffff81d13118>] mount_block_root+0x1ea/0x29e
[    1.087810]  [<ffffffff81d13222>] mount_root+0x56/0x5a
[    1.089088]  [<ffffffff81d13396>] prepare_namespace+0x170/0x19d
[    1.090497]  [<ffffffff81d126b0>] kernel_init+0x12a/0x135
[    1.091801]  [<ffffffff81082f47>] ? schedule_tail+0x27/0xb0
[    1.093210]  [<ffffffff817150e4>] kernel_thread_helper+0x4/0x10
[    1.094686]  [<ffffffff81d12586>] ? parse_early_options+0x20/0x20
[    1.096203]  [<ffffffff817150e0>] ? gs_change+0x13/0x13

   # KVM session terminated.

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

* Re: [patch 2/2] kvm tools - Cleanup IRQs definitions for virtio pci devices
  2011-05-05 20:14   ` Pekka Enberg
@ 2011-05-05 20:15     ` Cyrill Gorcunov
  2011-05-05 20:16       ` Pekka Enberg
  0 siblings, 1 reply; 10+ messages in thread
From: Cyrill Gorcunov @ 2011-05-05 20:15 UTC (permalink / raw)
  To: Pekka Enberg; +Cc: mingo, asias.hejun, prasadjoshi124, kvm, levinsasha928

On 05/06/2011 12:14 AM, Pekka Enberg wrote:
> On Thu, 5 May 2011, Cyrill Gorcunov wrote:
>> This also requires to tune up mptable code. Note the srcbusirq
>> need to follow specification convention, so we merge device
>> number and pin into one field inside mptable_set_default_int_src
>> helper.
>>
>> Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
> 
> This seems to break virtio drivers on my box.
> 

Crap, thanks Pekka, I'll recheck. Drop this series for a while then.

-- 
Thanks,
  Cyrill

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

* Re: [patch 2/2] kvm tools - Cleanup IRQs definitions for virtio pci devices
  2011-05-05 20:15     ` Cyrill Gorcunov
@ 2011-05-05 20:16       ` Pekka Enberg
  2011-05-05 20:19         ` Cyrill Gorcunov
  0 siblings, 1 reply; 10+ messages in thread
From: Pekka Enberg @ 2011-05-05 20:16 UTC (permalink / raw)
  To: Cyrill Gorcunov; +Cc: mingo, asias.hejun, prasadjoshi124, kvm, levinsasha928

On Fri, 6 May 2011, Cyrill Gorcunov wrote:
>> This seems to break virtio drivers on my box.
>>
>
> Crap, thanks Pekka, I'll recheck. Drop this series for a while then.

I merged the first patch and fixed up PCI_VIRTIO_BLK_DEVNUM to 10.

 			Pekka

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

* Re: [patch 2/2] kvm tools - Cleanup IRQs definitions for virtio pci devices
  2011-05-05 20:16       ` Pekka Enberg
@ 2011-05-05 20:19         ` Cyrill Gorcunov
  2011-05-05 20:24           ` Pekka Enberg
  0 siblings, 1 reply; 10+ messages in thread
From: Cyrill Gorcunov @ 2011-05-05 20:19 UTC (permalink / raw)
  To: Pekka Enberg; +Cc: mingo, asias.hejun, prasadjoshi124, kvm, levinsasha928

On 05/06/2011 12:16 AM, Pekka Enberg wrote:
> On Fri, 6 May 2011, Cyrill Gorcunov wrote:
>>> This seems to break virtio drivers on my box.
>>>
>>
>> Crap, thanks Pekka, I'll recheck. Drop this series for a while then.
> 
> I merged the first patch and fixed up PCI_VIRTIO_BLK_DEVNUM to 10.
> 
>             Pekka

Hmm, I don't think it's correct but rather workaround, if only I not miss
something...

-- 
Thanks,
  Cyrill

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

* Re: [patch 2/2] kvm tools - Cleanup IRQs definitions for virtio pci devices
  2011-05-05 20:19         ` Cyrill Gorcunov
@ 2011-05-05 20:24           ` Pekka Enberg
  0 siblings, 0 replies; 10+ messages in thread
From: Pekka Enberg @ 2011-05-05 20:24 UTC (permalink / raw)
  To: Cyrill Gorcunov; +Cc: mingo, asias.hejun, prasadjoshi124, kvm, levinsasha928

On Fri, 2011-05-06 at 00:19 +0400, Cyrill Gorcunov wrote:
> On 05/06/2011 12:16 AM, Pekka Enberg wrote:
> > On Fri, 6 May 2011, Cyrill Gorcunov wrote:
> >>> This seems to break virtio drivers on my box.
> >>>
> >>
> >> Crap, thanks Pekka, I'll recheck. Drop this series for a while then.
> > 
> > I merged the first patch and fixed up PCI_VIRTIO_BLK_DEVNUM to 10.
> 
> Hmm, I don't think it's correct but rather workaround, if only I not miss
> something...

It's correct because commit b764422bb0b46b00b896f6d4538ac3d3dde9e56b
("kvm tools: Add support for multiple virtio-blk") changed it to 10.


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

end of thread, other threads:[~2011-05-05 20:24 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-05 19:06 [patch 0/2] kvm-tools -- cleanup Cyrill Gorcunov
2011-05-05 19:06 ` [patch 1/2] kvm tools: Gather Virtio-PCI constants into one place Cyrill Gorcunov
2011-05-05 19:11   ` Cyrill Gorcunov
2011-05-05 20:09   ` Cyrill Gorcunov
2011-05-05 19:06 ` [patch 2/2] kvm tools - Cleanup IRQs definitions for virtio pci devices Cyrill Gorcunov
2011-05-05 20:14   ` Pekka Enberg
2011-05-05 20:15     ` Cyrill Gorcunov
2011-05-05 20:16       ` Pekka Enberg
2011-05-05 20:19         ` Cyrill Gorcunov
2011-05-05 20:24           ` Pekka Enberg

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