cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

adf_pfvf_pf_msg.c (1614B)


      1// SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0-only)
      2/* Copyright(c) 2015 - 2021 Intel Corporation */
      3#include <linux/pci.h>
      4#include "adf_accel_devices.h"
      5#include "adf_pfvf_msg.h"
      6#include "adf_pfvf_pf_msg.h"
      7#include "adf_pfvf_pf_proto.h"
      8
      9void adf_pf2vf_notify_restarting(struct adf_accel_dev *accel_dev)
     10{
     11	struct adf_accel_vf_info *vf;
     12	struct pfvf_message msg = { .type = ADF_PF2VF_MSGTYPE_RESTARTING };
     13	int i, num_vfs = pci_num_vf(accel_to_pci_dev(accel_dev));
     14
     15	for (i = 0, vf = accel_dev->pf.vf_info; i < num_vfs; i++, vf++) {
     16		if (vf->init && adf_send_pf2vf_msg(accel_dev, i, msg))
     17			dev_err(&GET_DEV(accel_dev),
     18				"Failed to send restarting msg to VF%d\n", i);
     19	}
     20}
     21
     22int adf_pf_capabilities_msg_provider(struct adf_accel_dev *accel_dev,
     23				     u8 *buffer, u8 compat)
     24{
     25	struct adf_hw_device_data *hw_data = accel_dev->hw_device;
     26	struct capabilities_v2 caps_msg;
     27
     28	caps_msg.ext_dc_caps = hw_data->extended_dc_capabilities;
     29	caps_msg.capabilities = hw_data->accel_capabilities_mask;
     30
     31	caps_msg.hdr.version = ADF_PFVF_CAPABILITIES_V2_VERSION;
     32	caps_msg.hdr.payload_size =
     33			ADF_PFVF_BLKMSG_PAYLOAD_SIZE(struct capabilities_v2);
     34
     35	memcpy(buffer, &caps_msg, sizeof(caps_msg));
     36
     37	return 0;
     38}
     39
     40int adf_pf_ring_to_svc_msg_provider(struct adf_accel_dev *accel_dev,
     41				    u8 *buffer, u8 compat)
     42{
     43	struct ring_to_svc_map_v1 rts_map_msg;
     44
     45	rts_map_msg.map = accel_dev->hw_device->ring_to_svc_map;
     46	rts_map_msg.hdr.version = ADF_PFVF_RING_TO_SVC_VERSION;
     47	rts_map_msg.hdr.payload_size = ADF_PFVF_BLKMSG_PAYLOAD_SIZE(rts_map_msg);
     48
     49	memcpy(buffer, &rts_map_msg, sizeof(rts_map_msg));
     50
     51	return 0;
     52}