Fixes to id field for virtio-spec change
cover Fixes to id field for virtio-spec change
From: "Dr. David Alan Gilbert" <[email protected]>
Hi,
The current edition of the virtio spec changes for the
shared memory capability change how we find our DAX (and version) mappings.
We now use a byte in the existing capability header
as 'id', and now the new capability structure is a generic 64 bit structure.
This set goes with the current -dev qemu/virtiofsd branch.
Dr. David Alan Gilbert (2):
virito: Add 'id' field to capability header virto/shared memory: Rework for standardised id field
drivers/virtio/virtio_pci_modern.c | 8 ++++---- include/uapi/linux/virtio_pci.h | 17 ++++++++--------- 2 files changed, 12 insertions(+), 13 deletions(-)
Signature · 1 line
2.21.0
PATCH 1/2 virito: Add 'id' field to capability header
From: "Dr. David Alan Gilbert" <[email protected]>
For the shm capability we need to have multiple capabilities of the same type, with different uses. For this we need an 'id' field to differentiate them. Place this field in one of the spare bytes of the header.
--- include/uapi/linux/virtio_pci.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
include/uapi/linux/virtio_pci.h +2 -1
@@ -123,7 +123,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/2 virto/shared memory: Rework for standardised id field
In reply to Dr. David Alan Gilbert (git)From: "Dr. David Alan Gilbert" <[email protected]>
During virtio shared memory standardisation we've
moved the 'id' field, out of a special capability
and into the main virtio_pci_cap.
The name of the new 64 bit extensions have changes as well.
Fixup these changes; this commit can probably be
squahed into:
3d2660c667307350d17fdfb7148c8751a442aa6b virtio: Implement get_shm_region for PCI transport
--- drivers/virtio/virtio_pci_modern.c | 8 ++++---- include/uapi/linux/virtio_pci.h | 14 ++++++-------- 2 files changed, 10 insertions(+), 12 deletions(-)
drivers/virtio/virtio_pci_modern.c +4 -4
@@ -468,13 +468,13 @@ static int virtio_pci_find_shm_cap(struct pci_dev *dev,pci_read_config_byte (dev, pos + offsetof(struct virtio_pci_cap , cap_len), &cap_len); -if (cap_len !=sizeof (struct virtio_pci_shm_cap )) { +if (cap_len !=sizeof (struct virtio_pci_cap64 )) {printk (KERN_ERR "%s: shm cap with bad size offset: %d size: %d\n" , __func__, pos, cap_len);continue ; }; -pci_read_config_byte (dev, pos + offsetof(struct virtio_pci_shm_cap , +pci_read_config_byte (dev, pos + offsetof(struct virtio_pci_cap , id), &id);if (id != required_id)
@@ -495,12 +495,12 @@ static int virtio_pci_find_shm_cap(struct pci_dev *dev,/* and now the top half */ pci_read_config_dword (dev, - pos + offsetof(struct virtio_pci_shm_cap , + pos + offsetof(struct virtio_pci_cap64 , offset_hi), &tmp32); res_offset |= ((u64 )tmp32) <<32 ;pci_read_config_dword (dev, - pos + offsetof(struct virtio_pci_shm_cap , + pos + offsetof(struct virtio_pci_cap64 , length_hi), &tmp32); res_length |= ((u64 )tmp32) <<32 ;
include/uapi/linux/virtio_pci.h +6 -8
@@ -129,6 +129,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. */
@@ -166,14 +172,6 @@ struct virtio_pci_cfg_cap {__u8 pci_cfg_data[4 ];/* Data for BAR access. */ }; -/* Fields in VIRTIO_PCI_CAP_SHARED_MEMORY_CFG */ -struct virtio_pci_shm_cap { -struct virtio_pci_cap cap; -__le32 offset_hi;/* Most sig 32 bits of offset */ -__le32 length_hi;/* Most sig 32 bits of length */ -__u8 id;/* To distinguish shm chunks */ -}; -/* Macro versions of offsets for the Old Timers! */ #define VIRTIO_PCI_CAP_VNDR 0#define VIRTIO_PCI_CAP_NEXT 1
Signature · 1 line
2.21.0
Quoted 14 lines · Dr. David Alan Gilbert (git)
From: "Dr. David Alan Gilbert" <[email protected]>
Hi,
The current edition of the virtio spec changes for the
shared memory capability change how we find our DAX (and version) mappings.We now use a byte in the existing capability header
as 'id', and now the new capability structure is a generic 64 bit structure.This set goes with the current -dev qemu/virtiofsd branch.
Quoted 15 lines
Dr. David Alan Gilbert (2):
virito: Add 'id' field to capability header virto/shared memory: Rework for standardised id fielddrivers/virtio/virtio_pci_modern.c | 8 ++++---- include/uapi/linux/virtio_pci.h | 17 ++++++++--------- 2 files changed, 12 insertions(+), 13 deletions(-)Signature · 6 lines
2.21.0 _______________________________________________ Virtio-fs mailing list [email protected] https://www.redhat.com/mailman/listinfo/virtio-fs