virtio: Add definitions for shared memory regions
cover virtio: Add definitions for shared memory regions
From: "Dr. David Alan Gilbert" <[email protected]>
Add the virtio shared memory region definitions that have just got merged into the spec.
Dr. David Alan Gilbert (4):
virtio_pci: Define id field
virtio_pci: Define virtio_pci_cap64
virtio_pci: Defined shared memory capability
virito_mmio: Define shared memory region registers
include/uapi/linux/virtio_mmio.h | 11 +++++++++++ include/uapi/linux/virtio_pci.h | 11 ++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-)
Signature · 1 line
2.21.0
PATCH 1/4 virtio_pci: Define id field
From: "Dr. David Alan Gilbert" <[email protected]>
The new virtio-shared memory region system allows multiple regions to be defined for a device; each of these is the same type of capability.
To allow multiple capabilities of the same type, create an 'id' field to differentiate them.
Defined in virtio spec commit 39dfc8afc0b93 ("pci: Define id field")
--- include/uapi/linux/virtio_pci.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
include/uapi/linux/virtio_pci.h +2 -1
@@ -121,7 +121,8 @@ struct virtio_pci_cap {__u8 cap_len;/* Generic PCI field: capability length */ __u8 cfg_type;/* Identifies the structure. */ __u8 bar;/* Where to find it. */ -__u8 padding[3 ];/* Pad to full dword. */ +__u8 id;/* Multiple capabilities of the same type */ +__u8 padding[2 ];/* Pad to full dword. */ __le32 offset;/* Offset within bar. */ __le32 length;/* Length of the structure, in bytes. */ };
Signature · 1 line
2.21.0
PATCH 2/4 virtio_pci: Define virtio_pci_cap64
In reply to Dr. David Alan Gilbert (git)From: "Dr. David Alan Gilbert" <[email protected]>
Define 'virtio_pci_cap64' to allow capabilities to describe memory regions larger than, or with an offset larger than 4GiB.
This will be used by the shared memory region capability.
Defined in virtio spec commit 8100dcfcd622 ("pci: Define virtio_pci_cap64")
--- include/uapi/linux/virtio_pci.h | 6 ++++++ 1 file changed, 6 insertions(+)
include/uapi/linux/virtio_pci.h +6 -0
@@ -127,6 +127,12 @@ struct virtio_pci_cap {__le32 length;/* Length of the structure, in bytes. */ }; +struct virtio_pci_cap64 { +struct virtio_pci_cap cap; +__le32 offset_hi;/* Most sig 32 bits of offset */ +__le32 length_hi;/* Most sig 32 bits of length */ +}; +struct virtio_pci_notify_cap {struct virtio_pci_cap cap;__le32 notify_off_multiplier;/* Multiplier for queue_notify_off. */
Signature · 1 line
2.21.0
PATCH 3/4 virtio_pci: Defined shared memory capability
In reply to Dr. David Alan Gilbert (git)From: "Dr. David Alan Gilbert" <[email protected]>
Define the PCI capability used for enumerating shared memory regions. Each capability contains a 'struct virtio_pci_cap64' Multiple capabilities of this type may exist for a device and may be distinguished using the 'cap.id' field.
Defined in virtio spec commit 855ad7af2bd64 ("shared memory: Define PCI capability")
--- include/uapi/linux/virtio_pci.h | 2 ++ 1 file changed, 2 insertions(+)
include/uapi/linux/virtio_pci.h +2 -0
@@ -113,6 +113,8 @@#define VIRTIO_PCI_CAP_DEVICE_CFG 4/* PCI configuration access */ #define VIRTIO_PCI_CAP_PCI_CFG 5 +/* Additional shared memory capability */ +#define VIRTIO_PCI_CAP_SHARED_MEMORY_CFG 8/* This is the PCI capability header: */ struct virtio_pci_cap {
Signature · 1 line
2.21.0
PATCH 4/4 virito_mmio: Define shared memory region registers
In reply to Dr. David Alan Gilbert (git)From: "Dr. David Alan Gilbert" <[email protected]>
Define an MMIO interface to discover and map shared memory regions.
Defined in virtio spec commit 2dd2d468f69b ("shared memory: Define mmio registers")
--- include/uapi/linux/virtio_mmio.h | 11 +++++++++++ 1 file changed, 11 insertions(+)
include/uapi/linux/virtio_mmio.h +11 -0
@@ -122,6 +122,17 @@#define VIRTIO_MMIO_QUEUE_USED_LOW 0x0a0#define VIRTIO_MMIO_QUEUE_USED_HIGH 0x0a4 +/* Shared memory region id */ +#define VIRTIO_MMIO_SHM_SEL 0x0ac + +/* Shared memory region length, 64 bits in two halves */ +#define VIRTIO_MMIO_SHM_LEN_LOW 0x0b0 +#define VIRTIO_MMIO_SHM_LEN_HIGH 0x0b4 + +/* Shared memory region base address, 64 bits in two halves */ +#define VIRTIO_MMIO_SHM_BASE_LOW 0x0b8 +#define VIRTIO_MMIO_SHM_BASE_HIGH 0x0bc +/* Configuration atomicity value */ #define VIRTIO_MMIO_CONFIG_GENERATION 0x0fc
Signature · 1 line
2.21.0
Quoted 11 lines · Dr. David Alan Gilbert (git)
From: "Dr. David Alan Gilbert" <[email protected]>
Add the virtio shared memory region definitions that have just got merged into the spec.
Dr. David Alan Gilbert (4):
virtio_pci: Define id field
virtio_pci: Definevirtio_pci_cap64
virtio_pci: Defined shared memory capability
virito_mmio: Define shared memory region registers
Quoted 7 lines
include/uapi/linux/virtio_mmio.h | 11 +++++++++++ include/uapi/linux/virtio_pci.h | 11 ++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-)Signature · 1 line
2.21.0