Squashed backup commit (no shallow-clone history issues) of xiaomi-mt6833-dev/kernel_xiaomi_mt6833 (lineage-23.2 branch, upstream commit 9eece662e) plus all fixes applied to get everpal_defconfig building clean against a modern (GCC 15.2.0) toolchain -- see the previous commit message on the lineage-23.2 branch (also in this repo history is not available here since this is a squashed snapshot; full incremental history lives in the local DL380 checkout and the upstream GitHub remote). Upstream: https://github.com/xiaomi-mt6833-dev/kernel_xiaomi_mt6833 (lineage-23.2)
45 lines
1.1 KiB
C
45 lines
1.1 KiB
C
/*
|
|
* Copyright 2014-2016 IBM Corp.
|
|
*
|
|
* This program is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU General Public License
|
|
* as published by the Free Software Foundation; either version
|
|
* 2 of the License, or (at your option) any later version.
|
|
*/
|
|
|
|
#include <linux/pci.h>
|
|
#include "cxl.h"
|
|
|
|
bool _cxl_pci_associate_default_context(struct pci_dev *dev, struct cxl_afu *afu)
|
|
{
|
|
struct cxl_context *ctx;
|
|
|
|
/*
|
|
* Allocate a context to do cxl things to. This is used for interrupts
|
|
* in the peer model using a real phb, and if we eventually do DMA ops
|
|
* in the virtual phb, we'll need a default context to attach them to.
|
|
*/
|
|
ctx = cxl_dev_context_init(dev);
|
|
if (IS_ERR(ctx))
|
|
return false;
|
|
dev->dev.archdata.cxl_ctx = ctx;
|
|
|
|
return (cxl_ops->afu_check_and_enable(afu) == 0);
|
|
}
|
|
/* exported via cxl_base */
|
|
|
|
void _cxl_pci_disable_device(struct pci_dev *dev)
|
|
{
|
|
struct cxl_context *ctx = cxl_get_context(dev);
|
|
|
|
if (ctx) {
|
|
if (ctx->status == STARTED) {
|
|
dev_err(&dev->dev, "Default context started\n");
|
|
return;
|
|
}
|
|
dev->dev.archdata.cxl_ctx = NULL;
|
|
cxl_release_context(ctx);
|
|
}
|
|
}
|
|
/* exported via cxl_base */
|