History

PCI: hv: Add a paravirtual backchannel in software

Windows SR-IOV provides a backchannel mechanism in software for communication between a VF driver and a PF driver. These "configuration blocks" are similar in concept to PCI configuration space, but instead of doing reads and writes in 32-bit chunks through a very slow path, packets of up to 128 bytes can be sent or received asynchronously. Nearly every SR-IOV device contains just such a communications channel in hardware, so using this one in software is usually optional. Using the software channel, however, allows driver implementers to leverage software tools that fuzz the communications channel looking for vulnerabilities. The usage model for these packets puts the responsibility for reading or writing on the VF driver. The VF driver sends a read or a write packet, indicating which "block" is being referred to by number. If the PF driver wishes to initiate communication, it can "invalidate" one or more of the first 64 blocks. This invalidation is delivered via a callback supplied by the VF driver by this driver. No protocol is implied, except that supplied by the PF and VF drivers.

Dexuan Cui committed 7 years ago

Commit e5d2f911 parent fed07ef2 files · +317 −0Browse files

Showing the changes to include/linux (1 of 2 files). Show all

Unified · Split

include/linux/hyperv.h+15−0
@@ -1578,4 +1578,19 @@ hv_pkt_iter_next(struct vmbus_channel *channel, · 1577 unmodified lines
15781578 for (pkt = hv_pkt_iter_first(channel); pkt; \
15791579 pkt = hv_pkt_iter_next(channel, pkt))
15801580
1581+/*
1582+ * Functions for passing data between SR-IOV PF and VF drivers. The VF driver
1583+ * sends requests to read and write blocks. Each block must be 128 bytes or
1584+ * smaller. Optionally, the VF driver can register a callback function which
1585+ * will be invoked when the host says that one or more of the first 64 block
1586+ * IDs is "invalid" which means that the VF driver should reread them.
1587+ */
1588+#define HV_CONFIG_BLOCK_SIZE_MAX 128
1589+int hv_read_config_block(struct pci_dev *dev, void *buf, unsigned int buf_len,
1590+ unsigned int block_id, unsigned int *bytes_returned);
1591+int hv_write_config_block(struct pci_dev *dev, void *buf, unsigned int len,
1592+ unsigned int block_id);
1593+int hv_register_block_invalidate(struct pci_dev *dev, void *context,
1594+ void (*block_invalidate)(void *context,
1595+ u64 block_mask));
15811596 #endif /* _HYPERV_H */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t