drivers/crypto/intel/qat/qat_common/adf_pfvf_pf_msg.c
Source file repositories/reference/linux-study-clean/drivers/crypto/intel/qat/qat_common/adf_pfvf_pf_msg.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/crypto/intel/qat/qat_common/adf_pfvf_pf_msg.c- Extension
.c- Size
- 3666 bytes
- Lines
- 118
- Domain
- Driver Families
- Bucket
- drivers/crypto
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/delay.hlinux/pci.hadf_accel_devices.hadf_pfvf_msg.hadf_pfvf_pf_msg.hadf_pfvf_pf_proto.h
Detected Declarations
function adf_pf2vf_notify_restartingfunction adf_pf2vf_wait_for_restarting_completefunction adf_pf2vf_notify_restartedfunction adf_pf2vf_notify_fatal_errorfunction adf_pf_capabilities_msg_providerfunction adf_pf_ring_to_svc_msg_provider
Annotated Snippet
// SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0-only)
/* Copyright(c) 2015 - 2021 Intel Corporation */
#include <linux/delay.h>
#include <linux/pci.h>
#include "adf_accel_devices.h"
#include "adf_pfvf_msg.h"
#include "adf_pfvf_pf_msg.h"
#include "adf_pfvf_pf_proto.h"
#define ADF_PF_WAIT_RESTARTING_COMPLETE_DELAY 100
#define ADF_VF_SHUTDOWN_RETRY 100
void adf_pf2vf_notify_restarting(struct adf_accel_dev *accel_dev)
{
struct adf_accel_vf_info *vf;
struct pfvf_message msg = { .type = ADF_PF2VF_MSGTYPE_RESTARTING };
int i, num_vfs = pci_num_vf(accel_to_pci_dev(accel_dev));
dev_dbg(&GET_DEV(accel_dev), "pf2vf notify restarting\n");
for (i = 0, vf = accel_dev->pf.vf_info; i < num_vfs; i++, vf++) {
if (vf->init && vf->vf_compat_ver >= ADF_PFVF_COMPAT_FALLBACK)
vf->restarting = true;
else
vf->restarting = false;
if (!vf->init)
continue;
if (adf_send_pf2vf_msg(accel_dev, i, msg))
dev_err(&GET_DEV(accel_dev),
"Failed to send restarting msg to VF%d\n", i);
}
}
void adf_pf2vf_wait_for_restarting_complete(struct adf_accel_dev *accel_dev)
{
int num_vfs = pci_num_vf(accel_to_pci_dev(accel_dev));
int i, retries = ADF_VF_SHUTDOWN_RETRY;
struct adf_accel_vf_info *vf;
bool vf_running;
dev_dbg(&GET_DEV(accel_dev), "pf2vf wait for restarting complete\n");
do {
vf_running = false;
for (i = 0, vf = accel_dev->pf.vf_info; i < num_vfs; i++, vf++)
if (vf->restarting)
vf_running = true;
if (!vf_running)
break;
msleep(ADF_PF_WAIT_RESTARTING_COMPLETE_DELAY);
} while (--retries);
if (vf_running)
dev_warn(&GET_DEV(accel_dev), "Some VFs are still running\n");
}
void adf_pf2vf_notify_restarted(struct adf_accel_dev *accel_dev)
{
struct pfvf_message msg = { .type = ADF_PF2VF_MSGTYPE_RESTARTED };
int i, num_vfs = pci_num_vf(accel_to_pci_dev(accel_dev));
struct adf_accel_vf_info *vf;
dev_dbg(&GET_DEV(accel_dev), "pf2vf notify restarted\n");
for (i = 0, vf = accel_dev->pf.vf_info; i < num_vfs; i++, vf++) {
if (vf->init && vf->vf_compat_ver >= ADF_PFVF_COMPAT_FALLBACK &&
adf_send_pf2vf_msg(accel_dev, i, msg))
dev_err(&GET_DEV(accel_dev),
"Failed to send restarted msg to VF%d\n", i);
}
}
void adf_pf2vf_notify_fatal_error(struct adf_accel_dev *accel_dev)
{
struct pfvf_message msg = { .type = ADF_PF2VF_MSGTYPE_FATAL_ERROR };
int i, num_vfs = pci_num_vf(accel_to_pci_dev(accel_dev));
struct adf_accel_vf_info *vf;
dev_dbg(&GET_DEV(accel_dev), "pf2vf notify fatal error\n");
for (i = 0, vf = accel_dev->pf.vf_info; i < num_vfs; i++, vf++) {
if (vf->init && vf->vf_compat_ver >= ADF_PFVF_COMPAT_FALLBACK &&
adf_send_pf2vf_msg(accel_dev, i, msg))
dev_err(&GET_DEV(accel_dev),
"Failed to send fatal error msg to VF%d\n", i);
}
}
int adf_pf_capabilities_msg_provider(struct adf_accel_dev *accel_dev,
u8 *buffer, u8 compat)
{
struct adf_hw_device_data *hw_data = accel_dev->hw_device;
Annotation
- Immediate include surface: `linux/delay.h`, `linux/pci.h`, `adf_accel_devices.h`, `adf_pfvf_msg.h`, `adf_pfvf_pf_msg.h`, `adf_pfvf_pf_proto.h`.
- Detected declarations: `function adf_pf2vf_notify_restarting`, `function adf_pf2vf_wait_for_restarting_complete`, `function adf_pf2vf_notify_restarted`, `function adf_pf2vf_notify_fatal_error`, `function adf_pf_capabilities_msg_provider`, `function adf_pf_ring_to_svc_msg_provider`.
- Atlas domain: Driver Families / drivers/crypto.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.