diff options
author | Xuan Zhuo <xuanzhuo@linux.alibaba.com> | 2022-11-14 11:58:17 +0800 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2022-11-23 09:28:54 +0100 |
commit | 5ea5c64c20e97e962c520af3f4e413d4b1b98dea (patch) | |
tree | 5c70febfc08f0fbf7b1b1f86d7b7290862f8bc70 | |
parent | 61e901bbaadf63080ac6a3911bd29da1308a0751 (diff) | |
download | seabios-5ea5c64c20e97e962c520af3f4e413d4b1b98dea.tar.gz |
virtio-mmio: read/write the hi 32 features for mmio
Under mmio, when we read the feature from the device, we should read the
high 32-bit part. Similarly, when writing the feature back, we should
also write back the high 32-bit feature.
Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Message-Id: <20221114035818.109511-2-xuanzhuo@linux.alibaba.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
-rw-r--r-- | src/hw/virtio-pci.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/hw/virtio-pci.c b/src/hw/virtio-pci.c index 213c4977..89a4f505 100644 --- a/src/hw/virtio-pci.c +++ b/src/hw/virtio-pci.c @@ -193,7 +193,8 @@ u64 vp_get_features(struct vp_device *vp) if (vp->use_mmio) { vp_write(&vp->common, virtio_mmio_cfg, device_feature_select, 0); f0 = vp_read(&vp->common, virtio_mmio_cfg, device_feature); - f1 = 0; + vp_write(&vp->common, virtio_mmio_cfg, device_feature_select, 1); + f1 = vp_read(&vp->common, virtio_mmio_cfg, device_feature); } else if (vp->use_modern) { vp_write(&vp->common, virtio_pci_common_cfg, device_feature_select, 0); f0 = vp_read(&vp->common, virtio_pci_common_cfg, device_feature); @@ -214,8 +215,10 @@ void vp_set_features(struct vp_device *vp, u64 features) f1 = features >> 32; if (vp->use_mmio) { - vp_write(&vp->common, virtio_mmio_cfg, guest_feature_select, f0); + vp_write(&vp->common, virtio_mmio_cfg, guest_feature_select, 0); vp_write(&vp->common, virtio_mmio_cfg, guest_feature, f0); + vp_write(&vp->common, virtio_mmio_cfg, guest_feature_select, 1); + vp_write(&vp->common, virtio_mmio_cfg, guest_feature, f1); } else if (vp->use_modern) { vp_write(&vp->common, virtio_pci_common_cfg, guest_feature_select, 0); vp_write(&vp->common, virtio_pci_common_cfg, guest_feature, f0); |