* [PATCH 1/6] VMCI: Add PCI as a dependency
@ 2013-01-10 23:41 Dmitry Torokhov
2013-01-10 23:41 ` [PATCH 2/6] VMCI: Remove dependency on BLOCK I/O Dmitry Torokhov
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Dmitry Torokhov @ 2013-01-10 23:41 UTC (permalink / raw)
To: Greg KH; +Cc: Randy Dunlap, Stephen Rothwell, linux-kernel, pv-drivers
From: Andy King <acking@vmware.com>
Add PCI as a dependency to our build, since we always compile in the guest-side
PCI device support.
Reported-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Andy King <acking@vmware.com>
Signed-off-by: Dmitry Torokhov <dtor@vmware.com>
---
Greg,
Here is the set of patches addressing compilation issues in VMCI
reported on LKML by Randy and also change renaming PPNSet to ppn_set
that I promised you.
Thanks,
Dmitry
drivers/misc/vmw_vmci/Kconfig | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/misc/vmw_vmci/Kconfig b/drivers/misc/vmw_vmci/Kconfig
index 55015e7..39c2eca 100644
--- a/drivers/misc/vmw_vmci/Kconfig
+++ b/drivers/misc/vmw_vmci/Kconfig
@@ -4,7 +4,7 @@
config VMWARE_VMCI
tristate "VMware VMCI Driver"
- depends on X86
+ depends on X86 && PCI
help
This is VMware's Virtual Machine Communication Interface. It enables
high-speed communication between host and guest in a virtual
--
1.7.4.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/6] VMCI: Remove dependency on BLOCK I/O
2013-01-10 23:41 [PATCH 1/6] VMCI: Add PCI as a dependency Dmitry Torokhov
@ 2013-01-10 23:41 ` Dmitry Torokhov
2013-01-10 23:41 ` [PATCH 3/6] VMCI: Fix deref before NULL-check of queuepair ptr Dmitry Torokhov
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Dmitry Torokhov @ 2013-01-10 23:41 UTC (permalink / raw)
To: Greg KH; +Cc: Randy Dunlap, Stephen Rothwell, linux-kernel, pv-drivers
From: Andy King <acking@vmware.com>
No need to bring in dm-mapper.h and along with it a dependency on BLOCK I/O
just to use dm_div_up(). Just use the existing DIV_ROUND_UP().
Reported-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Andy King <acking@vmware.com>
Signed-off-by: Dmitry Torokhov <dtor@vmware.com>
---
drivers/misc/vmw_vmci/vmci_queue_pair.c | 28 ++++++++++++++++------------
1 files changed, 16 insertions(+), 12 deletions(-)
diff --git a/drivers/misc/vmw_vmci/vmci_queue_pair.c b/drivers/misc/vmw_vmci/vmci_queue_pair.c
index 1123111..da47e45 100644
--- a/drivers/misc/vmw_vmci/vmci_queue_pair.c
+++ b/drivers/misc/vmw_vmci/vmci_queue_pair.c
@@ -13,12 +13,16 @@
* for more details.
*/
-#include <linux/device-mapper.h>
#include <linux/vmw_vmci_defs.h>
#include <linux/vmw_vmci_api.h>
+#include <linux/highmem.h>
#include <linux/kernel.h>
+#include <linux/mm.h>
#include <linux/module.h>
#include <linux/mutex.h>
+#include <linux/pagemap.h>
+#include <linux/sched.h>
+#include <linux/slab.h>
#include <linux/socket.h>
#include <linux/wait.h>
@@ -246,9 +250,9 @@ static struct qp_list qp_guest_endpoints = {
};
#define INVALID_VMCI_GUEST_MEM_ID 0
-#define QPE_NUM_PAGES(_QPE) ((u32) \
- (dm_div_up(_QPE.produce_size, PAGE_SIZE) + \
- dm_div_up(_QPE.consume_size, PAGE_SIZE) + 2))
+#define QPE_NUM_PAGES(_QPE) ((u32) \
+ (DIV_ROUND_UP(_QPE.produce_size, PAGE_SIZE) + \
+ DIV_ROUND_UP(_QPE.consume_size, PAGE_SIZE) + 2))
/*
@@ -260,7 +264,7 @@ static void qp_free_queue(void *q, u64 size)
struct vmci_queue *queue = q;
if (queue) {
- u64 i = dm_div_up(size, PAGE_SIZE);
+ u64 i = DIV_ROUND_UP(size, PAGE_SIZE);
if (queue->kernel_if->mapped) {
vunmap(queue->kernel_if->va);
@@ -289,7 +293,7 @@ static void *qp_alloc_queue(u64 size, u32 flags)
u64 i;
struct vmci_queue *queue;
struct vmci_queue_header *q_header;
- const u64 num_data_pages = dm_div_up(size, PAGE_SIZE);
+ const u64 num_data_pages = DIV_ROUND_UP(size, PAGE_SIZE);
const uint queue_size =
PAGE_SIZE +
sizeof(*queue) + sizeof(*(queue->kernel_if)) +
@@ -611,7 +615,7 @@ static int qp_memcpy_from_queue_iov(void *dest,
static struct vmci_queue *qp_host_alloc_queue(u64 size)
{
struct vmci_queue *queue;
- const size_t num_pages = dm_div_up(size, PAGE_SIZE) + 1;
+ const size_t num_pages = DIV_ROUND_UP(size, PAGE_SIZE) + 1;
const size_t queue_size = sizeof(*queue) + sizeof(*(queue->kernel_if));
const size_t queue_page_size =
num_pages * sizeof(*queue->kernel_if->page);
@@ -963,8 +967,8 @@ qp_guest_endpoint_create(struct vmci_handle handle,
int result;
struct qp_guest_endpoint *entry;
/* One page each for the queue headers. */
- const u64 num_ppns = dm_div_up(produce_size, PAGE_SIZE) +
- dm_div_up(consume_size, PAGE_SIZE) + 2;
+ const u64 num_ppns = DIV_ROUND_UP(produce_size, PAGE_SIZE) +
+ DIV_ROUND_UP(consume_size, PAGE_SIZE) + 2;
if (vmci_handle_is_invalid(handle)) {
u32 context_id = vmci_get_context_id();
@@ -1175,9 +1179,9 @@ static int qp_alloc_guest_work(struct vmci_handle *handle,
u32 priv_flags)
{
const u64 num_produce_pages =
- dm_div_up(produce_size, PAGE_SIZE) + 1;
+ DIV_ROUND_UP(produce_size, PAGE_SIZE) + 1;
const u64 num_consume_pages =
- dm_div_up(consume_size, PAGE_SIZE) + 1;
+ DIV_ROUND_UP(consume_size, PAGE_SIZE) + 1;
void *my_produce_q = NULL;
void *my_consume_q = NULL;
int result;
@@ -1456,7 +1460,7 @@ static int qp_broker_create(struct vmci_handle handle,
entry->state = VMCIQPB_CREATED_MEM;
entry->produce_q->q_header = entry->local_mem;
tmp = (u8 *)entry->local_mem + PAGE_SIZE *
- (dm_div_up(entry->qp.produce_size, PAGE_SIZE) + 1);
+ (DIV_ROUND_UP(entry->qp.produce_size, PAGE_SIZE) + 1);
entry->consume_q->q_header = (struct vmci_queue_header *)tmp;
} else if (page_store) {
/*
--
1.7.4.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/6] VMCI: Fix deref before NULL-check of queuepair ptr
2013-01-10 23:41 [PATCH 1/6] VMCI: Add PCI as a dependency Dmitry Torokhov
2013-01-10 23:41 ` [PATCH 2/6] VMCI: Remove dependency on BLOCK I/O Dmitry Torokhov
@ 2013-01-10 23:41 ` Dmitry Torokhov
2013-01-10 23:41 ` [PATCH 4/6] VMCI: Fix "always true condition" Dmitry Torokhov
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Dmitry Torokhov @ 2013-01-10 23:41 UTC (permalink / raw)
To: Greg KH; +Cc: Randy Dunlap, Stephen Rothwell, linux-kernel, pv-drivers
From: Andy King <acking@vmware.com>
Check for a valid queuepair ptr before trying to lock the queuepair (which will
deref it).
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Andy King <acking@vmware.com>
Signed-off-by: Dmitry Torokhov <dtor@vmware.com>
---
drivers/misc/vmw_vmci/vmci_queue_pair.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/misc/vmw_vmci/vmci_queue_pair.c b/drivers/misc/vmw_vmci/vmci_queue_pair.c
index da47e45..6417a26 100644
--- a/drivers/misc/vmw_vmci/vmci_queue_pair.c
+++ b/drivers/misc/vmw_vmci/vmci_queue_pair.c
@@ -3355,11 +3355,11 @@ ssize_t vmci_qpair_dequev(struct vmci_qp *qpair,
{
ssize_t result;
- qp_lock(qpair);
-
if (!qpair || !iov)
return VMCI_ERROR_INVALID_ARGS;
+ qp_lock(qpair);
+
do {
result = qp_dequeue_locked(qpair->produce_q,
qpair->consume_q,
--
1.7.4.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 4/6] VMCI: Fix "always true condition"
2013-01-10 23:41 [PATCH 1/6] VMCI: Add PCI as a dependency Dmitry Torokhov
2013-01-10 23:41 ` [PATCH 2/6] VMCI: Remove dependency on BLOCK I/O Dmitry Torokhov
2013-01-10 23:41 ` [PATCH 3/6] VMCI: Fix deref before NULL-check of queuepair ptr Dmitry Torokhov
@ 2013-01-10 23:41 ` Dmitry Torokhov
2013-01-10 23:41 ` [PATCH 5/6] VMCI: rename PPNset to ppn_set to avoid camel case Dmitry Torokhov
2013-01-10 23:41 ` [PATCH 6/6] VMCI: include slab.h into files using kmalloc/kfree Dmitry Torokhov
4 siblings, 0 replies; 6+ messages in thread
From: Dmitry Torokhov @ 2013-01-10 23:41 UTC (permalink / raw)
To: Greg KH; +Cc: Randy Dunlap, Stephen Rothwell, linux-kernel, pv-drivers
From: Andy King <acking@vmware.com>
vmci_send_datagram() returns an int, with negative values indicating failure.
But we store it locally in a u32, which makes comparison of >= 0 useless.
Fixed to use an int.
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Andy King <acking@vmware.com>
Signed-off-by: Dmitry Torokhov <dtor@vmware.com>
---
drivers/misc/vmw_vmci/vmci_guest.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/misc/vmw_vmci/vmci_guest.c b/drivers/misc/vmw_vmci/vmci_guest.c
index d302c89..d7df6cf 100644
--- a/drivers/misc/vmw_vmci/vmci_guest.c
+++ b/drivers/misc/vmw_vmci/vmci_guest.c
@@ -78,7 +78,7 @@ bool vmci_guest_code_active(void)
u32 vmci_get_vm_context_id(void)
{
if (vm_context_id == VMCI_INVALID_ID) {
- u32 result;
+ int result;
struct vmci_datagram get_cid_msg;
get_cid_msg.dst =
vmci_make_handle(VMCI_HYPERVISOR_CONTEXT_ID,
--
1.7.4.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 5/6] VMCI: rename PPNset to ppn_set to avoid camel case
2013-01-10 23:41 [PATCH 1/6] VMCI: Add PCI as a dependency Dmitry Torokhov
` (2 preceding siblings ...)
2013-01-10 23:41 ` [PATCH 4/6] VMCI: Fix "always true condition" Dmitry Torokhov
@ 2013-01-10 23:41 ` Dmitry Torokhov
2013-01-10 23:41 ` [PATCH 6/6] VMCI: include slab.h into files using kmalloc/kfree Dmitry Torokhov
4 siblings, 0 replies; 6+ messages in thread
From: Dmitry Torokhov @ 2013-01-10 23:41 UTC (permalink / raw)
To: Greg KH; +Cc: Randy Dunlap, Stephen Rothwell, linux-kernel, pv-drivers
Acked-by: Andy King <acking@vmware.com>
Signed-off-by: Dmitry Torokhov <dtor@vmware.com>
---
drivers/misc/vmw_vmci/vmci_queue_pair.c | 8 ++++----
drivers/misc/vmw_vmci/vmci_queue_pair.h | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/misc/vmw_vmci/vmci_queue_pair.c b/drivers/misc/vmw_vmci/vmci_queue_pair.c
index 6417a26..ef81fec 100644
--- a/drivers/misc/vmw_vmci/vmci_queue_pair.c
+++ b/drivers/misc/vmw_vmci/vmci_queue_pair.c
@@ -231,7 +231,7 @@ struct qp_guest_endpoint {
u64 num_ppns;
void *produce_q;
void *consume_q;
- struct PPNSet ppn_set;
+ struct ppn_set ppn_set;
};
struct qp_list {
@@ -461,7 +461,7 @@ static int __qp_memcpy_from_queue(void *dest,
static int qp_alloc_ppn_set(void *prod_q,
u64 num_produce_pages,
void *cons_q,
- u64 num_consume_pages, struct PPNSet *ppn_set)
+ u64 num_consume_pages, struct ppn_set *ppn_set)
{
u32 *produce_ppns;
u32 *consume_ppns;
@@ -532,7 +532,7 @@ static int qp_alloc_ppn_set(void *prod_q,
/*
* Frees the two list of PPNs for a queue pair.
*/
-static void qp_free_ppn_set(struct PPNSet *ppn_set)
+static void qp_free_ppn_set(struct ppn_set *ppn_set)
{
if (ppn_set->initialized) {
/* Do not call these functions on NULL inputs. */
@@ -546,7 +546,7 @@ static void qp_free_ppn_set(struct PPNSet *ppn_set)
* Populates the list of PPNs in the hypercall structure with the PPNS
* of the produce queue and the consume queue.
*/
-static int qp_populate_ppn_set(u8 *call_buf, const struct PPNSet *ppn_set)
+static int qp_populate_ppn_set(u8 *call_buf, const struct ppn_set *ppn_set)
{
memcpy(call_buf, ppn_set->produce_ppns,
ppn_set->num_produce_pages * sizeof(*ppn_set->produce_ppns));
diff --git a/drivers/misc/vmw_vmci/vmci_queue_pair.h b/drivers/misc/vmw_vmci/vmci_queue_pair.h
index 8d8d6a1..58c6959 100644
--- a/drivers/misc/vmw_vmci/vmci_queue_pair.h
+++ b/drivers/misc/vmw_vmci/vmci_queue_pair.h
@@ -25,7 +25,7 @@
typedef int (*vmci_event_release_cb) (void *client_data);
/* Guest device port I/O. */
-struct PPNSet {
+struct ppn_set {
u64 num_produce_pages;
u64 num_consume_pages;
u32 *produce_ppns;
--
1.7.4.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 6/6] VMCI: include slab.h into files using kmalloc/kfree
2013-01-10 23:41 [PATCH 1/6] VMCI: Add PCI as a dependency Dmitry Torokhov
` (3 preceding siblings ...)
2013-01-10 23:41 ` [PATCH 5/6] VMCI: rename PPNset to ppn_set to avoid camel case Dmitry Torokhov
@ 2013-01-10 23:41 ` Dmitry Torokhov
4 siblings, 0 replies; 6+ messages in thread
From: Dmitry Torokhov @ 2013-01-10 23:41 UTC (permalink / raw)
To: Greg KH; +Cc: Randy Dunlap, Stephen Rothwell, linux-kernel, pv-drivers
Do not rely on implicit header dependencies as they are known to
break.
Reported-by: Randy Dunlap <rdunlap@infradead.org>
Acked-by: Andy King <acking@vmware.com>
Signed-off-by: Dmitry Torokhov <dtor@vmware.com>
---
drivers/misc/vmw_vmci/vmci_guest.c | 3 +++
drivers/misc/vmw_vmci/vmci_host.c | 1 +
2 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/drivers/misc/vmw_vmci/vmci_guest.c b/drivers/misc/vmw_vmci/vmci_guest.c
index d7df6cf..de1a90b 100644
--- a/drivers/misc/vmw_vmci/vmci_guest.c
+++ b/drivers/misc/vmw_vmci/vmci_guest.c
@@ -19,12 +19,15 @@
#include <linux/interrupt.h>
#include <linux/highmem.h>
#include <linux/kernel.h>
+#include <linux/mm.h>
#include <linux/module.h>
#include <linux/sched.h>
+#include <linux/slab.h>
#include <linux/init.h>
#include <linux/pci.h>
#include <linux/smp.h>
#include <linux/io.h>
+#include <linux/vmalloc.h>
#include "vmci_datagram.h"
#include "vmci_doorbell.h"
diff --git a/drivers/misc/vmw_vmci/vmci_host.c b/drivers/misc/vmw_vmci/vmci_host.c
index 16e7f54..d4722b3 100644
--- a/drivers/misc/vmw_vmci/vmci_host.c
+++ b/drivers/misc/vmw_vmci/vmci_host.c
@@ -24,6 +24,7 @@
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/sched.h>
+#include <linux/slab.h>
#include <linux/file.h>
#include <linux/init.h>
#include <linux/poll.h>
--
1.7.4.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2013-01-10 23:41 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-10 23:41 [PATCH 1/6] VMCI: Add PCI as a dependency Dmitry Torokhov
2013-01-10 23:41 ` [PATCH 2/6] VMCI: Remove dependency on BLOCK I/O Dmitry Torokhov
2013-01-10 23:41 ` [PATCH 3/6] VMCI: Fix deref before NULL-check of queuepair ptr Dmitry Torokhov
2013-01-10 23:41 ` [PATCH 4/6] VMCI: Fix "always true condition" Dmitry Torokhov
2013-01-10 23:41 ` [PATCH 5/6] VMCI: rename PPNset to ppn_set to avoid camel case Dmitry Torokhov
2013-01-10 23:41 ` [PATCH 6/6] VMCI: include slab.h into files using kmalloc/kfree Dmitry Torokhov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox