Dr. David Alan Gilbert (git)
2019-Jul-25 17:50 UTC
[PATCH 0/4] virtio: Add definitions for shared memory regions
From: "Dr. David Alan Gilbert" <dgilbert at redhat.com> 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(-) -- 2.21.0
Dr. David Alan Gilbert (git)
2019-Jul-25 17:50 UTC
[PATCH 1/4] virtio_pci: Define id field
From: "Dr. David Alan Gilbert" <dgilbert at redhat.com> 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") Signed-off-by: Dr. David Alan Gilbert <dgilbert at redhat.com> --- include/uapi/linux/virtio_pci.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/uapi/linux/virtio_pci.h b/include/uapi/linux/virtio_pci.h index 90007a1abcab..9defe4a124c5 100644 --- a/include/uapi/linux/virtio_pci.h +++ b/include/uapi/linux/virtio_pci.h @@ -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. */ }; -- 2.21.0
Dr. David Alan Gilbert (git)
2019-Jul-25 17:50 UTC
[PATCH 2/4] virtio_pci: Define virtio_pci_cap64
From: "Dr. David Alan Gilbert" <dgilbert at redhat.com> 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") Signed-off-by: Dr. David Alan Gilbert <dgilbert at redhat.com> --- include/uapi/linux/virtio_pci.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/uapi/linux/virtio_pci.h b/include/uapi/linux/virtio_pci.h index 9defe4a124c5..11e508719dfd 100644 --- a/include/uapi/linux/virtio_pci.h +++ b/include/uapi/linux/virtio_pci.h @@ -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. */ -- 2.21.0
Dr. David Alan Gilbert (git)
2019-Jul-25 17:50 UTC
[PATCH 3/4] virtio_pci: Defined shared memory capability
From: "Dr. David Alan Gilbert" <dgilbert at redhat.com> 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") Signed-off-by: Dr. David Alan Gilbert <dgilbert at redhat.com> --- include/uapi/linux/virtio_pci.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/uapi/linux/virtio_pci.h b/include/uapi/linux/virtio_pci.h index 11e508719dfd..401a5d6851f1 100644 --- a/include/uapi/linux/virtio_pci.h +++ b/include/uapi/linux/virtio_pci.h @@ -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 { -- 2.21.0
Dr. David Alan Gilbert (git)
2019-Jul-25 17:50 UTC
[PATCH 4/4] virito_mmio: Define shared memory region registers
From: "Dr. David Alan Gilbert" <dgilbert at redhat.com> Define an MMIO interface to discover and map shared memory regions. Defined in virtio spec commit 2dd2d468f69b ("shared memory: Define mmio registers") Signed-off-by: Sebastien Boeuf <sebastien.boeuf at intel.com> Signed-off-by: Dr. David Alan Gilbert <dgilbert at redhat.com> --- include/uapi/linux/virtio_mmio.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/include/uapi/linux/virtio_mmio.h b/include/uapi/linux/virtio_mmio.h index c4b09689ab64..0650f91bea6c 100644 --- a/include/uapi/linux/virtio_mmio.h +++ b/include/uapi/linux/virtio_mmio.h @@ -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 -- 2.21.0
Stefan Hajnoczi
2019-Aug-07 13:20 UTC
[PATCH 0/4] virtio: Add definitions for shared memory regions
On Thu, Jul 25, 2019 at 06:50:40PM +0100, Dr. David Alan Gilbert (git) wrote:> From: "Dr. David Alan Gilbert" <dgilbert at redhat.com> > > 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(-) > > -- > 2.21.0 >Reviewed-by: Stefan Hajnoczi <stefanha at redhat.com>