Message ID | 1425994335-14138-1-git-send-email-cornelia.huck@de.ibm.com |
---|---|
State | New |
Headers | show |
On Tue, Mar 10, 2015 at 02:32:15PM +0100, Cornelia Huck wrote: > Commit ef546f1275f6563e8934dd5e338d29d9f9909ca6 ("virtio: add > feature checking helpers") introduced a helper __virtio_has_feature. > We don't want to use reserved identifiers, though, so let's > rename __virtio_has_feature to virtio_has_feature and virtio_has_feature > to virtio_vdev_has_feature. I don't think it's urgent to fix in master. Let's focus on getting virtio 1.0 branch merged instead. > > Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com> > --- > hw/block/virtio-blk.c | 5 +++-- > hw/char/virtio-serial-bus.c | 2 +- > hw/net/virtio-net.c | 22 +++++++++++----------- > hw/scsi/virtio-scsi.c | 8 ++++---- > hw/virtio/dataplane/vring.c | 10 +++++----- > hw/virtio/virtio-balloon.c | 2 +- > hw/virtio/virtio.c | 8 ++++---- > include/hw/virtio/virtio.h | 7 ++++--- > 8 files changed, 33 insertions(+), 31 deletions(-) > > diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c > index 1e5b918..9423d4a 100644 > --- a/hw/block/virtio-blk.c > +++ b/hw/block/virtio-blk.c > @@ -758,10 +758,11 @@ static void virtio_blk_set_status(VirtIODevice *vdev, uint8_t status) > * > * s->blk would erroneously be placed in writethrough mode. > */ > - if (!virtio_has_feature(vdev, VIRTIO_BLK_F_CONFIG_WCE)) { > + if (!virtio_vdev_has_feature(vdev, VIRTIO_BLK_F_CONFIG_WCE)) { > aio_context_acquire(blk_get_aio_context(s->blk)); > blk_set_enable_write_cache(s->blk, > - virtio_has_feature(vdev, VIRTIO_BLK_F_WCE)); > + virtio_vdev_has_feature(vdev, > + VIRTIO_BLK_F_WCE)); > aio_context_release(blk_get_aio_context(s->blk)); > } > } > diff --git a/hw/char/virtio-serial-bus.c b/hw/char/virtio-serial-bus.c > index 9a029d2..b820e2c 100644 > --- a/hw/char/virtio-serial-bus.c > +++ b/hw/char/virtio-serial-bus.c > @@ -75,7 +75,7 @@ static VirtIOSerialPort *find_port_by_name(char *name) > static bool use_multiport(VirtIOSerial *vser) > { > VirtIODevice *vdev = VIRTIO_DEVICE(vser); > - return virtio_has_feature(vdev, VIRTIO_CONSOLE_F_MULTIPORT); > + return virtio_vdev_has_feature(vdev, VIRTIO_CONSOLE_F_MULTIPORT); > } > > static size_t write_to_port(VirtIOSerialPort *port, > diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c > index 1187ab8..ec25db5 100644 > --- a/hw/net/virtio-net.c > +++ b/hw/net/virtio-net.c > @@ -86,7 +86,7 @@ static void virtio_net_set_config(VirtIODevice *vdev, const uint8_t *config) > > memcpy(&netcfg, config, n->config_size); > > - if (!virtio_has_feature(vdev, VIRTIO_NET_F_CTRL_MAC_ADDR) && > + if (!virtio_vdev_has_feature(vdev, VIRTIO_NET_F_CTRL_MAC_ADDR) && > memcmp(netcfg.mac, n->mac, ETH_ALEN)) { > memcpy(n->mac, netcfg.mac, ETH_ALEN); > qemu_format_nic_info_str(qemu_get_queue(n->nic), n->mac); > @@ -305,7 +305,7 @@ static RxFilterInfo *virtio_net_query_rxfilter(NetClientState *nc) > info->multicast_table = str_list; > info->vlan_table = get_vlan_table(n); > > - if (!virtio_has_feature(vdev, VIRTIO_NET_F_CTRL_VLAN)) { > + if (!virtio_vdev_has_feature(vdev, VIRTIO_NET_F_CTRL_VLAN)) { > info->vlan = RX_STATE_ALL; > } else if (!info->vlan_table) { > info->vlan = RX_STATE_NONE; > @@ -520,11 +520,11 @@ static void virtio_net_set_features(VirtIODevice *vdev, uint32_t features) > int i; > > virtio_net_set_multiqueue(n, > - __virtio_has_feature(features, VIRTIO_NET_F_MQ)); > + virtio_has_feature(features, VIRTIO_NET_F_MQ)); > > virtio_net_set_mrg_rx_bufs(n, > - __virtio_has_feature(features, > - VIRTIO_NET_F_MRG_RXBUF)); > + virtio_has_feature(features, > + VIRTIO_NET_F_MRG_RXBUF)); > > if (n->has_vnet_hdr) { > n->curr_guest_offloads = > @@ -541,7 +541,7 @@ static void virtio_net_set_features(VirtIODevice *vdev, uint32_t features) > vhost_net_ack_features(get_vhost_net(nc->peer), features); > } > > - if (__virtio_has_feature(features, VIRTIO_NET_F_CTRL_VLAN)) { > + if (virtio_has_feature(features, VIRTIO_NET_F_CTRL_VLAN)) { > memset(n->vlans, 0, MAX_VLAN >> 3); > } else { > memset(n->vlans, 0xff, MAX_VLAN >> 3); > @@ -588,7 +588,7 @@ static int virtio_net_handle_offloads(VirtIONet *n, uint8_t cmd, > uint64_t offloads; > size_t s; > > - if (!virtio_has_feature(vdev, VIRTIO_NET_F_CTRL_GUEST_OFFLOADS)) { > + if (!virtio_vdev_has_feature(vdev, VIRTIO_NET_F_CTRL_GUEST_OFFLOADS)) { > return VIRTIO_NET_ERR; > } > > @@ -1381,7 +1381,7 @@ static void virtio_net_save_device(VirtIODevice *vdev, QEMUFile *f) > } > } > > - if (virtio_has_feature(vdev, VIRTIO_NET_F_CTRL_GUEST_OFFLOADS)) { > + if (virtio_vdev_has_feature(vdev, VIRTIO_NET_F_CTRL_GUEST_OFFLOADS)) { > qemu_put_be64(f, n->curr_guest_offloads); > } > } > @@ -1489,7 +1489,7 @@ static int virtio_net_load_device(VirtIODevice *vdev, QEMUFile *f, > } > } > > - if (virtio_has_feature(vdev, VIRTIO_NET_F_CTRL_GUEST_OFFLOADS)) { > + if (virtio_vdev_has_feature(vdev, VIRTIO_NET_F_CTRL_GUEST_OFFLOADS)) { > n->curr_guest_offloads = qemu_get_be64(f); > } else { > n->curr_guest_offloads = virtio_net_supported_guest_offloads(n); > @@ -1516,8 +1516,8 @@ static int virtio_net_load_device(VirtIODevice *vdev, QEMUFile *f, > qemu_get_subqueue(n->nic, i)->link_down = link_down; > } > > - if (virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_ANNOUNCE) && > - virtio_has_feature(vdev, VIRTIO_NET_F_CTRL_VQ)) { > + if (virtio_vdev_has_feature(vdev, VIRTIO_NET_F_GUEST_ANNOUNCE) && > + virtio_vdev_has_feature(vdev, VIRTIO_NET_F_CTRL_VQ)) { > n->announce_counter = SELF_ANNOUNCE_ROUNDS; > timer_mod(n->announce_timer, qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL)); > } > diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c > index cfb52e8..ca36cfe 100644 > --- a/hw/scsi/virtio-scsi.c > +++ b/hw/scsi/virtio-scsi.c > @@ -145,7 +145,7 @@ static int virtio_scsi_parse_req(VirtIOSCSIReq *req, > * > * TODO: always disable this workaround for virtio 1.0 devices. > */ > - if (!virtio_has_feature(vdev, VIRTIO_F_ANY_LAYOUT)) { > + if (!virtio_vdev_has_feature(vdev, VIRTIO_F_ANY_LAYOUT)) { > req_size = req->elem.out_sg[0].iov_len; > resp_size = req->elem.in_sg[0].iov_len; > } > @@ -745,7 +745,7 @@ static void virtio_scsi_change(SCSIBus *bus, SCSIDevice *dev, SCSISense sense) > VirtIOSCSI *s = container_of(bus, VirtIOSCSI, bus); > VirtIODevice *vdev = VIRTIO_DEVICE(s); > > - if (virtio_has_feature(vdev, VIRTIO_SCSI_F_CHANGE) && > + if (virtio_vdev_has_feature(vdev, VIRTIO_SCSI_F_CHANGE) && > dev->type != TYPE_ROM) { > virtio_scsi_push_event(s, dev, VIRTIO_SCSI_T_PARAM_CHANGE, > sense.asc | (sense.ascq << 8)); > @@ -769,7 +769,7 @@ static void virtio_scsi_hotplug(HotplugHandler *hotplug_dev, DeviceState *dev, > aio_context_release(s->ctx); > } > > - if (virtio_has_feature(vdev, VIRTIO_SCSI_F_HOTPLUG)) { > + if (virtio_vdev_has_feature(vdev, VIRTIO_SCSI_F_HOTPLUG)) { > virtio_scsi_push_event(s, sd, > VIRTIO_SCSI_T_TRANSPORT_RESET, > VIRTIO_SCSI_EVT_RESET_RESCAN); > @@ -783,7 +783,7 @@ static void virtio_scsi_hotunplug(HotplugHandler *hotplug_dev, DeviceState *dev, > VirtIOSCSI *s = VIRTIO_SCSI(vdev); > SCSIDevice *sd = SCSI_DEVICE(dev); > > - if (virtio_has_feature(vdev, VIRTIO_SCSI_F_HOTPLUG)) { > + if (virtio_vdev_has_feature(vdev, VIRTIO_SCSI_F_HOTPLUG)) { > virtio_scsi_push_event(s, sd, > VIRTIO_SCSI_T_TRANSPORT_RESET, > VIRTIO_SCSI_EVT_RESET_REMOVED); > diff --git a/hw/virtio/dataplane/vring.c b/hw/virtio/dataplane/vring.c > index 5c7b8c2..023ec83 100644 > --- a/hw/virtio/dataplane/vring.c > +++ b/hw/virtio/dataplane/vring.c > @@ -105,7 +105,7 @@ void vring_teardown(Vring *vring, VirtIODevice *vdev, int n) > /* Disable guest->host notifies */ > void vring_disable_notification(VirtIODevice *vdev, Vring *vring) > { > - if (!virtio_has_feature(vdev, VIRTIO_RING_F_EVENT_IDX)) { > + if (!virtio_vdev_has_feature(vdev, VIRTIO_RING_F_EVENT_IDX)) { > vring_set_used_flags(vdev, vring, VRING_USED_F_NO_NOTIFY); > } > } > @@ -116,7 +116,7 @@ void vring_disable_notification(VirtIODevice *vdev, Vring *vring) > */ > bool vring_enable_notification(VirtIODevice *vdev, Vring *vring) > { > - if (virtio_has_feature(vdev, VIRTIO_RING_F_EVENT_IDX)) { > + if (virtio_vdev_has_feature(vdev, VIRTIO_RING_F_EVENT_IDX)) { > vring_avail_event(&vring->vr) = vring->vr.avail->idx; > } else { > vring_clear_used_flags(vdev, vring, VRING_USED_F_NO_NOTIFY); > @@ -135,12 +135,12 @@ bool vring_should_notify(VirtIODevice *vdev, Vring *vring) > * interrupts. */ > smp_mb(); > > - if (virtio_has_feature(vdev, VIRTIO_F_NOTIFY_ON_EMPTY) && > + if (virtio_vdev_has_feature(vdev, VIRTIO_F_NOTIFY_ON_EMPTY) && > unlikely(!vring_more_avail(vdev, vring))) { > return true; > } > > - if (!virtio_has_feature(vdev, VIRTIO_RING_F_EVENT_IDX)) { > + if (!virtio_vdev_has_feature(vdev, VIRTIO_RING_F_EVENT_IDX)) { > return !(vring_get_avail_flags(vdev, vring) & > VRING_AVAIL_F_NO_INTERRUPT); > } > @@ -401,7 +401,7 @@ int vring_pop(VirtIODevice *vdev, Vring *vring, > > /* On success, increment avail index. */ > vring->last_avail_idx++; > - if (virtio_has_feature(vdev, VIRTIO_RING_F_EVENT_IDX)) { > + if (virtio_vdev_has_feature(vdev, VIRTIO_RING_F_EVENT_IDX)) { > vring_avail_event(&vring->vr) = vring->last_avail_idx; > } > > diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c > index 95b0643..912609c 100644 > --- a/hw/virtio/virtio-balloon.c > +++ b/hw/virtio/virtio-balloon.c > @@ -70,7 +70,7 @@ static inline void reset_stats(VirtIOBalloon *dev) > static bool balloon_stats_supported(const VirtIOBalloon *s) > { > VirtIODevice *vdev = VIRTIO_DEVICE(s); > - return virtio_has_feature(vdev, VIRTIO_BALLOON_F_STATS_VQ); > + return virtio_vdev_has_feature(vdev, VIRTIO_BALLOON_F_STATS_VQ); > } > > static bool balloon_stats_enabled(const VirtIOBalloon *s) > diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c > index 3c6e430..a17920f 100644 > --- a/hw/virtio/virtio.c > +++ b/hw/virtio/virtio.c > @@ -217,7 +217,7 @@ static inline void vring_set_avail_event(VirtQueue *vq, uint16_t val) > void virtio_queue_set_notification(VirtQueue *vq, int enable) > { > vq->notification = enable; > - if (virtio_has_feature(vq->vdev, VIRTIO_RING_F_EVENT_IDX)) { > + if (virtio_vdev_has_feature(vq->vdev, VIRTIO_RING_F_EVENT_IDX)) { > vring_set_avail_event(vq, vring_avail_idx(vq)); > } else if (enable) { > vring_used_flags_unset_bit(vq, VRING_USED_F_NO_NOTIFY); > @@ -468,7 +468,7 @@ int virtqueue_pop(VirtQueue *vq, VirtQueueElement *elem) > max = vq->vring.num; > > i = head = virtqueue_get_head(vq, vq->last_avail_idx++); > - if (virtio_has_feature(vdev, VIRTIO_RING_F_EVENT_IDX)) { > + if (virtio_vdev_has_feature(vdev, VIRTIO_RING_F_EVENT_IDX)) { > vring_set_avail_event(vq, vq->last_avail_idx); > } > > @@ -826,12 +826,12 @@ static bool vring_notify(VirtIODevice *vdev, VirtQueue *vq) > /* We need to expose used array entries before checking used event. */ > smp_mb(); > /* Always notify when queue is empty (when feature acknowledge) */ > - if (virtio_has_feature(vdev, VIRTIO_F_NOTIFY_ON_EMPTY) && > + if (virtio_vdev_has_feature(vdev, VIRTIO_F_NOTIFY_ON_EMPTY) && > !vq->inuse && vring_avail_idx(vq) == vq->last_avail_idx) { > return true; > } > > - if (!virtio_has_feature(vdev, VIRTIO_RING_F_EVENT_IDX)) { > + if (!virtio_vdev_has_feature(vdev, VIRTIO_RING_F_EVENT_IDX)) { > return !(vring_avail_flags(vq) & VRING_AVAIL_F_NO_INTERRUPT); > } > > diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h > index d95f8b6..28ffdd8 100644 > --- a/include/hw/virtio/virtio.h > +++ b/include/hw/virtio/virtio.h > @@ -231,15 +231,16 @@ static inline void virtio_clear_feature(uint32_t *features, unsigned int fbit) > *features &= ~(1 << fbit); > } > > -static inline bool __virtio_has_feature(uint32_t features, unsigned int fbit) > +static inline bool virtio_has_feature(uint32_t features, unsigned int fbit) > { > assert(fbit < 32); > return !!(features & (1 << fbit)); > } > > -static inline bool virtio_has_feature(VirtIODevice *vdev, unsigned int fbit) > +static inline bool virtio_vdev_has_feature(VirtIODevice *vdev, > + unsigned int fbit) > { > - return __virtio_has_feature(vdev->guest_features, fbit); > + return virtio_has_feature(vdev->guest_features, fbit); > } > > static inline bool virtio_is_big_endian(VirtIODevice *vdev) > -- > 2.3.2
On Tue, 10 Mar 2015 15:12:14 +0100 "Michael S. Tsirkin" <mst@redhat.com> wrote: > On Tue, Mar 10, 2015 at 02:32:15PM +0100, Cornelia Huck wrote: > > Commit ef546f1275f6563e8934dd5e338d29d9f9909ca6 ("virtio: add > > feature checking helpers") introduced a helper __virtio_has_feature. > > We don't want to use reserved identifiers, though, so let's > > rename __virtio_has_feature to virtio_has_feature and virtio_has_feature > > to virtio_vdev_has_feature. > > I don't think it's urgent to fix in master. > Let's focus on getting virtio 1.0 branch merged instead. I stumbled over this actually when trying to update my virtio-1 branch. I already did that change there (as promised in <20141212110701.0c6d879b.cornelia.huck@de.ibm.com>), but it got lost somewhere in my moving chaos. What's the status of your virtio-1.0 branch? Would it be worthwile for me to rebase on top of it so I can figure out which changes I have not yet sent out?
On Tue, Mar 10, 2015 at 03:22:29PM +0100, Cornelia Huck wrote: > On Tue, 10 Mar 2015 15:12:14 +0100 > "Michael S. Tsirkin" <mst@redhat.com> wrote: > > > On Tue, Mar 10, 2015 at 02:32:15PM +0100, Cornelia Huck wrote: > > > Commit ef546f1275f6563e8934dd5e338d29d9f9909ca6 ("virtio: add > > > feature checking helpers") introduced a helper __virtio_has_feature. > > > We don't want to use reserved identifiers, though, so let's > > > rename __virtio_has_feature to virtio_has_feature and virtio_has_feature > > > to virtio_vdev_has_feature. > > > > I don't think it's urgent to fix in master. > > Let's focus on getting virtio 1.0 branch merged instead. > > I stumbled over this actually when trying to update my virtio-1 branch. > I already did that change there (as promised in > <20141212110701.0c6d879b.cornelia.huck@de.ibm.com>), but it got lost > somewhere in my moving chaos. > > What's the status of your virtio-1.0 branch? virtio pci works there too now, so I started looking at upstreaming stuff from that branch. Already did some. > Would it be worthwile for > me to rebase on top of it so I can figure out which changes I have not > yet sent out? Absolutely.
On Tue, 10 Mar 2015 15:27:24 +0100 "Michael S. Tsirkin" <mst@redhat.com> wrote: > On Tue, Mar 10, 2015 at 03:22:29PM +0100, Cornelia Huck wrote: > > On Tue, 10 Mar 2015 15:12:14 +0100 > > "Michael S. Tsirkin" <mst@redhat.com> wrote: > > > > > On Tue, Mar 10, 2015 at 02:32:15PM +0100, Cornelia Huck wrote: > > > > Commit ef546f1275f6563e8934dd5e338d29d9f9909ca6 ("virtio: add > > > > feature checking helpers") introduced a helper __virtio_has_feature. > > > > We don't want to use reserved identifiers, though, so let's > > > > rename __virtio_has_feature to virtio_has_feature and virtio_has_feature > > > > to virtio_vdev_has_feature. > > > > > > I don't think it's urgent to fix in master. > > > Let's focus on getting virtio 1.0 branch merged instead. > > > > I stumbled over this actually when trying to update my virtio-1 branch. > > I already did that change there (as promised in > > <20141212110701.0c6d879b.cornelia.huck@de.ibm.com>), but it got lost > > somewhere in my moving chaos. > > > > What's the status of your virtio-1.0 branch? > > virtio pci works there too now, so I started looking at upstreaming > stuff from that branch. Already did some. > > > Would it be worthwile for > > me to rebase on top of it so I can figure out which changes I have not > > yet sent out? > > Absolutely. OK, it's actually not that much: - this change :) - All ccw accesses are BE (see <20150121133922.1b3e7ceb.cornelia.huck@de.ibm.com>). I'll do two patches: One for the existing ccws which will go via my tree and one for the new set-revision ccw which should be squashed into that patch. - Use legacy/non-legacy feature bit getters instead of revision-specific ones (see <20150130151049.2e4c5331.cornelia.huck@de.ibm.com>). Should probably replace the existing patches introducing get_features_rev and using it in virtio-blk. Also, it seems there are some r-bs that had been given for my patches that are missing on your branch.
On Tue, Mar 10, 2015 at 05:03:47PM +0100, Cornelia Huck wrote: > On Tue, 10 Mar 2015 15:27:24 +0100 > "Michael S. Tsirkin" <mst@redhat.com> wrote: > > > On Tue, Mar 10, 2015 at 03:22:29PM +0100, Cornelia Huck wrote: > > > On Tue, 10 Mar 2015 15:12:14 +0100 > > > "Michael S. Tsirkin" <mst@redhat.com> wrote: > > > > > > > On Tue, Mar 10, 2015 at 02:32:15PM +0100, Cornelia Huck wrote: > > > > > Commit ef546f1275f6563e8934dd5e338d29d9f9909ca6 ("virtio: add > > > > > feature checking helpers") introduced a helper __virtio_has_feature. > > > > > We don't want to use reserved identifiers, though, so let's > > > > > rename __virtio_has_feature to virtio_has_feature and virtio_has_feature > > > > > to virtio_vdev_has_feature. > > > > > > > > I don't think it's urgent to fix in master. > > > > Let's focus on getting virtio 1.0 branch merged instead. > > > > > > I stumbled over this actually when trying to update my virtio-1 branch. > > > I already did that change there (as promised in > > > <20141212110701.0c6d879b.cornelia.huck@de.ibm.com>), but it got lost > > > somewhere in my moving chaos. > > > > > > What's the status of your virtio-1.0 branch? > > > > virtio pci works there too now, so I started looking at upstreaming > > stuff from that branch. Already did some. > > > > > Would it be worthwile for > > > me to rebase on top of it so I can figure out which changes I have not > > > yet sent out? > > > > Absolutely. > > OK, it's actually not that much: > > - this change :) > - All ccw accesses are BE (see > <20150121133922.1b3e7ceb.cornelia.huck@de.ibm.com>). I'll do two > patches: One for the existing ccws which will go via my tree and one > for the new set-revision ccw which should be squashed into that patch. Will rebasing virtio-1.0 on top of master after your patch is upstream do the trick as well? > - Use legacy/non-legacy feature bit getters instead of > revision-specific ones (see > <20150130151049.2e4c5331.cornelia.huck@de.ibm.com>). Should probably > replace the existing patches introducing get_features_rev and using it > in virtio-blk. Right, but for that, let's get it all in working order using patches on top, first. Then, re-split logically. > Also, it seems there are some r-bs that had been given for my patches > that are missing on your branch. I might have missed some - can you hunt up the msg ids?
On Tue, 10 Mar 2015 17:34:27 +0100 "Michael S. Tsirkin" <mst@redhat.com> wrote: > On Tue, Mar 10, 2015 at 05:03:47PM +0100, Cornelia Huck wrote: > > On Tue, 10 Mar 2015 15:27:24 +0100 > > "Michael S. Tsirkin" <mst@redhat.com> wrote: > > > > > On Tue, Mar 10, 2015 at 03:22:29PM +0100, Cornelia Huck wrote: > > > > On Tue, 10 Mar 2015 15:12:14 +0100 > > > > "Michael S. Tsirkin" <mst@redhat.com> wrote: > > > > > > > > > On Tue, Mar 10, 2015 at 02:32:15PM +0100, Cornelia Huck wrote: > > > > > > Commit ef546f1275f6563e8934dd5e338d29d9f9909ca6 ("virtio: add > > > > > > feature checking helpers") introduced a helper __virtio_has_feature. > > > > > > We don't want to use reserved identifiers, though, so let's > > > > > > rename __virtio_has_feature to virtio_has_feature and virtio_has_feature > > > > > > to virtio_vdev_has_feature. > > > > > > > > > > I don't think it's urgent to fix in master. > > > > > Let's focus on getting virtio 1.0 branch merged instead. > > > > > > > > I stumbled over this actually when trying to update my virtio-1 branch. > > > > I already did that change there (as promised in > > > > <20141212110701.0c6d879b.cornelia.huck@de.ibm.com>), but it got lost > > > > somewhere in my moving chaos. > > > > > > > > What's the status of your virtio-1.0 branch? > > > > > > virtio pci works there too now, so I started looking at upstreaming > > > stuff from that branch. Already did some. > > > > > > > Would it be worthwile for > > > > me to rebase on top of it so I can figure out which changes I have not > > > > yet sent out? > > > > > > Absolutely. > > > > OK, it's actually not that much: > > > > - this change :) > > - All ccw accesses are BE (see > > <20150121133922.1b3e7ceb.cornelia.huck@de.ibm.com>). I'll do two > > patches: One for the existing ccws which will go via my tree and one > > for the new set-revision ccw which should be squashed into that patch. > > Will rebasing virtio-1.0 on top of master after your patch > is upstream do the trick as well? set-revision needs to merge the change, I did not introduce generic helpers. > > > - Use legacy/non-legacy feature bit getters instead of > > revision-specific ones (see > > <20150130151049.2e4c5331.cornelia.huck@de.ibm.com>). Should probably > > replace the existing patches introducing get_features_rev and using it > > in virtio-blk. > > Right, but for that, let's get it all in working order using patches on > top, first. Then, re-split logically. I'll prepare a patch for review. > > > Also, it seems there are some r-bs that had been given for my patches > > that are missing on your branch. > > I might have missed some - can you hunt up the msg ids? There are at least: <20150120110021.GH17631@stefanha-thinkpad.redhat.com> <20150120111947.GM17631@stefanha-thinkpad.redhat.com> <20150120111555.GL17631@stefanha-thinkpad.redhat.com> <20141212122547.511baafd@oc7435384737.ibm.com> <20150122021522.GK27371@voom.fritz.box> <20150120110603.GI17631@stefanha-thinkpad.redhat.com> <20150120102936.GE17631@stefanha-thinkpad.redhat.com> ...and some for the virtio patches that are already upstream :(
OK, here's what I have for the virtio-ccw be stuff. Patch 1 will go via s390-next with my next pull request, patch 2 is on top of your current virtio-1.0 branch and should possibly be merged into the patch introducing set-revision. Cornelia Huck (2): virtio-ccw: assure BE accesses virtio-ccw: assure be accesses for set-revision hw/s390x/virtio-ccw.c | 37 ++++++++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 11 deletions(-)
diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c index 1e5b918..9423d4a 100644 --- a/hw/block/virtio-blk.c +++ b/hw/block/virtio-blk.c @@ -758,10 +758,11 @@ static void virtio_blk_set_status(VirtIODevice *vdev, uint8_t status) * * s->blk would erroneously be placed in writethrough mode. */ - if (!virtio_has_feature(vdev, VIRTIO_BLK_F_CONFIG_WCE)) { + if (!virtio_vdev_has_feature(vdev, VIRTIO_BLK_F_CONFIG_WCE)) { aio_context_acquire(blk_get_aio_context(s->blk)); blk_set_enable_write_cache(s->blk, - virtio_has_feature(vdev, VIRTIO_BLK_F_WCE)); + virtio_vdev_has_feature(vdev, + VIRTIO_BLK_F_WCE)); aio_context_release(blk_get_aio_context(s->blk)); } } diff --git a/hw/char/virtio-serial-bus.c b/hw/char/virtio-serial-bus.c index 9a029d2..b820e2c 100644 --- a/hw/char/virtio-serial-bus.c +++ b/hw/char/virtio-serial-bus.c @@ -75,7 +75,7 @@ static VirtIOSerialPort *find_port_by_name(char *name) static bool use_multiport(VirtIOSerial *vser) { VirtIODevice *vdev = VIRTIO_DEVICE(vser); - return virtio_has_feature(vdev, VIRTIO_CONSOLE_F_MULTIPORT); + return virtio_vdev_has_feature(vdev, VIRTIO_CONSOLE_F_MULTIPORT); } static size_t write_to_port(VirtIOSerialPort *port, diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index 1187ab8..ec25db5 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -86,7 +86,7 @@ static void virtio_net_set_config(VirtIODevice *vdev, const uint8_t *config) memcpy(&netcfg, config, n->config_size); - if (!virtio_has_feature(vdev, VIRTIO_NET_F_CTRL_MAC_ADDR) && + if (!virtio_vdev_has_feature(vdev, VIRTIO_NET_F_CTRL_MAC_ADDR) && memcmp(netcfg.mac, n->mac, ETH_ALEN)) { memcpy(n->mac, netcfg.mac, ETH_ALEN); qemu_format_nic_info_str(qemu_get_queue(n->nic), n->mac); @@ -305,7 +305,7 @@ static RxFilterInfo *virtio_net_query_rxfilter(NetClientState *nc) info->multicast_table = str_list; info->vlan_table = get_vlan_table(n); - if (!virtio_has_feature(vdev, VIRTIO_NET_F_CTRL_VLAN)) { + if (!virtio_vdev_has_feature(vdev, VIRTIO_NET_F_CTRL_VLAN)) { info->vlan = RX_STATE_ALL; } else if (!info->vlan_table) { info->vlan = RX_STATE_NONE; @@ -520,11 +520,11 @@ static void virtio_net_set_features(VirtIODevice *vdev, uint32_t features) int i; virtio_net_set_multiqueue(n, - __virtio_has_feature(features, VIRTIO_NET_F_MQ)); + virtio_has_feature(features, VIRTIO_NET_F_MQ)); virtio_net_set_mrg_rx_bufs(n, - __virtio_has_feature(features, - VIRTIO_NET_F_MRG_RXBUF)); + virtio_has_feature(features, + VIRTIO_NET_F_MRG_RXBUF)); if (n->has_vnet_hdr) { n->curr_guest_offloads = @@ -541,7 +541,7 @@ static void virtio_net_set_features(VirtIODevice *vdev, uint32_t features) vhost_net_ack_features(get_vhost_net(nc->peer), features); } - if (__virtio_has_feature(features, VIRTIO_NET_F_CTRL_VLAN)) { + if (virtio_has_feature(features, VIRTIO_NET_F_CTRL_VLAN)) { memset(n->vlans, 0, MAX_VLAN >> 3); } else { memset(n->vlans, 0xff, MAX_VLAN >> 3); @@ -588,7 +588,7 @@ static int virtio_net_handle_offloads(VirtIONet *n, uint8_t cmd, uint64_t offloads; size_t s; - if (!virtio_has_feature(vdev, VIRTIO_NET_F_CTRL_GUEST_OFFLOADS)) { + if (!virtio_vdev_has_feature(vdev, VIRTIO_NET_F_CTRL_GUEST_OFFLOADS)) { return VIRTIO_NET_ERR; } @@ -1381,7 +1381,7 @@ static void virtio_net_save_device(VirtIODevice *vdev, QEMUFile *f) } } - if (virtio_has_feature(vdev, VIRTIO_NET_F_CTRL_GUEST_OFFLOADS)) { + if (virtio_vdev_has_feature(vdev, VIRTIO_NET_F_CTRL_GUEST_OFFLOADS)) { qemu_put_be64(f, n->curr_guest_offloads); } } @@ -1489,7 +1489,7 @@ static int virtio_net_load_device(VirtIODevice *vdev, QEMUFile *f, } } - if (virtio_has_feature(vdev, VIRTIO_NET_F_CTRL_GUEST_OFFLOADS)) { + if (virtio_vdev_has_feature(vdev, VIRTIO_NET_F_CTRL_GUEST_OFFLOADS)) { n->curr_guest_offloads = qemu_get_be64(f); } else { n->curr_guest_offloads = virtio_net_supported_guest_offloads(n); @@ -1516,8 +1516,8 @@ static int virtio_net_load_device(VirtIODevice *vdev, QEMUFile *f, qemu_get_subqueue(n->nic, i)->link_down = link_down; } - if (virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_ANNOUNCE) && - virtio_has_feature(vdev, VIRTIO_NET_F_CTRL_VQ)) { + if (virtio_vdev_has_feature(vdev, VIRTIO_NET_F_GUEST_ANNOUNCE) && + virtio_vdev_has_feature(vdev, VIRTIO_NET_F_CTRL_VQ)) { n->announce_counter = SELF_ANNOUNCE_ROUNDS; timer_mod(n->announce_timer, qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL)); } diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c index cfb52e8..ca36cfe 100644 --- a/hw/scsi/virtio-scsi.c +++ b/hw/scsi/virtio-scsi.c @@ -145,7 +145,7 @@ static int virtio_scsi_parse_req(VirtIOSCSIReq *req, * * TODO: always disable this workaround for virtio 1.0 devices. */ - if (!virtio_has_feature(vdev, VIRTIO_F_ANY_LAYOUT)) { + if (!virtio_vdev_has_feature(vdev, VIRTIO_F_ANY_LAYOUT)) { req_size = req->elem.out_sg[0].iov_len; resp_size = req->elem.in_sg[0].iov_len; } @@ -745,7 +745,7 @@ static void virtio_scsi_change(SCSIBus *bus, SCSIDevice *dev, SCSISense sense) VirtIOSCSI *s = container_of(bus, VirtIOSCSI, bus); VirtIODevice *vdev = VIRTIO_DEVICE(s); - if (virtio_has_feature(vdev, VIRTIO_SCSI_F_CHANGE) && + if (virtio_vdev_has_feature(vdev, VIRTIO_SCSI_F_CHANGE) && dev->type != TYPE_ROM) { virtio_scsi_push_event(s, dev, VIRTIO_SCSI_T_PARAM_CHANGE, sense.asc | (sense.ascq << 8)); @@ -769,7 +769,7 @@ static void virtio_scsi_hotplug(HotplugHandler *hotplug_dev, DeviceState *dev, aio_context_release(s->ctx); } - if (virtio_has_feature(vdev, VIRTIO_SCSI_F_HOTPLUG)) { + if (virtio_vdev_has_feature(vdev, VIRTIO_SCSI_F_HOTPLUG)) { virtio_scsi_push_event(s, sd, VIRTIO_SCSI_T_TRANSPORT_RESET, VIRTIO_SCSI_EVT_RESET_RESCAN); @@ -783,7 +783,7 @@ static void virtio_scsi_hotunplug(HotplugHandler *hotplug_dev, DeviceState *dev, VirtIOSCSI *s = VIRTIO_SCSI(vdev); SCSIDevice *sd = SCSI_DEVICE(dev); - if (virtio_has_feature(vdev, VIRTIO_SCSI_F_HOTPLUG)) { + if (virtio_vdev_has_feature(vdev, VIRTIO_SCSI_F_HOTPLUG)) { virtio_scsi_push_event(s, sd, VIRTIO_SCSI_T_TRANSPORT_RESET, VIRTIO_SCSI_EVT_RESET_REMOVED); diff --git a/hw/virtio/dataplane/vring.c b/hw/virtio/dataplane/vring.c index 5c7b8c2..023ec83 100644 --- a/hw/virtio/dataplane/vring.c +++ b/hw/virtio/dataplane/vring.c @@ -105,7 +105,7 @@ void vring_teardown(Vring *vring, VirtIODevice *vdev, int n) /* Disable guest->host notifies */ void vring_disable_notification(VirtIODevice *vdev, Vring *vring) { - if (!virtio_has_feature(vdev, VIRTIO_RING_F_EVENT_IDX)) { + if (!virtio_vdev_has_feature(vdev, VIRTIO_RING_F_EVENT_IDX)) { vring_set_used_flags(vdev, vring, VRING_USED_F_NO_NOTIFY); } } @@ -116,7 +116,7 @@ void vring_disable_notification(VirtIODevice *vdev, Vring *vring) */ bool vring_enable_notification(VirtIODevice *vdev, Vring *vring) { - if (virtio_has_feature(vdev, VIRTIO_RING_F_EVENT_IDX)) { + if (virtio_vdev_has_feature(vdev, VIRTIO_RING_F_EVENT_IDX)) { vring_avail_event(&vring->vr) = vring->vr.avail->idx; } else { vring_clear_used_flags(vdev, vring, VRING_USED_F_NO_NOTIFY); @@ -135,12 +135,12 @@ bool vring_should_notify(VirtIODevice *vdev, Vring *vring) * interrupts. */ smp_mb(); - if (virtio_has_feature(vdev, VIRTIO_F_NOTIFY_ON_EMPTY) && + if (virtio_vdev_has_feature(vdev, VIRTIO_F_NOTIFY_ON_EMPTY) && unlikely(!vring_more_avail(vdev, vring))) { return true; } - if (!virtio_has_feature(vdev, VIRTIO_RING_F_EVENT_IDX)) { + if (!virtio_vdev_has_feature(vdev, VIRTIO_RING_F_EVENT_IDX)) { return !(vring_get_avail_flags(vdev, vring) & VRING_AVAIL_F_NO_INTERRUPT); } @@ -401,7 +401,7 @@ int vring_pop(VirtIODevice *vdev, Vring *vring, /* On success, increment avail index. */ vring->last_avail_idx++; - if (virtio_has_feature(vdev, VIRTIO_RING_F_EVENT_IDX)) { + if (virtio_vdev_has_feature(vdev, VIRTIO_RING_F_EVENT_IDX)) { vring_avail_event(&vring->vr) = vring->last_avail_idx; } diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c index 95b0643..912609c 100644 --- a/hw/virtio/virtio-balloon.c +++ b/hw/virtio/virtio-balloon.c @@ -70,7 +70,7 @@ static inline void reset_stats(VirtIOBalloon *dev) static bool balloon_stats_supported(const VirtIOBalloon *s) { VirtIODevice *vdev = VIRTIO_DEVICE(s); - return virtio_has_feature(vdev, VIRTIO_BALLOON_F_STATS_VQ); + return virtio_vdev_has_feature(vdev, VIRTIO_BALLOON_F_STATS_VQ); } static bool balloon_stats_enabled(const VirtIOBalloon *s) diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index 3c6e430..a17920f 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -217,7 +217,7 @@ static inline void vring_set_avail_event(VirtQueue *vq, uint16_t val) void virtio_queue_set_notification(VirtQueue *vq, int enable) { vq->notification = enable; - if (virtio_has_feature(vq->vdev, VIRTIO_RING_F_EVENT_IDX)) { + if (virtio_vdev_has_feature(vq->vdev, VIRTIO_RING_F_EVENT_IDX)) { vring_set_avail_event(vq, vring_avail_idx(vq)); } else if (enable) { vring_used_flags_unset_bit(vq, VRING_USED_F_NO_NOTIFY); @@ -468,7 +468,7 @@ int virtqueue_pop(VirtQueue *vq, VirtQueueElement *elem) max = vq->vring.num; i = head = virtqueue_get_head(vq, vq->last_avail_idx++); - if (virtio_has_feature(vdev, VIRTIO_RING_F_EVENT_IDX)) { + if (virtio_vdev_has_feature(vdev, VIRTIO_RING_F_EVENT_IDX)) { vring_set_avail_event(vq, vq->last_avail_idx); } @@ -826,12 +826,12 @@ static bool vring_notify(VirtIODevice *vdev, VirtQueue *vq) /* We need to expose used array entries before checking used event. */ smp_mb(); /* Always notify when queue is empty (when feature acknowledge) */ - if (virtio_has_feature(vdev, VIRTIO_F_NOTIFY_ON_EMPTY) && + if (virtio_vdev_has_feature(vdev, VIRTIO_F_NOTIFY_ON_EMPTY) && !vq->inuse && vring_avail_idx(vq) == vq->last_avail_idx) { return true; } - if (!virtio_has_feature(vdev, VIRTIO_RING_F_EVENT_IDX)) { + if (!virtio_vdev_has_feature(vdev, VIRTIO_RING_F_EVENT_IDX)) { return !(vring_avail_flags(vq) & VRING_AVAIL_F_NO_INTERRUPT); } diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h index d95f8b6..28ffdd8 100644 --- a/include/hw/virtio/virtio.h +++ b/include/hw/virtio/virtio.h @@ -231,15 +231,16 @@ static inline void virtio_clear_feature(uint32_t *features, unsigned int fbit) *features &= ~(1 << fbit); } -static inline bool __virtio_has_feature(uint32_t features, unsigned int fbit) +static inline bool virtio_has_feature(uint32_t features, unsigned int fbit) { assert(fbit < 32); return !!(features & (1 << fbit)); } -static inline bool virtio_has_feature(VirtIODevice *vdev, unsigned int fbit) +static inline bool virtio_vdev_has_feature(VirtIODevice *vdev, + unsigned int fbit) { - return __virtio_has_feature(vdev->guest_features, fbit); + return virtio_has_feature(vdev->guest_features, fbit); } static inline bool virtio_is_big_endian(VirtIODevice *vdev)
Commit ef546f1275f6563e8934dd5e338d29d9f9909ca6 ("virtio: add feature checking helpers") introduced a helper __virtio_has_feature. We don't want to use reserved identifiers, though, so let's rename __virtio_has_feature to virtio_has_feature and virtio_has_feature to virtio_vdev_has_feature. Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com> --- hw/block/virtio-blk.c | 5 +++-- hw/char/virtio-serial-bus.c | 2 +- hw/net/virtio-net.c | 22 +++++++++++----------- hw/scsi/virtio-scsi.c | 8 ++++---- hw/virtio/dataplane/vring.c | 10 +++++----- hw/virtio/virtio-balloon.c | 2 +- hw/virtio/virtio.c | 8 ++++---- include/hw/virtio/virtio.h | 7 ++++--- 8 files changed, 33 insertions(+), 31 deletions(-)