mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-07 21:53:44 +00:00
crypto: qat - implement interface for live migration
Add logic to implement the interface for live migration defined in qat/qat_mig_dev.h. This is specific for QAT GEN4 Virtual Functions (VFs). This introduces a migration data manager which is used to handle the device state during migration. The manager ensures that the device state is stored in a format that can be restored in the destination node. The VF state is organized into a hierarchical structure that includes a preamble, a general state section, a MISC bar section and an ETR bar section. The latter contains the state of the 4 ring pairs contained on a VF. Here is a graphical representation of the state: preamble | general state section | leaf state | MISC bar state section| leaf state | ETR bar state section | bank0 state section | leaf state | bank1 state section | leaf state | bank2 state section | leaf state | bank3 state section | leaf state In addition to the implementation of the qat_migdev_ops interface and the state manager framework, add a mutex in pfvf to avoid pf2vf messages during migration. Signed-off-by: Xin Zeng <xin.zeng@intel.com> Reviewed-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
0fce55e533
commit
f0bbfc391a
@ -17,6 +17,7 @@
|
||||
#include <adf_gen4_ras.h>
|
||||
#include <adf_gen4_timer.h>
|
||||
#include <adf_gen4_tl.h>
|
||||
#include <adf_gen4_vf_mig.h>
|
||||
#include "adf_420xx_hw_data.h"
|
||||
#include "icp_qat_hw.h"
|
||||
|
||||
@ -488,6 +489,7 @@ void adf_init_hw_data_420xx(struct adf_hw_device_data *hw_data, u32 dev_id)
|
||||
adf_gen4_init_dc_ops(&hw_data->dc_ops);
|
||||
adf_gen4_init_ras_ops(&hw_data->ras_ops);
|
||||
adf_gen4_init_tl_data(&hw_data->tl_data);
|
||||
adf_gen4_init_vf_mig_ops(&hw_data->vfmig_ops);
|
||||
adf_init_rl_data(&hw_data->rl_data);
|
||||
}
|
||||
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "adf_gen4_ras.h"
|
||||
#include <adf_gen4_timer.h>
|
||||
#include <adf_gen4_tl.h>
|
||||
#include <adf_gen4_vf_mig.h>
|
||||
#include "adf_4xxx_hw_data.h"
|
||||
#include "icp_qat_hw.h"
|
||||
|
||||
@ -472,6 +473,7 @@ void adf_init_hw_data_4xxx(struct adf_hw_device_data *hw_data, u32 dev_id)
|
||||
adf_gen4_init_dc_ops(&hw_data->dc_ops);
|
||||
adf_gen4_init_ras_ops(&hw_data->ras_ops);
|
||||
adf_gen4_init_tl_data(&hw_data->tl_data);
|
||||
adf_gen4_init_vf_mig_ops(&hw_data->vfmig_ops);
|
||||
adf_init_rl_data(&hw_data->rl_data);
|
||||
}
|
||||
|
||||
|
@ -20,12 +20,14 @@ intel_qat-objs := adf_cfg.o \
|
||||
adf_gen4_config.o \
|
||||
adf_gen4_hw_csr_data.o \
|
||||
adf_gen4_hw_data.o \
|
||||
adf_gen4_vf_mig.o \
|
||||
adf_gen4_pm.o \
|
||||
adf_gen2_dc.o \
|
||||
adf_gen4_dc.o \
|
||||
adf_gen4_ras.o \
|
||||
adf_gen4_timer.o \
|
||||
adf_clock.o \
|
||||
adf_mstate_mgr.o \
|
||||
qat_crypto.o \
|
||||
qat_compression.o \
|
||||
qat_comp_algs.o \
|
||||
|
@ -412,11 +412,17 @@ struct adf_fw_loader_data {
|
||||
struct adf_accel_vf_info {
|
||||
struct adf_accel_dev *accel_dev;
|
||||
struct mutex pf2vf_lock; /* protect CSR access for PF2VF messages */
|
||||
struct mutex pfvf_mig_lock; /* protects PFVF state for migration */
|
||||
struct ratelimit_state vf2pf_ratelimit;
|
||||
u32 vf_nr;
|
||||
bool init;
|
||||
bool restarting;
|
||||
u8 vf_compat_ver;
|
||||
/*
|
||||
* Private area used for device migration.
|
||||
* Memory allocation and free is managed by migration driver.
|
||||
*/
|
||||
void *mig_priv;
|
||||
};
|
||||
|
||||
struct adf_dc_data {
|
||||
|
@ -86,6 +86,7 @@
|
||||
#define ADF_RP_INT_SRC_SEL_F_RISE_MASK BIT(2)
|
||||
#define ADF_RP_INT_SRC_SEL_F_FALL_MASK GENMASK(2, 0)
|
||||
#define ADF_RP_INT_SRC_SEL_RANGE_WIDTH 4
|
||||
#define ADF_COALESCED_POLL_TIMEOUT_US (1 * USEC_PER_SEC)
|
||||
#define ADF_COALESCED_POLL_DELAY_US 1000
|
||||
#define ADF_WQM_CSR_RPINTSOU(bank) (0x200000 + ((bank) << 12))
|
||||
#define ADF_WQM_CSR_RP_IDX_RX 1
|
||||
@ -120,6 +121,15 @@
|
||||
/* PF2VM communication channel */
|
||||
#define ADF_GEN4_PF2VM_OFFSET(i) (0x40B010 + (i) * 0x20)
|
||||
#define ADF_GEN4_VM2PF_OFFSET(i) (0x40B014 + (i) * 0x20)
|
||||
#define ADF_GEN4_VINTMSKPF2VM_OFFSET(i) (0x40B00C + (i) * 0x20)
|
||||
#define ADF_GEN4_VINTSOUPF2VM_OFFSET(i) (0x40B008 + (i) * 0x20)
|
||||
#define ADF_GEN4_VINTMSK_OFFSET(i) (0x40B004 + (i) * 0x20)
|
||||
#define ADF_GEN4_VINTSOU_OFFSET(i) (0x40B000 + (i) * 0x20)
|
||||
|
||||
struct adf_gen4_vfmig {
|
||||
struct adf_mstate_mgr *mstate_mgr;
|
||||
bool bank_stopped[ADF_GEN4_NUM_BANKS_PER_VF];
|
||||
};
|
||||
|
||||
void adf_gen4_set_ssm_wdtimer(struct adf_accel_dev *accel_dev);
|
||||
|
||||
|
1010
drivers/crypto/intel/qat/qat_common/adf_gen4_vf_mig.c
Normal file
1010
drivers/crypto/intel/qat/qat_common/adf_gen4_vf_mig.c
Normal file
File diff suppressed because it is too large
Load Diff
318
drivers/crypto/intel/qat/qat_common/adf_mstate_mgr.c
Normal file
318
drivers/crypto/intel/qat/qat_common/adf_mstate_mgr.c
Normal file
@ -0,0 +1,318 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/* Copyright(c) 2024 Intel Corporation */
|
||||
|
||||
#include <linux/slab.h>
|
||||
#include <linux/types.h>
|
||||
#include "adf_mstate_mgr.h"
|
||||
|
||||
#define ADF_MSTATE_MAGIC 0xADF5CAEA
|
||||
#define ADF_MSTATE_VERSION 0x1
|
||||
|
||||
struct adf_mstate_sect_h {
|
||||
u8 id[ADF_MSTATE_ID_LEN];
|
||||
u32 size;
|
||||
u32 sub_sects;
|
||||
u8 state[];
|
||||
};
|
||||
|
||||
u32 adf_mstate_state_size(struct adf_mstate_mgr *mgr)
|
||||
{
|
||||
return mgr->state - mgr->buf;
|
||||
}
|
||||
|
||||
static inline u32 adf_mstate_avail_room(struct adf_mstate_mgr *mgr)
|
||||
{
|
||||
return mgr->buf + mgr->size - mgr->state;
|
||||
}
|
||||
|
||||
void adf_mstate_mgr_init(struct adf_mstate_mgr *mgr, u8 *buf, u32 size)
|
||||
{
|
||||
mgr->buf = buf;
|
||||
mgr->state = buf;
|
||||
mgr->size = size;
|
||||
mgr->n_sects = 0;
|
||||
};
|
||||
|
||||
struct adf_mstate_mgr *adf_mstate_mgr_new(u8 *buf, u32 size)
|
||||
{
|
||||
struct adf_mstate_mgr *mgr;
|
||||
|
||||
mgr = kzalloc(sizeof(*mgr), GFP_KERNEL);
|
||||
if (!mgr)
|
||||
return NULL;
|
||||
|
||||
adf_mstate_mgr_init(mgr, buf, size);
|
||||
|
||||
return mgr;
|
||||
}
|
||||
|
||||
void adf_mstate_mgr_destroy(struct adf_mstate_mgr *mgr)
|
||||
{
|
||||
kfree(mgr);
|
||||
}
|
||||
|
||||
void adf_mstate_mgr_init_from_parent(struct adf_mstate_mgr *mgr,
|
||||
struct adf_mstate_mgr *p_mgr)
|
||||
{
|
||||
adf_mstate_mgr_init(mgr, p_mgr->state,
|
||||
p_mgr->size - adf_mstate_state_size(p_mgr));
|
||||
}
|
||||
|
||||
void adf_mstate_mgr_init_from_psect(struct adf_mstate_mgr *mgr,
|
||||
struct adf_mstate_sect_h *p_sect)
|
||||
{
|
||||
adf_mstate_mgr_init(mgr, p_sect->state, p_sect->size);
|
||||
mgr->n_sects = p_sect->sub_sects;
|
||||
}
|
||||
|
||||
static void adf_mstate_preamble_init(struct adf_mstate_preh *preamble)
|
||||
{
|
||||
preamble->magic = ADF_MSTATE_MAGIC;
|
||||
preamble->version = ADF_MSTATE_VERSION;
|
||||
preamble->preh_len = sizeof(*preamble);
|
||||
preamble->size = 0;
|
||||
preamble->n_sects = 0;
|
||||
}
|
||||
|
||||
/* default preambles checker */
|
||||
static int adf_mstate_preamble_def_checker(struct adf_mstate_preh *preamble,
|
||||
void *opaque)
|
||||
{
|
||||
struct adf_mstate_mgr *mgr = opaque;
|
||||
|
||||
if (preamble->magic != ADF_MSTATE_MAGIC ||
|
||||
preamble->version > ADF_MSTATE_VERSION ||
|
||||
preamble->preh_len > mgr->size) {
|
||||
pr_debug("QAT: LM - Invalid state (magic=%#x, version=%#x, hlen=%u), state_size=%u\n",
|
||||
preamble->magic, preamble->version, preamble->preh_len,
|
||||
mgr->size);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct adf_mstate_preh *adf_mstate_preamble_add(struct adf_mstate_mgr *mgr)
|
||||
{
|
||||
struct adf_mstate_preh *pre = (struct adf_mstate_preh *)mgr->buf;
|
||||
|
||||
if (adf_mstate_avail_room(mgr) < sizeof(*pre)) {
|
||||
pr_err("QAT: LM - Not enough space for preamble\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
adf_mstate_preamble_init(pre);
|
||||
mgr->state += pre->preh_len;
|
||||
|
||||
return pre;
|
||||
}
|
||||
|
||||
int adf_mstate_preamble_update(struct adf_mstate_mgr *mgr)
|
||||
{
|
||||
struct adf_mstate_preh *preamble = (struct adf_mstate_preh *)mgr->buf;
|
||||
|
||||
preamble->size = adf_mstate_state_size(mgr) - preamble->preh_len;
|
||||
preamble->n_sects = mgr->n_sects;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void adf_mstate_dump_sect(struct adf_mstate_sect_h *sect,
|
||||
const char *prefix)
|
||||
{
|
||||
pr_debug("QAT: LM - %s QAT state section %s\n", prefix, sect->id);
|
||||
print_hex_dump_debug("h-", DUMP_PREFIX_OFFSET, 16, 2, sect,
|
||||
sizeof(*sect), true);
|
||||
print_hex_dump_debug("s-", DUMP_PREFIX_OFFSET, 16, 2, sect->state,
|
||||
sect->size, true);
|
||||
}
|
||||
|
||||
static inline void __adf_mstate_sect_update(struct adf_mstate_mgr *mgr,
|
||||
struct adf_mstate_sect_h *sect,
|
||||
u32 size,
|
||||
u32 n_subsects)
|
||||
{
|
||||
sect->size += size;
|
||||
sect->sub_sects += n_subsects;
|
||||
mgr->n_sects++;
|
||||
mgr->state += sect->size;
|
||||
|
||||
adf_mstate_dump_sect(sect, "Add");
|
||||
}
|
||||
|
||||
void adf_mstate_sect_update(struct adf_mstate_mgr *p_mgr,
|
||||
struct adf_mstate_mgr *curr_mgr,
|
||||
struct adf_mstate_sect_h *sect)
|
||||
{
|
||||
__adf_mstate_sect_update(p_mgr, sect, adf_mstate_state_size(curr_mgr),
|
||||
curr_mgr->n_sects);
|
||||
}
|
||||
|
||||
static struct adf_mstate_sect_h *adf_mstate_sect_add_header(struct adf_mstate_mgr *mgr,
|
||||
const char *id)
|
||||
{
|
||||
struct adf_mstate_sect_h *sect = (struct adf_mstate_sect_h *)(mgr->state);
|
||||
|
||||
if (adf_mstate_avail_room(mgr) < sizeof(*sect)) {
|
||||
pr_debug("QAT: LM - Not enough space for header of QAT state sect %s\n", id);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
strscpy(sect->id, id, sizeof(sect->id));
|
||||
sect->size = 0;
|
||||
sect->sub_sects = 0;
|
||||
mgr->state += sizeof(*sect);
|
||||
|
||||
return sect;
|
||||
}
|
||||
|
||||
struct adf_mstate_sect_h *adf_mstate_sect_add_vreg(struct adf_mstate_mgr *mgr,
|
||||
const char *id,
|
||||
struct adf_mstate_vreginfo *info)
|
||||
{
|
||||
struct adf_mstate_sect_h *sect;
|
||||
|
||||
sect = adf_mstate_sect_add_header(mgr, id);
|
||||
if (!sect)
|
||||
return NULL;
|
||||
|
||||
if (adf_mstate_avail_room(mgr) < info->size) {
|
||||
pr_debug("QAT: LM - Not enough space for QAT state sect %s, requires %u\n",
|
||||
id, info->size);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
memcpy(sect->state, info->addr, info->size);
|
||||
__adf_mstate_sect_update(mgr, sect, info->size, 0);
|
||||
|
||||
return sect;
|
||||
}
|
||||
|
||||
struct adf_mstate_sect_h *adf_mstate_sect_add(struct adf_mstate_mgr *mgr,
|
||||
const char *id,
|
||||
adf_mstate_populate populate,
|
||||
void *opaque)
|
||||
{
|
||||
struct adf_mstate_mgr sub_sects_mgr;
|
||||
struct adf_mstate_sect_h *sect;
|
||||
int avail_room, size;
|
||||
|
||||
sect = adf_mstate_sect_add_header(mgr, id);
|
||||
if (!sect)
|
||||
return NULL;
|
||||
|
||||
if (!populate)
|
||||
return sect;
|
||||
|
||||
avail_room = adf_mstate_avail_room(mgr);
|
||||
adf_mstate_mgr_init_from_parent(&sub_sects_mgr, mgr);
|
||||
|
||||
size = (*populate)(&sub_sects_mgr, sect->state, avail_room, opaque);
|
||||
if (size < 0)
|
||||
return NULL;
|
||||
|
||||
size += adf_mstate_state_size(&sub_sects_mgr);
|
||||
if (avail_room < size) {
|
||||
pr_debug("QAT: LM - Not enough space for QAT state sect %s, requires %u\n",
|
||||
id, size);
|
||||
return NULL;
|
||||
}
|
||||
__adf_mstate_sect_update(mgr, sect, size, sub_sects_mgr.n_sects);
|
||||
|
||||
return sect;
|
||||
}
|
||||
|
||||
static int adf_mstate_sect_validate(struct adf_mstate_mgr *mgr)
|
||||
{
|
||||
struct adf_mstate_sect_h *start = (struct adf_mstate_sect_h *)mgr->state;
|
||||
struct adf_mstate_sect_h *sect = start;
|
||||
u64 end;
|
||||
int i;
|
||||
|
||||
end = (uintptr_t)mgr->buf + mgr->size;
|
||||
for (i = 0; i < mgr->n_sects; i++) {
|
||||
uintptr_t s_start = (uintptr_t)sect->state;
|
||||
uintptr_t s_end = s_start + sect->size;
|
||||
|
||||
if (s_end < s_start || s_end > end) {
|
||||
pr_debug("QAT: LM - Corrupted state section (index=%u, size=%u) in state_mgr (size=%u, secs=%u)\n",
|
||||
i, sect->size, mgr->size, mgr->n_sects);
|
||||
return -EINVAL;
|
||||
}
|
||||
sect = (struct adf_mstate_sect_h *)s_end;
|
||||
}
|
||||
|
||||
pr_debug("QAT: LM - Scanned section (last child=%s, size=%lu) in state_mgr (size=%u, secs=%u)\n",
|
||||
start->id, sizeof(struct adf_mstate_sect_h) * (ulong)(sect - start),
|
||||
mgr->size, mgr->n_sects);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
u32 adf_mstate_state_size_from_remote(struct adf_mstate_mgr *mgr)
|
||||
{
|
||||
struct adf_mstate_preh *preh = (struct adf_mstate_preh *)mgr->buf;
|
||||
|
||||
return preh->preh_len + preh->size;
|
||||
}
|
||||
|
||||
int adf_mstate_mgr_init_from_remote(struct adf_mstate_mgr *mgr, u8 *buf, u32 size,
|
||||
adf_mstate_preamble_checker pre_checker,
|
||||
void *opaque)
|
||||
{
|
||||
struct adf_mstate_preh *pre;
|
||||
int ret;
|
||||
|
||||
adf_mstate_mgr_init(mgr, buf, size);
|
||||
pre = (struct adf_mstate_preh *)(mgr->buf);
|
||||
|
||||
pr_debug("QAT: LM - Dump state preambles\n");
|
||||
print_hex_dump_debug("", DUMP_PREFIX_OFFSET, 16, 2, pre, pre->preh_len, 0);
|
||||
|
||||
if (pre_checker)
|
||||
ret = (*pre_checker)(pre, opaque);
|
||||
else
|
||||
ret = adf_mstate_preamble_def_checker(pre, mgr);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
mgr->state = mgr->buf + pre->preh_len;
|
||||
mgr->n_sects = pre->n_sects;
|
||||
|
||||
return adf_mstate_sect_validate(mgr);
|
||||
}
|
||||
|
||||
struct adf_mstate_sect_h *adf_mstate_sect_lookup(struct adf_mstate_mgr *mgr,
|
||||
const char *id,
|
||||
adf_mstate_action action,
|
||||
void *opaque)
|
||||
{
|
||||
struct adf_mstate_sect_h *sect = (struct adf_mstate_sect_h *)mgr->state;
|
||||
struct adf_mstate_mgr sub_sects_mgr;
|
||||
int i, ret;
|
||||
|
||||
for (i = 0; i < mgr->n_sects; i++) {
|
||||
if (!strncmp(sect->id, id, sizeof(sect->id)))
|
||||
goto found;
|
||||
|
||||
sect = (struct adf_mstate_sect_h *)(sect->state + sect->size);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
||||
found:
|
||||
adf_mstate_dump_sect(sect, "Found");
|
||||
|
||||
adf_mstate_mgr_init_from_psect(&sub_sects_mgr, sect);
|
||||
if (sect->sub_sects && adf_mstate_sect_validate(&sub_sects_mgr))
|
||||
return NULL;
|
||||
|
||||
if (!action)
|
||||
return sect;
|
||||
|
||||
ret = (*action)(&sub_sects_mgr, sect->state, sect->size, opaque);
|
||||
if (ret)
|
||||
return NULL;
|
||||
|
||||
return sect;
|
||||
}
|
89
drivers/crypto/intel/qat/qat_common/adf_mstate_mgr.h
Normal file
89
drivers/crypto/intel/qat/qat_common/adf_mstate_mgr.h
Normal file
@ -0,0 +1,89 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/* Copyright(c) 2024 Intel Corporation */
|
||||
|
||||
#ifndef ADF_MSTATE_MGR_H
|
||||
#define ADF_MSTATE_MGR_H
|
||||
|
||||
#define ADF_MSTATE_ID_LEN 8
|
||||
|
||||
#define ADF_MSTATE_ETRB_IDS "ETRBAR"
|
||||
#define ADF_MSTATE_MISCB_IDS "MISCBAR"
|
||||
#define ADF_MSTATE_EXTB_IDS "EXTBAR"
|
||||
#define ADF_MSTATE_GEN_IDS "GENER"
|
||||
#define ADF_MSTATE_CONFIG_IDS "CONFIG"
|
||||
#define ADF_MSTATE_SECTION_NUM 5
|
||||
|
||||
#define ADF_MSTATE_BANK_IDX_IDS "bnk"
|
||||
|
||||
#define ADF_MSTATE_ETR_REGS_IDS "mregs"
|
||||
#define ADF_MSTATE_VINTSRC_IDS "visrc"
|
||||
#define ADF_MSTATE_VINTMSK_IDS "vimsk"
|
||||
#define ADF_MSTATE_SLA_IDS "sla"
|
||||
#define ADF_MSTATE_IOV_INIT_IDS "iovinit"
|
||||
#define ADF_MSTATE_COMPAT_VER_IDS "compver"
|
||||
#define ADF_MSTATE_GEN_CAP_IDS "gencap"
|
||||
#define ADF_MSTATE_GEN_SVCMAP_IDS "svcmap"
|
||||
#define ADF_MSTATE_GEN_EXTDC_IDS "extdc"
|
||||
#define ADF_MSTATE_VINTSRC_PF2VM_IDS "vispv"
|
||||
#define ADF_MSTATE_VINTMSK_PF2VM_IDS "vimpv"
|
||||
#define ADF_MSTATE_VM2PF_IDS "vm2pf"
|
||||
#define ADF_MSTATE_PF2VM_IDS "pf2vm"
|
||||
|
||||
struct adf_mstate_mgr {
|
||||
u8 *buf;
|
||||
u8 *state;
|
||||
u32 size;
|
||||
u32 n_sects;
|
||||
};
|
||||
|
||||
struct adf_mstate_preh {
|
||||
u32 magic;
|
||||
u32 version;
|
||||
u16 preh_len;
|
||||
u16 n_sects;
|
||||
u32 size;
|
||||
};
|
||||
|
||||
struct adf_mstate_vreginfo {
|
||||
void *addr;
|
||||
u32 size;
|
||||
};
|
||||
|
||||
struct adf_mstate_sect_h;
|
||||
|
||||
typedef int (*adf_mstate_preamble_checker)(struct adf_mstate_preh *preamble, void *opa);
|
||||
typedef int (*adf_mstate_populate)(struct adf_mstate_mgr *sub_mgr, u8 *buf,
|
||||
u32 size, void *opa);
|
||||
typedef int (*adf_mstate_action)(struct adf_mstate_mgr *sub_mgr, u8 *buf, u32 size,
|
||||
void *opa);
|
||||
|
||||
struct adf_mstate_mgr *adf_mstate_mgr_new(u8 *buf, u32 size);
|
||||
void adf_mstate_mgr_destroy(struct adf_mstate_mgr *mgr);
|
||||
void adf_mstate_mgr_init(struct adf_mstate_mgr *mgr, u8 *buf, u32 size);
|
||||
void adf_mstate_mgr_init_from_parent(struct adf_mstate_mgr *mgr,
|
||||
struct adf_mstate_mgr *p_mgr);
|
||||
void adf_mstate_mgr_init_from_psect(struct adf_mstate_mgr *mgr,
|
||||
struct adf_mstate_sect_h *p_sect);
|
||||
int adf_mstate_mgr_init_from_remote(struct adf_mstate_mgr *mgr,
|
||||
u8 *buf, u32 size,
|
||||
adf_mstate_preamble_checker checker,
|
||||
void *opaque);
|
||||
struct adf_mstate_preh *adf_mstate_preamble_add(struct adf_mstate_mgr *mgr);
|
||||
int adf_mstate_preamble_update(struct adf_mstate_mgr *mgr);
|
||||
u32 adf_mstate_state_size(struct adf_mstate_mgr *mgr);
|
||||
u32 adf_mstate_state_size_from_remote(struct adf_mstate_mgr *mgr);
|
||||
void adf_mstate_sect_update(struct adf_mstate_mgr *p_mgr,
|
||||
struct adf_mstate_mgr *curr_mgr,
|
||||
struct adf_mstate_sect_h *sect);
|
||||
struct adf_mstate_sect_h *adf_mstate_sect_add_vreg(struct adf_mstate_mgr *mgr,
|
||||
const char *id,
|
||||
struct adf_mstate_vreginfo *info);
|
||||
struct adf_mstate_sect_h *adf_mstate_sect_add(struct adf_mstate_mgr *mgr,
|
||||
const char *id,
|
||||
adf_mstate_populate populate,
|
||||
void *opaque);
|
||||
struct adf_mstate_sect_h *adf_mstate_sect_lookup(struct adf_mstate_mgr *mgr,
|
||||
const char *id,
|
||||
adf_mstate_action action,
|
||||
void *opaque);
|
||||
#endif
|
@ -26,10 +26,12 @@ static void adf_iov_send_resp(struct work_struct *work)
|
||||
u32 vf_nr = vf_info->vf_nr;
|
||||
bool ret;
|
||||
|
||||
mutex_lock(&vf_info->pfvf_mig_lock);
|
||||
ret = adf_recv_and_handle_vf2pf_msg(accel_dev, vf_nr);
|
||||
if (ret)
|
||||
/* re-enable interrupt on PF from this VF */
|
||||
adf_enable_vf2pf_interrupts(accel_dev, 1 << vf_nr);
|
||||
mutex_unlock(&vf_info->pfvf_mig_lock);
|
||||
|
||||
kfree(pf2vf_resp);
|
||||
}
|
||||
@ -62,6 +64,7 @@ static int adf_enable_sriov(struct adf_accel_dev *accel_dev)
|
||||
vf_info->vf_nr = i;
|
||||
|
||||
mutex_init(&vf_info->pf2vf_lock);
|
||||
mutex_init(&vf_info->pfvf_mig_lock);
|
||||
ratelimit_state_init(&vf_info->vf2pf_ratelimit,
|
||||
ADF_VF2PF_RATELIMIT_INTERVAL,
|
||||
ADF_VF2PF_RATELIMIT_BURST);
|
||||
@ -138,8 +141,10 @@ void adf_disable_sriov(struct adf_accel_dev *accel_dev)
|
||||
if (hw_data->configure_iov_threads)
|
||||
hw_data->configure_iov_threads(accel_dev, false);
|
||||
|
||||
for (i = 0, vf = accel_dev->pf.vf_info; i < totalvfs; i++, vf++)
|
||||
for (i = 0, vf = accel_dev->pf.vf_info; i < totalvfs; i++, vf++) {
|
||||
mutex_destroy(&vf->pf2vf_lock);
|
||||
mutex_destroy(&vf->pfvf_mig_lock);
|
||||
}
|
||||
|
||||
if (!test_bit(ADF_STATUS_RESTARTING, &accel_dev->status)) {
|
||||
kfree(accel_dev->pf.vf_info);
|
||||
|
Loading…
Reference in New Issue
Block a user