misc: mic: Remove COSM functionality from the MIC host driver
Since COSM functionality is now moved into a separate COSM driver drivers, this patch removes this functionality from the base MIC host driver. The MIC host driver now implements cosm_hw_ops and registers a COSM device which allows the COSM driver to trigger boot/shutdown/reset of the MIC devices via the cosm_hw_ops. Reviewed-by: Nikhil Rao <nikhil.rao@intel.com> Reviewed-by: Sudeep Dutt <sudeep.dutt@intel.com> Signed-off-by: Dasaratharaman Chandramouli <dasaratharaman.chandramouli@intel.com> Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:

committed by
Greg Kroah-Hartman

parent
7cb46d9bff
commit
1da2b3eeef
@@ -31,71 +31,6 @@
|
||||
/* Debugfs parent dir */
|
||||
static struct dentry *mic_dbg;
|
||||
|
||||
/**
|
||||
* mic_log_buf_show - Display MIC kernel log buffer.
|
||||
*
|
||||
* log_buf addr/len is read from System.map by user space
|
||||
* and populated in sysfs entries.
|
||||
*/
|
||||
static int mic_log_buf_show(struct seq_file *s, void *unused)
|
||||
{
|
||||
void __iomem *log_buf_va;
|
||||
int __iomem *log_buf_len_va;
|
||||
struct mic_device *mdev = s->private;
|
||||
void *kva;
|
||||
int size;
|
||||
unsigned long aper_offset;
|
||||
|
||||
if (!mdev || !mdev->log_buf_addr || !mdev->log_buf_len)
|
||||
goto done;
|
||||
/*
|
||||
* Card kernel will never be relocated and any kernel text/data mapping
|
||||
* can be translated to phys address by subtracting __START_KERNEL_map.
|
||||
*/
|
||||
aper_offset = (unsigned long)mdev->log_buf_len - __START_KERNEL_map;
|
||||
log_buf_len_va = mdev->aper.va + aper_offset;
|
||||
aper_offset = (unsigned long)mdev->log_buf_addr - __START_KERNEL_map;
|
||||
log_buf_va = mdev->aper.va + aper_offset;
|
||||
size = ioread32(log_buf_len_va);
|
||||
|
||||
kva = kmalloc(size, GFP_KERNEL);
|
||||
if (!kva)
|
||||
goto done;
|
||||
mutex_lock(&mdev->mic_mutex);
|
||||
memcpy_fromio(kva, log_buf_va, size);
|
||||
switch (mdev->state) {
|
||||
case MIC_ONLINE:
|
||||
/* Fall through */
|
||||
case MIC_SHUTTING_DOWN:
|
||||
seq_write(s, kva, size);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
mutex_unlock(&mdev->mic_mutex);
|
||||
kfree(kva);
|
||||
done:
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int mic_log_buf_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
return single_open(file, mic_log_buf_show, inode->i_private);
|
||||
}
|
||||
|
||||
static int mic_log_buf_release(struct inode *inode, struct file *file)
|
||||
{
|
||||
return single_release(inode, file);
|
||||
}
|
||||
|
||||
static const struct file_operations log_buf_ops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = mic_log_buf_open,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = mic_log_buf_release
|
||||
};
|
||||
|
||||
static int mic_smpt_show(struct seq_file *s, void *pos)
|
||||
{
|
||||
int i;
|
||||
@@ -138,32 +73,6 @@ static const struct file_operations smpt_file_ops = {
|
||||
.release = mic_smpt_debug_release
|
||||
};
|
||||
|
||||
static int mic_soft_reset_show(struct seq_file *s, void *pos)
|
||||
{
|
||||
struct mic_device *mdev = s->private;
|
||||
|
||||
mic_stop(mdev, true);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int mic_soft_reset_debug_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
return single_open(file, mic_soft_reset_show, inode->i_private);
|
||||
}
|
||||
|
||||
static int mic_soft_reset_debug_release(struct inode *inode, struct file *file)
|
||||
{
|
||||
return single_release(inode, file);
|
||||
}
|
||||
|
||||
static const struct file_operations soft_reset_ops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = mic_soft_reset_debug_open,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = mic_soft_reset_debug_release
|
||||
};
|
||||
|
||||
static int mic_post_code_show(struct seq_file *s, void *pos)
|
||||
{
|
||||
struct mic_device *mdev = s->private;
|
||||
@@ -204,18 +113,8 @@ static int mic_dp_show(struct seq_file *s, void *pos)
|
||||
|
||||
seq_printf(s, "Bootparam: magic 0x%x\n",
|
||||
bootparam->magic);
|
||||
seq_printf(s, "Bootparam: h2c_shutdown_db %d\n",
|
||||
bootparam->h2c_shutdown_db);
|
||||
seq_printf(s, "Bootparam: h2c_config_db %d\n",
|
||||
bootparam->h2c_config_db);
|
||||
seq_printf(s, "Bootparam: c2h_shutdown_db %d\n",
|
||||
bootparam->c2h_shutdown_db);
|
||||
seq_printf(s, "Bootparam: shutdown_status %d\n",
|
||||
bootparam->shutdown_status);
|
||||
seq_printf(s, "Bootparam: shutdown_card %d\n",
|
||||
bootparam->shutdown_card);
|
||||
seq_printf(s, "Bootparam: tot_nodes %d\n",
|
||||
bootparam->tot_nodes);
|
||||
seq_printf(s, "Bootparam: node_id %d\n",
|
||||
bootparam->node_id);
|
||||
seq_printf(s, "Bootparam: c2h_scif_db %d\n",
|
||||
@@ -392,8 +291,7 @@ static int mic_msi_irq_info_show(struct seq_file *s, void *pos)
|
||||
int i, j;
|
||||
u16 entry;
|
||||
u16 vector;
|
||||
struct pci_dev *pdev = container_of(mdev->sdev->parent,
|
||||
struct pci_dev, dev);
|
||||
struct pci_dev *pdev = mdev->pdev;
|
||||
|
||||
if (pci_dev_msi_enabled(pdev)) {
|
||||
for (i = 0; i < mdev->irq_info.num_vectors; i++) {
|
||||
@@ -454,20 +352,18 @@ static const struct file_operations msi_irq_info_ops = {
|
||||
*/
|
||||
void mic_create_debug_dir(struct mic_device *mdev)
|
||||
{
|
||||
char name[16];
|
||||
|
||||
if (!mic_dbg)
|
||||
return;
|
||||
|
||||
mdev->dbg_dir = debugfs_create_dir(dev_name(mdev->sdev), mic_dbg);
|
||||
scnprintf(name, sizeof(name), "mic%d", mdev->id);
|
||||
mdev->dbg_dir = debugfs_create_dir(name, mic_dbg);
|
||||
if (!mdev->dbg_dir)
|
||||
return;
|
||||
|
||||
debugfs_create_file("log_buf", 0444, mdev->dbg_dir, mdev, &log_buf_ops);
|
||||
|
||||
debugfs_create_file("smpt", 0444, mdev->dbg_dir, mdev, &smpt_file_ops);
|
||||
|
||||
debugfs_create_file("soft_reset", 0444, mdev->dbg_dir, mdev,
|
||||
&soft_reset_ops);
|
||||
|
||||
debugfs_create_file("post_code", 0444, mdev->dbg_dir, mdev,
|
||||
&post_code_ops);
|
||||
|
||||
|
Reference in New Issue
Block a user