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

Re: [Minios-devel] [UNIKRAFT PATCH v2 1/5] plat/drivers: Virtio 9P driver skeleton



Reviewed-by: Costin Lupu <costin.lupu@xxxxxxxxx>

On 9/7/19 12:45 PM, Vlad-Andrei BĂDOIU (78692) wrote:
> From: Cristian Banu <cristb@xxxxxxxxx>
> 
> This patch adds the virtio 9P driver skeleton.
> 
> Signed-off-by: Cristian Banu <cristb@xxxxxxxxx>
> ---
>  plat/drivers/include/virtio/virtio_9p.h | 44 +++++++++++++++++++
>  plat/drivers/virtio/virtio_9p.c         | 58 +++++++++++++++++++++++++
>  plat/kvm/Config.uk                      |  9 ++++
>  plat/kvm/Makefile.uk                    | 13 ++++++
>  4 files changed, 124 insertions(+)
>  create mode 100644 plat/drivers/include/virtio/virtio_9p.h
>  create mode 100644 plat/drivers/virtio/virtio_9p.c
> 
> diff --git a/plat/drivers/include/virtio/virtio_9p.h 
> b/plat/drivers/include/virtio/virtio_9p.h
> new file mode 100644
> index 00000000..5459a397
> --- /dev/null
> +++ b/plat/drivers/include/virtio/virtio_9p.h
> @@ -0,0 +1,44 @@
> +/* SPDX-License-Identifier: BSD-3-Clause */
> +/*
> + * Authors: Cristian Banu <cristb@xxxxxxxxx>
> + *
> + * Copyright (c) 2019, University Politehnica of Bucharest. All rights 
> reserved.
> + *
> + * Redistribution and use in source and binary forms, with or without
> + * modification, are permitted provided that the following conditions
> + * are met:
> + *
> + * 1. Redistributions of source code must retain the above copyright
> + *    notice, this list of conditions and the following disclaimer.
> + * 2. Redistributions in binary form must reproduce the above copyright
> + *    notice, this list of conditions and the following disclaimer in the
> + *    documentation and/or other materials provided with the distribution.
> + * 3. Neither the name of the copyright holder nor the names of its
> + *    contributors may be used to endorse or promote products derived from
> + *    this software without specific prior written permission.
> + *
> + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 
> IS"
> + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
> + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
> + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
> + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
> + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
> + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
> + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
> + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
> + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
> + * POSSIBILITY OF SUCH DAMAGE.
> + *
> + * THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY.
> + */
> +
> +#ifndef __PLAT_DRV_VIRTIO_9P_H
> +#define __PLAT_DRV_VIRTIO_9P_H
> +#include <uk/config.h>
> +#include <uk/arch/types.h>
> +
> +#include <virtio/virtio_ids.h>
> +#include <virtio/virtio_config.h>
> +#include <virtio/virtio_types.h>
> +
> +#endif /* __PLAT_DRV_VIRTIO_9P_H */
> diff --git a/plat/drivers/virtio/virtio_9p.c b/plat/drivers/virtio/virtio_9p.c
> new file mode 100644
> index 00000000..855548fe
> --- /dev/null
> +++ b/plat/drivers/virtio/virtio_9p.c
> @@ -0,0 +1,58 @@
> +/* SPDX-License-Identifier: BSD-3-Clause */
> +/*
> + * Authors: Cristian Banu <cristb@xxxxxxxxx>
> + *
> + * Copyright (c) 2019, University Politehnica of Bucharest. All rights 
> reserved.
> + *
> + * Redistribution and use in source and binary forms, with or without
> + * modification, are permitted provided that the following conditions
> + * are met:
> + *
> + * 1. Redistributions of source code must retain the above copyright
> + *    notice, this list of conditions and the following disclaimer.
> + * 2. Redistributions in binary form must reproduce the above copyright
> + *    notice, this list of conditions and the following disclaimer in the
> + *    documentation and/or other materials provided with the distribution.
> + * 3. Neither the name of the copyright holder nor the names of its
> + *    contributors may be used to endorse or promote products derived from
> + *    this software without specific prior written permission.
> + *
> + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 
> IS"
> + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
> + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
> + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
> + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
> + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
> + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
> + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
> + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
> + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
> + * POSSIBILITY OF SUCH DAMAGE.
> + *
> + * THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY.
> + */
> +
> +#include <virtio/virtio_bus.h>
> +#include <virtio/virtio_9p.h>
> +
> +static int virtio_9p_add_dev(struct virtio_dev *vdev __unused)
> +{
> +     return 0;
> +}
> +
> +static int virtio_9p_drv_init(struct uk_alloc *drv_allocator __unused)
> +{
> +     return 0;
> +}
> +
> +static const struct virtio_dev_id v9p_dev_id[] = {
> +     {VIRTIO_ID_9P},
> +     {VIRTIO_ID_INVALID} /* List Terminator */
> +};
> +
> +static struct virtio_driver v9p_drv = {
> +     .dev_ids = v9p_dev_id,
> +     .init    = virtio_9p_drv_init,
> +     .add_dev = virtio_9p_add_dev
> +};
> +VIRTIO_BUS_REGISTER_DRIVER(&v9p_drv);
> diff --git a/plat/kvm/Config.uk b/plat/kvm/Config.uk
> index 28fb7b8b..c4ad65ec 100644
> --- a/plat/kvm/Config.uk
> +++ b/plat/kvm/Config.uk
> @@ -79,6 +79,15 @@ config VIRTIO_NET
>         select LIBUKSGLIST
>         help
>                Virtual network driver.
> +
> +config VIRTIO_9P
> +       bool "Virtio 9P device"
> +       default n
> +       depends on LIBUK9P
> +       select VIRTIO_BUS
> +       select LIBUKSGLIST
> +       help
> +              Virtio 9P driver.
>  endmenu
>  
>  config LIBGICV2
> diff --git a/plat/kvm/Makefile.uk b/plat/kvm/Makefile.uk
> index f6cc2d19..68bcfd95 100644
> --- a/plat/kvm/Makefile.uk
> +++ b/plat/kvm/Makefile.uk
> @@ -10,6 +10,7 @@ $(eval $(call addplatlib,kvm,libkvmplat))
>  $(eval $(call addplatlib_s,kvm,libkvmpci,$(CONFIG_KVM_PCI)))
>  $(eval $(call addplatlib_s,kvm,libkvmvirtio,$(CONFIG_VIRTIO_BUS)))
>  $(eval $(call addplatlib_s,kvm,libkvmvirtionet,$(CONFIG_VIRTIO_NET)))
> +$(eval $(call addplatlib_s,kvm,libkvmvirtio9p,$(CONFIG_VIRTIO_9P)))
>  $(eval $(call addplatlib_s,kvm,libkvmofw,$(CONFIG_LIBOFW)))
>  $(eval $(call addplatlib_s,kvm,libkvmgicv2,$(CONFIG_LIBGICV2)))
>  
> @@ -129,6 +130,18 @@ LIBKVMVIRTIONET_CINCLUDES-y    += 
> -I$(UK_PLAT_DRIVERS_BASE)/include
>  LIBKVMVIRTIONET_SRCS-y +=\
>                       $(UK_PLAT_DRIVERS_BASE)/virtio/virtio_net.c
>  
> +##
> +## Virtio 9P library definition
> +##
> +LIBKVMVIRTIO9P_ASINCLUDES-y   += -I$(LIBKVMPLAT_BASE)/include
> +LIBKVMVIRTIO9P_CINCLUDES-y    += -I$(LIBKVMPLAT_BASE)/include
> +LIBKVMVIRTIO9P_ASINCLUDES-y   += -I$(UK_PLAT_COMMON_BASE)/include
> +LIBKVMVIRTIO9P_CINCLUDES-y    += -I$(UK_PLAT_COMMON_BASE)/include
> +LIBKVMVIRTIO9P_ASINCLUDES-y   += -I$(UK_PLAT_DRIVERS_BASE)/include
> +LIBKVMVIRTIO9P_CINCLUDES-y    += -I$(UK_PLAT_DRIVERS_BASE)/include
> +LIBKVMVIRTIO9P_SRCS-y +=\
> +                     $(UK_PLAT_DRIVERS_BASE)/virtio/virtio_9p.c
> +
>  ##
>  ## OFW library definitions
>  ##
> 

_______________________________________________
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®.