/* * virtio_pci_admin_legacy_io_write_common - Write legacy common configuration * of a member device * @dev: VF pci_dev * @offset: starting byte offset within the common configuration area to write to * @size: size of the data to write * @buf: buffer which holds the data * * Note: caller must serialize access for the given device. * Returns 0 on success, or negative on failure.
*/ int virtio_pci_admin_legacy_common_io_write(struct pci_dev *pdev, u8 offset,
u8 size, u8 *buf)
{ return virtio_pci_admin_legacy_io_write(pdev,
VIRTIO_ADMIN_CMD_LEGACY_COMMON_CFG_WRITE,
offset, size, buf);
}
EXPORT_SYMBOL_GPL(virtio_pci_admin_legacy_common_io_write);
/* * virtio_pci_admin_legacy_io_write_device - Write legacy device configuration * of a member device * @dev: VF pci_dev * @offset: starting byte offset within the device configuration area to write to * @size: size of the data to write * @buf: buffer which holds the data * * Note: caller must serialize access for the given device. * Returns 0 on success, or negative on failure.
*/ int virtio_pci_admin_legacy_device_io_write(struct pci_dev *pdev, u8 offset,
u8 size, u8 *buf)
{ return virtio_pci_admin_legacy_io_write(pdev,
VIRTIO_ADMIN_CMD_LEGACY_DEV_CFG_WRITE,
offset, size, buf);
}
EXPORT_SYMBOL_GPL(virtio_pci_admin_legacy_device_io_write);
/* * virtio_pci_admin_legacy_device_io_read - Read legacy device configuration of * a member device * @dev: VF pci_dev * @offset: starting byte offset within the device configuration area to read from * @size: size of the data to be read * @buf: buffer to hold the returned data * * Note: caller must serialize access for the given device. * Returns 0 on success, or negative on failure.
*/ int virtio_pci_admin_legacy_device_io_read(struct pci_dev *pdev, u8 offset,
u8 size, u8 *buf)
{ return virtio_pci_admin_legacy_io_read(pdev,
VIRTIO_ADMIN_CMD_LEGACY_DEV_CFG_READ,
offset, size, buf);
}
EXPORT_SYMBOL_GPL(virtio_pci_admin_legacy_device_io_read);
/* * virtio_pci_admin_legacy_common_io_read - Read legacy common configuration of * a member device * @dev: VF pci_dev * @offset: starting byte offset within the common configuration area to read from * @size: size of the data to be read * @buf: buffer to hold the returned data * * Note: caller must serialize access for the given device. * Returns 0 on success, or negative on failure.
*/ int virtio_pci_admin_legacy_common_io_read(struct pci_dev *pdev, u8 offset,
u8 size, u8 *buf)
{ return virtio_pci_admin_legacy_io_read(pdev,
VIRTIO_ADMIN_CMD_LEGACY_COMMON_CFG_READ,
offset, size, buf);
}
EXPORT_SYMBOL_GPL(virtio_pci_admin_legacy_common_io_read);
/* * virtio_pci_admin_legacy_io_notify_info - Read the queue notification * information for legacy interface * @dev: VF pci_dev * @req_bar_flags: requested bar flags * @bar: on output the BAR number of the owner or member device * @bar_offset: on output the offset within bar * * Returns 0 on success, or negative on failure.
*/ int virtio_pci_admin_legacy_io_notify_info(struct pci_dev *pdev,
u8 req_bar_flags, u8 *bar,
u64 *bar_offset)
{ struct virtio_device *virtio_dev = virtio_pci_vf_get_pf_dev(pdev); struct virtio_admin_cmd_notify_info_result *result; struct virtio_admin_cmd cmd = {}; struct scatterlist result_sg; int vf_id; int ret;
if (!virtio_dev) return -ENODEV;
vf_id = pci_iov_vf_id(pdev); if (vf_id < 0) return vf_id;
result = kzalloc(sizeof(*result), GFP_KERNEL); if (!result) return -ENOMEM;
sg_init_one(&result_sg, result, sizeof(*result));
cmd.opcode = cpu_to_le16(VIRTIO_ADMIN_CMD_LEGACY_NOTIFY_INFO);
cmd.group_type = cpu_to_le16(VIRTIO_ADMIN_GROUP_TYPE_SRIOV);
cmd.group_member_id = cpu_to_le64(vf_id + 1);
cmd.result_sg = &result_sg;
ret = vp_modern_admin_cmd_exec(virtio_dev, &cmd); if (!ret) { struct virtio_admin_cmd_notify_info_data *entry; int i;
ret = -ENOENT; for (i = 0; i < VIRTIO_ADMIN_CMD_MAX_NOTIFY_INFO; i++) {
entry = &result->entries[i]; if (entry->flags == VIRTIO_ADMIN_CMD_NOTIFY_INFO_FLAGS_END) break; if (entry->flags != req_bar_flags) continue;
*bar = entry->bar;
*bar_offset = le64_to_cpu(entry->offset);
ret = 0; break;
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.