Commit 2141c7c5 authored by Ashutosh Dixit's avatar Ashutosh Dixit Committed by Greg Kroah-Hartman

Intel MIC Card Driver Changes for Virtio Devices.

This patch introduces the card "Virtio over PCIe" interface for
Intel MIC. It allows virtio drivers on the card to communicate with their
user space backends on the host via a device page. Ring 3 apps on the host
can add, remove and configure virtio devices. A thin MIC specific
virtio_config_ops is implemented which is borrowed heavily from previous
similar implementations in lguest and s390 @
drivers/lguest/lguest_device.c
drivers/s390/kvm/kvm_virtio.c

Co-author: Sudeep Dutt <sudeep.dutt@intel.com>
Signed-off-by: default avatarAshutosh Dixit <ashutosh.dixit@intel.com>
Signed-off-by: default avatarCaz Yokoyama <Caz.Yokoyama@intel.com>
Signed-off-by: default avatarDasaratharaman Chandramouli <dasaratharaman.chandramouli@intel.com>
Signed-off-by: default avatarNikhil Rao <nikhil.rao@intel.com>
Signed-off-by: default avatarHarshavardhan R Kharche <harshavardhan.r.kharche@intel.com>
Signed-off-by: default avatarSudeep Dutt <sudeep.dutt@intel.com>
Acked-by: default avatarYaozu (Eddie) Dong <eddie.dong@intel.com>
Reviewed-by: default avatarPeter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent f69bcbf3
......@@ -24,6 +24,7 @@ comment "Intel MIC Card Driver"
config INTEL_MIC_CARD
tristate "Intel MIC Card Driver"
depends on 64BIT
select VIRTIO
default N
help
This enables card driver support for the Intel Many Integrated
......
......@@ -8,3 +8,4 @@ obj-$(CONFIG_INTEL_MIC_CARD) += mic_card.o
mic_card-y += mic_x100.o
mic_card-y += mic_device.o
mic_card-y += mic_debugfs.o
mic_card-y += mic_virtio.o
......@@ -32,6 +32,7 @@
#include <linux/mic_common.h>
#include "../common/mic_device.h"
#include "mic_device.h"
#include "mic_virtio.h"
static struct mic_driver *g_drv;
static struct mic_irq *shutdown_cookie;
......@@ -265,10 +266,15 @@ int __init mic_driver_init(struct mic_driver *mdrv)
rc = mic_shutdown_init();
if (rc)
goto irq_uninit;
rc = mic_devices_init(mdrv);
if (rc)
goto shutdown_uninit;
mic_create_card_debug_dir(mdrv);
atomic_notifier_chain_register(&panic_notifier_list, &mic_panic);
done:
return rc;
shutdown_uninit:
mic_shutdown_uninit();
irq_uninit:
mic_uninit_irq();
dp_uninit:
......@@ -286,6 +292,7 @@ int __init mic_driver_init(struct mic_driver *mdrv)
void mic_driver_uninit(struct mic_driver *mdrv)
{
mic_delete_card_debug_dir(mdrv);
mic_devices_uninit(mdrv);
/*
* Inform the host about the shutdown status i.e. poweroff/restart etc.
* The module cannot be unloaded so the only code path to call
......
This diff is collapsed.
/*
* Intel MIC Platform Software Stack (MPSS)
*
* Copyright(c) 2013 Intel Corporation.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License, version 2, as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* The full GNU General Public License is included in this distribution in
* the file called "COPYING".
*
* Disclaimer: The codes contained in these modules may be specific to
* the Intel Software Development Platform codenamed: Knights Ferry, and
* the Intel product codenamed: Knights Corner, and are not backward
* compatible with other Intel products. Additionally, Intel will NOT
* support the codes or instruction set in future products.
*
* Intel MIC Card driver.
*
*/
#ifndef __MIC_CARD_VIRTIO_H
#define __MIC_CARD_VIRTIO_H
#include <linux/mic_common.h>
#include "mic_device.h"
/*
* 64 bit I/O access
*/
#ifndef ioread64
#define ioread64 readq
#endif
#ifndef iowrite64
#define iowrite64 writeq
#endif
static inline unsigned mic_desc_size(struct mic_device_desc __iomem *desc)
{
return mic_aligned_size(*desc)
+ ioread8(&desc->num_vq) * mic_aligned_size(struct mic_vqconfig)
+ ioread8(&desc->feature_len) * 2
+ ioread8(&desc->config_len);
}
static inline struct mic_vqconfig __iomem *
mic_vq_config(struct mic_device_desc __iomem *desc)
{
return (struct mic_vqconfig __iomem *)(desc + 1);
}
static inline __u8 __iomem *
mic_vq_features(struct mic_device_desc __iomem *desc)
{
return (__u8 __iomem *)(mic_vq_config(desc) + ioread8(&desc->num_vq));
}
static inline __u8 __iomem *
mic_vq_configspace(struct mic_device_desc __iomem *desc)
{
return mic_vq_features(desc) + ioread8(&desc->feature_len) * 2;
}
static inline unsigned mic_total_desc_size(struct mic_device_desc __iomem *desc)
{
return mic_aligned_desc_size(desc) +
mic_aligned_size(struct mic_device_ctrl);
}
int mic_devices_init(struct mic_driver *mdrv);
void mic_devices_uninit(struct mic_driver *mdrv);
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment