[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Minios-devel] [UNIKRAFT PATCH 4/9] plat/xen/drivers/9p: Add device list


  • To: "minios-devel@xxxxxxxxxxxxx" <minios-devel@xxxxxxxxxxxxx>
  • From: Vlad-Andrei BĂDOIU (78692) <vlad_andrei.badoiu@xxxxxxxxxxxxxxx>
  • Date: Sat, 7 Sep 2019 10:21:57 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=stud.acs.upb.ro; dmarc=pass action=none header.from=stud.acs.upb.ro; dkim=pass header.d=stud.acs.upb.ro; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=v4XSHnWzLKU/G32kWW+ChJ1Cxavu02P9raKYoB+tU+A=; b=lnx+W5nAuJDf5ZED0NwtOhDmdKPogaHHDYHeOp6KRrLt9lYJnThnCujR4FG5A16J3yu7fs6eEv3fvPK7ePJswbHm49s8gP3hA96v2lL+pCF6Ef8L6fdunyJ96yIkJgiNVKmL7fFLO++UomFddX6ADIhUKAaBS9LCbSeALYF0mrfVGZATmMkfdqJROsMj0N2Rgzv0o1GeXw39gdnTmtC/QLv6mhJfwzZOTpaahO1tkjyE4S0s7guekIhBiSMrHgIeDqey7nOEbqC0RyPlKQH4rfpMSebOGI8MXODVAtUi+jBVqv9A3/tU6NRRThaBXqu9g3KEi1dOlgM6NKKiyDgtyg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=agn/cgVqQoEvknwQZNEOdihsf1PB5n0HDINcSlm9GvHQmEYELbwK30mjgWfVYe+sCXO6cSqdsJDv/9rGdM1zH2GHYpsHP6PzHLIdh75APsj5r0LqHAQEHffOvVLvhg6TUKOBeucsaRQ48sGAWbQ68vl6TTEK7/nBl+OZ2NK4NqY+US55mWRkE5JwT4Y6yL5qWoCsjlYYMjKMO+MxXGHTY5c6DQ6arukqy5ZmEAm9DtlMPjl77aAZow/H2DsaSfCkrQKQyNvGNwIDqn8zEmhl5d71k+Mh6QFP3ZHhEvC38vs7Q/OL77h2o6xOGn77P98mCHiHR2CfyZeXzdmlmLCN9w==
  • Authentication-results: spf=none (sender IP is ) smtp.mailfrom=vlad_andrei.badoiu@xxxxxxxxxxxxxxx;
  • Cc: "costin.lupu@xxxxxxxxx" <costin.lupu@xxxxxxxxx>, Cristian Banu <cristb@xxxxxxxxx>
  • Delivery-date: Sat, 07 Sep 2019 10:22:20 +0000
  • List-id: Mini-os development list <minios-devel.lists.xenproject.org>
  • Thread-index: AQHVZWYUHaOYAVgy90CBpCzSzzpyYQ==
  • Thread-topic: [UNIKRAFT PATCH 4/9] plat/xen/drivers/9p: Add device list

From: Cristian Banu <cristb@xxxxxxxxx>

This patch adds the 9pfront device list. 9pfront devices are added to
the list when probed.

Signed-off-by: Cristian Banu <cristb@xxxxxxxxx>
---
 plat/xen/drivers/9p/9pfront.c | 46 ++++++++++++++++++++++++++++++++---
 plat/xen/drivers/9p/9pfront.h |  2 ++
 2 files changed, 45 insertions(+), 3 deletions(-)

diff --git a/plat/xen/drivers/9p/9pfront.c b/plat/xen/drivers/9p/9pfront.c
index 8c9880e8..f289cd05 100644
--- a/plat/xen/drivers/9p/9pfront.c
+++ b/plat/xen/drivers/9p/9pfront.c
@@ -32,18 +32,58 @@
  * THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY.
  */
 
+#include <uk/config.h>
+#include <uk/alloc.h>
+#include <uk/assert.h>
+#include <uk/essentials.h>
+#include <uk/list.h>
+#include <uk/plat/spinlock.h>
 #include <xenbus/xenbus.h>
 
+#include "9pfront_xb.h"
+
 #define DRIVER_NAME    "xen-9pfront"
 
-static int p9front_drv_init(struct uk_alloc *drv_allocator __unused)
+static struct uk_alloc *a;
+static UK_LIST_HEAD(p9front_device_list);
+static DEFINE_SPINLOCK(p9front_device_list_lock);
+
+static int p9front_drv_init(struct uk_alloc *drv_allocator)
 {
+       if (!drv_allocator)
+               return -EINVAL;
+
+       a = drv_allocator;
+
        return 0;
 }
 
-static int p9front_add_dev(struct xenbus_device *xendev __unused)
+static int p9front_add_dev(struct xenbus_device *xendev)
 {
-       return 0;
+       struct p9front_dev *p9fdev;
+       int rc;
+       unsigned long flags;
+
+       p9fdev = uk_calloc(a, 1, sizeof(*p9fdev));
+       if (!p9fdev) {
+               rc = -ENOMEM;
+               goto out;
+       }
+
+       p9fdev->xendev = xendev;
+       rc = p9front_xb_init(p9fdev);
+       if (rc)
+               goto out_free;
+
+       rc = 0;
+       ukplat_spin_lock_irqsave(&p9front_device_list_lock, flags);
+       uk_list_add(&p9fdev->_list, &p9front_device_list);
+       ukplat_spin_unlock_irqrestore(&p9front_device_list_lock, flags);
+
+out_free:
+       uk_free(a, p9fdev);
+out:
+       return rc;
 }
 
 static const xenbus_dev_type_t p9front_devtypes[] = {
diff --git a/plat/xen/drivers/9p/9pfront.h b/plat/xen/drivers/9p/9pfront.h
index 0dd99d6c..e77f315a 100644
--- a/plat/xen/drivers/9p/9pfront.h
+++ b/plat/xen/drivers/9p/9pfront.h
@@ -42,6 +42,8 @@
 struct p9front_dev {
        /* Xenbus device. */
        struct xenbus_device *xendev;
+       /* Entry within the 9pfront device list. */
+       struct uk_list_head _list;
        /* Number of maximum rings, read from xenstore. */
        int nb_max_rings;
        /* Maximum ring page order, read from xenstore. */
-- 
2.20.1


_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.