search for: virtio_cread_bytes

Displaying 20 results from an estimated 74 matches for "virtio_cread_bytes".

2014 Dec 11
0
[PATCH 2/3] virtio_config: fix virtio_cread_bytes
virtio_cread_bytes is implemented incorrectly in case length happens to be 2,4 or 8 bytes: transports and devices will assume it's an integer value that has to be converted to LE format. Let's just do multiple 1-byte reads: this also makes life easier for transports who only need to implement 1,2,4 and 8 byt...
2017 Jan 26
1
[PATCH v2 2/2] virtio_scsi: Implement fc_host
...uct virtio_device *vdev, > return err; > } > > +static void virtscsi_update_fc_host_attrs(struct virtio_device *vdev) > +{ > + struct Scsi_Host *shost = vdev->priv; > + u8 node_name[8], port_name[8]; > + > + if (virtscsi_config_get(vdev, primary_active)) { > + virtio_cread_bytes(vdev, > + offsetof(struct virtio_scsi_config, primary_wwnn), > + &node_name, 8); > + virtio_cread_bytes(vdev, > + offsetof(struct virtio_scsi_config, primary_wwpn), > + &port_name, 8); > + } else { > + virtio_cread_bytes(vdev, > + offsetof(struct virtio_s...
2017 Jan 26
1
[PATCH v2 2/2] virtio_scsi: Implement fc_host
...uct virtio_device *vdev, > return err; > } > > +static void virtscsi_update_fc_host_attrs(struct virtio_device *vdev) > +{ > + struct Scsi_Host *shost = vdev->priv; > + u8 node_name[8], port_name[8]; > + > + if (virtscsi_config_get(vdev, primary_active)) { > + virtio_cread_bytes(vdev, > + offsetof(struct virtio_scsi_config, primary_wwnn), > + &node_name, 8); > + virtio_cread_bytes(vdev, > + offsetof(struct virtio_scsi_config, primary_wwpn), > + &port_name, 8); > + } else { > + virtio_cread_bytes(vdev, > + offsetof(struct virtio_s...
2017 Jan 26
6
[PATCH v2 0/2] virtio-scsi: Implement FC_HOST feature
v2: Fix endianness of WWNN/WWPN. [Paolo] This series implements the proposed fc_host feature of virtio-scsi. The first patch updates the data structure changes according to the spec proposal; the second patch actually implements the operations. Fam Zheng (2): virtio_scsi: Add fc_host definitions virtio_scsi: Implement fc_host drivers/scsi/virtio_scsi.c | 60
2017 Jan 26
6
[PATCH v2 0/2] virtio-scsi: Implement FC_HOST feature
v2: Fix endianness of WWNN/WWPN. [Paolo] This series implements the proposed fc_host feature of virtio-scsi. The first patch updates the data structure changes according to the spec proposal; the second patch actually implements the operations. Fam Zheng (2): virtio_scsi: Add fc_host definitions virtio_scsi: Implement fc_host drivers/scsi/virtio_scsi.c | 60
2017 Jan 26
0
[PATCH v2 2/2] virtio_scsi: Implement fc_host
...@@ -956,15 +966,42 @@ static int virtscsi_init(struct virtio_device *vdev, return err; } +static void virtscsi_update_fc_host_attrs(struct virtio_device *vdev) +{ + struct Scsi_Host *shost = vdev->priv; + u8 node_name[8], port_name[8]; + + if (virtscsi_config_get(vdev, primary_active)) { + virtio_cread_bytes(vdev, + offsetof(struct virtio_scsi_config, primary_wwnn), + &node_name, 8); + virtio_cread_bytes(vdev, + offsetof(struct virtio_scsi_config, primary_wwpn), + &port_name, 8); + } else { + virtio_cread_bytes(vdev, + offsetof(struct virtio_scsi_config, secondary_wwnn), + &no...
2015 Mar 31
2
[PATCH] virtio_config: reorder functions
...; - return ret; -} - /* Read @count fields, @bytes each. */ static inline void __virtio_cread_many(struct virtio_device *vdev, unsigned int offset, @@ -326,7 +319,6 @@ static inline void __virtio_cread_many(struct virtio_device *vdev, } while (gen != old); } - static inline void virtio_cread_bytes(struct virtio_device *vdev, unsigned int offset, void *buf, size_t len) @@ -334,6 +326,13 @@ static inline void virtio_cread_bytes(struct virtio_device *vdev, __virtio_cread_many(vdev, offset, buf, len, 1); } +static inline u8 virtio_cread8(struct virtio_device *vdev, uns...
2015 Mar 31
2
[PATCH] virtio_config: reorder functions
...; - return ret; -} - /* Read @count fields, @bytes each. */ static inline void __virtio_cread_many(struct virtio_device *vdev, unsigned int offset, @@ -326,7 +319,6 @@ static inline void __virtio_cread_many(struct virtio_device *vdev, } while (gen != old); } - static inline void virtio_cread_bytes(struct virtio_device *vdev, unsigned int offset, void *buf, size_t len) @@ -334,6 +326,13 @@ static inline void virtio_cread_bytes(struct virtio_device *vdev, __virtio_cread_many(vdev, offset, buf, len, 1); } +static inline u8 virtio_cread8(struct virtio_device *vdev, uns...
2017 Jan 17
2
[PATCH 2/2] virtio_scsi: Implement fc_host
...4 to represent port_name and node_name, > this patch does the same, so using virtio_* helpers for these fields should > handle the endianness correctly. I was suspicious about it because they are defined as "u8 x[8]" in the virtio_scsi_config struct. So you would need to read with virtio_cread_bytes and pass the result to wwn_to_u64. For example, if you have 0x500123456789abcd this would be 0x50 0x01 0x23 0x45 0x67 0x89 0xab 0cd in virtio_scsi_config, and then virtio_cread64 would read it as a little-endian u64, 0xcdab896745230150. Maybe your QEMU patch is also writing things as little-en...
2017 Jan 17
2
[PATCH 2/2] virtio_scsi: Implement fc_host
...4 to represent port_name and node_name, > this patch does the same, so using virtio_* helpers for these fields should > handle the endianness correctly. I was suspicious about it because they are defined as "u8 x[8]" in the virtio_scsi_config struct. So you would need to read with virtio_cread_bytes and pass the result to wwn_to_u64. For example, if you have 0x500123456789abcd this would be 0x50 0x01 0x23 0x45 0x67 0x89 0xab 0cd in virtio_scsi_config, and then virtio_cread64 would read it as a little-endian u64, 0xcdab896745230150. Maybe your QEMU patch is also writing things as little-en...
2020 Aug 06
2
[PATCH v2 03/24] virtio: allow __virtioXX, __leXX in config space
...> get/set don't convert to the native endian, I guess that's why > drivers use cread/cwrite. It is also nice that there's type > safety, checking the correct integer width is used. Yes, but this is simply because a macro is used here, how about just doing things similar like virtio_cread_bytes(): static inline void virtio_cread(struct virtio_device *vdev, ??? ??? ??? ??? ????? unsigned int offset, ??? ??? ??? ??? ????? void *buf, size_t len) And do the endian conversion inside? Thanks >
2020 Aug 06
2
[PATCH v2 03/24] virtio: allow __virtioXX, __leXX in config space
...> get/set don't convert to the native endian, I guess that's why > drivers use cread/cwrite. It is also nice that there's type > safety, checking the correct integer width is used. Yes, but this is simply because a macro is used here, how about just doing things similar like virtio_cread_bytes(): static inline void virtio_cread(struct virtio_device *vdev, ??? ??? ??? ??? ????? unsigned int offset, ??? ??? ??? ??? ????? void *buf, size_t len) And do the endian conversion inside? Thanks >
2014 Dec 11
4
[PATCH 0/3] minor virtio 1.0 fixups
Here are some fixup patches on top of my latest pull request. Will include in the next pull request. Michael S. Tsirkin (3): virtio: set VIRTIO_CONFIG_S_FEATURES_OK on restore virtio_config: fix virtio_cread_bytes virtio_pci_common.h: drop VIRTIO_PCI_NO_LEGACY drivers/virtio/virtio_pci_common.h | 1 - include/linux/virtio_config.h | 5 ++++- drivers/virtio/virtio.c | 37 +++++++++++++++++++++++-------------- 3 files changed, 27 insertions(+), 16 deletions(-) -- MST
2014 Dec 11
4
[PATCH 0/3] minor virtio 1.0 fixups
Here are some fixup patches on top of my latest pull request. Will include in the next pull request. Michael S. Tsirkin (3): virtio: set VIRTIO_CONFIG_S_FEATURES_OK on restore virtio_config: fix virtio_cread_bytes virtio_pci_common.h: drop VIRTIO_PCI_NO_LEGACY drivers/virtio/virtio_pci_common.h | 1 - include/linux/virtio_config.h | 5 ++++- drivers/virtio/virtio.c | 37 +++++++++++++++++++++++-------------- 3 files changed, 27 insertions(+), 16 deletions(-) -- MST
2014 Dec 15
8
[PATCH 0/6] virtio 1.0 fixups, tweaks
Fixes a couple of minor compliance issues in new virtio 1.0 code. Plus, adds a couple of minor cleanups - not bugfixes, but seem safe enough for 3.19. Michael S. Tsirkin (6): virtio: set VIRTIO_CONFIG_S_FEATURES_OK on restore virtio_config: fix virtio_cread_bytes virtio_pci_common.h: drop VIRTIO_PCI_NO_LEGACY virtio_pci: move probe to common file virtio_pci: add VIRTIO_PCI_NO_LEGACY virtio: core support for config generation drivers/virtio/virtio_pci_common.h | 7 +++---- include/linux/virtio_config.h | 29 ++++++++++++++++++++++++++++- incl...
2014 Dec 15
8
[PATCH 0/6] virtio 1.0 fixups, tweaks
Fixes a couple of minor compliance issues in new virtio 1.0 code. Plus, adds a couple of minor cleanups - not bugfixes, but seem safe enough for 3.19. Michael S. Tsirkin (6): virtio: set VIRTIO_CONFIG_S_FEATURES_OK on restore virtio_config: fix virtio_cread_bytes virtio_pci_common.h: drop VIRTIO_PCI_NO_LEGACY virtio_pci: move probe to common file virtio_pci: add VIRTIO_PCI_NO_LEGACY virtio: core support for config generation drivers/virtio/virtio_pci_common.h | 7 +++---- include/linux/virtio_config.h | 29 ++++++++++++++++++++++++++++- incl...
2015 Apr 08
0
[PATCH] virtio_config: reorder functions
...lds, @bytes each. */ > static inline void __virtio_cread_many(struct virtio_device *vdev, > unsigned int offset, > @@ -326,7 +319,6 @@ static inline void __virtio_cread_many(struct virtio_device *vdev, > } while (gen != old); > } > > - > static inline void virtio_cread_bytes(struct virtio_device *vdev, > unsigned int offset, > void *buf, size_t len) > @@ -334,6 +326,13 @@ static inline void virtio_cread_bytes(struct virtio_device *vdev, > __virtio_cread_many(vdev, offset, buf, len, 1); > } > > +static inline u8 virtio_cre...
2016 Oct 21
2
[PATCH net-next v2 6/9] net: use core MTU range checking in virt drivers
...res; > > > > + /* MTU range: 68 - 65535 */ > > + dev->min_mtu = MIN_MTU; > > + dev->max_mtu = MAX_MTU; > > + > > /* Configuration may specify what MAC to use. Otherwise random. */ > > if (virtio_has_feature(vdev, VIRTIO_NET_F_MAC)) > > virtio_cread_bytes(vdev, > > @@ -1875,8 +1870,10 @@ static int virtnet_probe(struct virtio_device *vdev) > > mtu = virtio_cread16(vdev, > > offsetof(struct virtio_net_config, > > mtu)); > > - if (virtnet_change_mtu(dev, mtu)) > > + if (mtu < dev->mi...
2016 Oct 21
2
[PATCH net-next v2 6/9] net: use core MTU range checking in virt drivers
...res; > > > > + /* MTU range: 68 - 65535 */ > > + dev->min_mtu = MIN_MTU; > > + dev->max_mtu = MAX_MTU; > > + > > /* Configuration may specify what MAC to use. Otherwise random. */ > > if (virtio_has_feature(vdev, VIRTIO_NET_F_MAC)) > > virtio_cread_bytes(vdev, > > @@ -1875,8 +1870,10 @@ static int virtnet_probe(struct virtio_device *vdev) > > mtu = virtio_cread16(vdev, > > offsetof(struct virtio_net_config, > > mtu)); > > - if (virtnet_change_mtu(dev, mtu)) > > + if (mtu < dev->mi...
2015 Mar 24
2
[PATCH v3] Add virtio-input driver.
...> + * Bitmap in virtio config space is a simple stream of bytes, > > + * with the first byte carrying bits 0-7, second bits 8-15 and > > + * so on. > > + */ > > + virtio_bits = kzalloc(bytes, GFP_KERNEL); > > + if (!virtio_bits) > > + return; > > + virtio_cread_bytes(vi->vdev, offsetof(struct virtio_input_config, u), > > + virtio_bits, bytes); > > + for (bit = 0; bit < bitcount; bit++) { > > + if (virtio_bits[bit / 8] & (1 << (bit % 8))) > > + __set_bit(bit, bits); > > + } > > + kfree(virtio_bits); &gt...