[PATCH v2 10/10] virtio_pci: rename virtio_pci -> virtio_pci_common

2014-12-08 Thread Michael S. Tsirkin
kbuild does not seem to like it when we name source files same as the module. Let's rename virtio_pci -> virtio_pci_common, and get rid of #include-ing c files. Signed-off-by: Michael S. Tsirkin --- drivers/virtio/{virtio_pci.h => virtio_pci_common.h} | 4 ++-- drivers/virtio/{virtio_pci.c => vi

[PATCH v2 09/10] virtio_pci: update file descriptions and copyright

2014-12-08 Thread Michael S. Tsirkin
There's been a lot of changes since 2007. List main authors, add Red Hat copyright. Signed-off-by: Michael S. Tsirkin --- drivers/virtio/virtio_pci.h| 5 - drivers/virtio/virtio_pci.c| 5 - drivers/virtio/virtio_pci_legacy.c | 5 - 3 files changed, 12 insertions(+), 3

[PATCH v2 07/10] virtio_pci: setup config vector indirectly

2014-12-08 Thread Michael S. Tsirkin
config vector setup is version specific, do it indirectly. Signed-off-by: Michael S. Tsirkin --- drivers/virtio/virtio_pci.c | 19 +-- 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/drivers/virtio/virtio_pci.c b/drivers/virtio/virtio_pci.c index 68023e5..c8ca3f7 1

[PATCH v2 08/10] virtio_pci: split out legacy device support

2014-12-08 Thread Michael S. Tsirkin
Move everything dealing with legacy devices out to virtio_pci_legacy.c. Expose common code APIs in virtio_pci.h Signed-off-by: Michael S. Tsirkin --- drivers/virtio/virtio_pci.h| 133 drivers/virtio/virtio_pci.c| 420 ++--- drivers/vir

[PATCH v2 06/10] virtio_pci: setup vqs indirectly

2014-12-08 Thread Michael S. Tsirkin
VQ setup is mostly version-specific, add another level of indirection to split the version-independent code out. Signed-off-by: Michael S. Tsirkin --- drivers/virtio/virtio_pci.c | 69 ++--- 1 file changed, 46 insertions(+), 23 deletions(-) diff --git a/d

[PATCH v2 05/10] virtio_pci: delete vqs indirectly

2014-12-08 Thread Michael S. Tsirkin
VQ deletion is mostly version-specific, add another level of indirection to split the version-independent code out. Signed-off-by: Michael S. Tsirkin --- drivers/virtio/virtio_pci.c | 27 --- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/drivers/virtio/vi

[PATCH v2 04/10] virtio_pci: use priv for vq notification

2014-12-08 Thread Michael S. Tsirkin
slightly reduce the amount of pointer chasing this needs to do. More importantly, this will easily generalize to virtio 1.0. Signed-off-by: Michael S. Tsirkin --- drivers/virtio/virtio_pci.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/virtio/virtio_pci.c b/dr

[PATCH v2 02/10] virtio_pci: fix coding style for structs

2014-12-08 Thread Michael S. Tsirkin
should be struct foo { } not struct foo { } Signed-off-by: Michael S. Tsirkin --- drivers/virtio/virtio_pci.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/virtio/virtio_pci.c b/drivers/virtio/virtio_pci.c index ee1b54c..6f3db1f 100644 --- a/drivers/virtio/

[PATCH v2 03/10] virtio_pci: free up vq->priv

2014-12-08 Thread Michael S. Tsirkin
We don't need to go from vq to vq info on data path, so using direct vq->priv pointer for that seems like a waste. Let's build an array of vq infos, then we can use vq->index for that lookup. Signed-off-by: Michael S. Tsirkin --- drivers/virtio/virtio_pci.c | 56 +---

[PATCH v2 01/10] virtio_pci: add isr field

2014-12-08 Thread Michael S. Tsirkin
Use isr field instead of direct access to ioaddr. This way generalizes easily to virtio 1.0. Signed-off-by: Michael S. Tsirkin --- drivers/virtio/virtio_pci.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/virtio/virtio_pci.c b/drivers/virtio/virtio_pci.c index

[PATCH v3 3/6] virtio: allow finalize_features to fail

2014-12-08 Thread Michael S. Tsirkin
This will make it easy for transports to validate features and return failure. Signed-off-by: Michael S. Tsirkin --- include/linux/virtio_config.h | 3 ++- drivers/lguest/lguest_device.c | 4 +++- drivers/misc/mic/card/mic_virtio.c | 4 +++- drivers/remoteproc/remoteproc_

[PATCH 9/9] virtio_pci: update file descriptions and copyright

2014-12-08 Thread Michael S. Tsirkin
There's been a lot of changes since 2007. List main authors, add Red Hat copyright. Signed-off-by: Michael S. Tsirkin --- drivers/virtio/virtio_pci.h| 5 - drivers/virtio/virtio_pci.c| 5 - drivers/virtio/virtio_pci_legacy.c | 5 - 3 files changed, 12 insertions(+), 3

[PATCH 6/9] virtio_pci: setup vqs indirectly

2014-12-08 Thread Michael S. Tsirkin
VQ setup is mostly version-specific, add another level of indirection to split the version-independent code out. Signed-off-by: Michael S. Tsirkin --- drivers/virtio/virtio_pci.c | 69 ++--- 1 file changed, 46 insertions(+), 23 deletions(-) diff --git a/d

[PATCH 8/9] virtio_pci: split out legacy device support

2014-12-08 Thread Michael S. Tsirkin
Move everything dealing with legacy devices out to virtio_pci_legacy.c. Expose common code APIs in virtio_pci.h Signed-off-by: Michael S. Tsirkin --- drivers/virtio/virtio_pci.h| 133 drivers/virtio/virtio_pci.c| 420 ++--- drivers/vir

[PATCH 5/9] virtio_pci: delete vqs indirectly

2014-12-08 Thread Michael S. Tsirkin
VQ deletion is mostly version-specific, add another level of indirection to split the version-independent code out. Signed-off-by: Michael S. Tsirkin --- drivers/virtio/virtio_pci.c | 27 --- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/drivers/virtio/vi

[PATCH 7/9] virtio_pci: setup config vector indirectly

2014-12-08 Thread Michael S. Tsirkin
config vector setup is version specific, do it indirectly. Signed-off-by: Michael S. Tsirkin --- drivers/virtio/virtio_pci.c | 19 +-- 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/drivers/virtio/virtio_pci.c b/drivers/virtio/virtio_pci.c index 68023e5..c8ca3f7 1

[PATCH 4/9] virtio_pci: use priv for vq notification

2014-12-08 Thread Michael S. Tsirkin
slightly reduce the amount of pointer chasing this needs to do. More importantly, this will easily generalize to virtio 1.0. Signed-off-by: Michael S. Tsirkin --- drivers/virtio/virtio_pci.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/virtio/virtio_pci.c b/dr

[PATCH 3/9] virtio_pci: free up vq->priv

2014-12-08 Thread Michael S. Tsirkin
We don't need to go from vq to vq info on data path, so using direct vq->priv pointer for that seems like a waste. Let's build an array of vq infos, then we can use vq->index for that lookup. Signed-off-by: Michael S. Tsirkin --- drivers/virtio/virtio_pci.c | 56 +---

[PATCH 2/9] virtio_pci: fix coding style for structs

2014-12-08 Thread Michael S. Tsirkin
should be struct foo { } not struct foo { } Signed-off-by: Michael S. Tsirkin --- drivers/virtio/virtio_pci.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/virtio/virtio_pci.c b/drivers/virtio/virtio_pci.c index ee1b54c..6f3db1f 100644 --- a/drivers/virtio/

[PATCH 0/9] virtio_pci: split out legacy device support

2014-12-08 Thread Michael S. Tsirkin
virtio 1.0 support for virtio-pci isn't ready yet. Therefore, this patchset doesn't make any functional changes. Instead, this simply refactors virtio-pci, splitting legacy device support code out to a separate file: virtio_pci_legacy.c For virtio 1.0, all that's left is to add virtio_pci_modern.c

[PATCH v3 6/6] virtio: drop legacy_only driver flag

2014-12-08 Thread Michael S. Tsirkin
legacy_only flag is now unused, drop it from core. Signed-off-by: Michael S. Tsirkin --- include/linux/virtio.h | 2 -- drivers/virtio/virtio.c | 4 2 files changed, 6 deletions(-) diff --git a/include/linux/virtio.h b/include/linux/virtio.h index d666bcb..d09e093 100644 --- a/include/lin

[PATCH 1/9] virtio_pci: add isr field

2014-12-08 Thread Michael S. Tsirkin
Use isr field instead of direct access to ioaddr. This way generalizes easily to virtio 1.0. Signed-off-by: Michael S. Tsirkin --- drivers/virtio/virtio_pci.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/virtio/virtio_pci.c b/drivers/virtio/virtio_pci.c index

[PATCH v3 5/6] virtio_balloon: drop legacy_only driver flag

2014-12-08 Thread Michael S. Tsirkin
we have blacklisted balloon in core, no need for a driver flag. Signed-off-by: Michael S. Tsirkin --- drivers/virtio/virtio_balloon.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c index 4497def..c9703d4 100644 --- a/drivers/v

[PATCH v3 0/6] virtio 1.0 enhancements

2014-12-08 Thread Michael S. Tsirkin
These are minor robustness enhancements on top of v8 of the patchset [PATCH v8 00/50] linux: towards virtio-1 guest support http://mid.gmane.org/1417449619-24896-1-git-send-email-...@redhat.com As that one seems stable and actually seems to work well for people, I'm not respinning it anymo

[PATCH v3 1/6] virtio: add API to detect legacy devices

2014-12-08 Thread Michael S. Tsirkin
transports need to be able to detect legacy-only devices (ATM balloon only) to use legacy path to drive them. Add a core API to do just that. The implementation just blacklists balloon: not too pretty, but let's not over-engineer. Signed-off-by: Michael S. Tsirkin Acked-by: Cornelia Huck --- i

[PATCH v5 REPOST 6/6] hw_random: don't init list element we're about to add to list.

2014-12-08 Thread Amos Kong
From: Rusty Russell Another interesting anti-pattern. Signed-off-by: Rusty Russell --- drivers/char/hw_random/core.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c index a9286bf..4d13ac5 100644 --- a/drivers/char/hw_random/core.

[PATCH v5 REPOST 4/6] hw_random: fix unregister race.

2014-12-08 Thread Amos Kong
From: Rusty Russell The previous patch added one potential problem: we can still be reading from a hwrng when it's unregistered. Add a wait for zero in the hwrng_unregister path. v5: reset cleanup_done flag, use compiler barrier to prevent recording. v4: add cleanup_done flag to insure that cle

[PATCH v5 REPOST 1/6] hw_random: place mutex around read functions and buffers.

2014-12-08 Thread Amos Kong
From: Rusty Russell There's currently a big lock around everything, and it means that we can't query sysfs (eg /sys/devices/virtual/misc/hw_random/rng_current) while the rng is reading. This is a real problem when the rng is slow, or blocked (eg. virtio_rng with qemu's default /dev/random backen

[PATCH v5 REPOST 2/6] hw_random: move some code out mutex_lock for avoiding underlying deadlock

2014-12-08 Thread Amos Kong
In next patch, we use reference counting for each struct hwrng, changing reference count also needs to take mutex_lock. Before releasing the lock, if we try to stop a kthread that waits to take the lock to reduce the referencing count, deadlock will occur. Signed-off-by: Amos Kong --- drivers/ch

[PATCH v5 REPOST 0/6] fix hw_random stuck

2014-12-08 Thread Amos Kong
When I hotunplug a busy virtio-rng device or try to access hwrng attributes in non-smp guest, it gets stuck. My hotplug tests: | test 0: | hotunplug rng device from qemu monitor | | test 1: | guest) # dd if=/dev/hwrng of=/dev/null & | hotunplug rng device from qemu monitor | | test 2: | g

[PATCH v5 REPOST 5/6] hw_random: don't double-check old_rng.

2014-12-08 Thread Amos Kong
From: Rusty Russell Interesting anti-pattern. Signed-off-by: Rusty Russell --- drivers/char/hw_random/core.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c index 067270b..a9286bf 100644 --- a/drivers/char/h

[PATCH v5 REPOST 3/6] hw_random: use reference counts on each struct hwrng.

2014-12-08 Thread Amos Kong
From: Rusty Russell current_rng holds one reference, and we bump it every time we want to do a read from it. This means we only hold the rng_mutex to grab or drop a reference, so accessing /sys/devices/virtual/misc/hw_random/rng_current doesn't block on read of /dev/hwrng. Using a kref is overk