mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 00:33:55 -06:00
tests: rename target_big_endian() as qvirtio_is_big_endian()
Move the definition to libqos/virtio.h as it must be used only with virtio functions. Add a QVirtioDevice parameter as it will be needed to know if the virtio device is using virtio 1.0 specification and thus is always little-endian (to do) Signed-off-by: Laurent Vivier <lvivier@redhat.com> Reviewed-by: Greg Kurz <groug@kaod.org> Reviewed-by: Thomas Huth <thuth@redhat.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
parent
6b9cdf4cf1
commit
8b4b80c376
4 changed files with 25 additions and 29 deletions
|
@ -86,7 +86,7 @@ static uint64_t qvirtio_pci_config_readq(QVirtioDevice *d, uint64_t addr)
|
|||
int i;
|
||||
uint64_t u64 = 0;
|
||||
|
||||
if (target_big_endian()) {
|
||||
if (qvirtio_is_big_endian(d)) {
|
||||
for (i = 0; i < 8; ++i) {
|
||||
u64 |= (uint64_t)qpci_io_readb(dev->pdev,
|
||||
(void *)(uintptr_t)addr + i) << (7 - i) * 8;
|
||||
|
|
|
@ -89,6 +89,12 @@ struct QVirtioBus {
|
|||
void (*virtqueue_kick)(QVirtioDevice *d, QVirtQueue *vq);
|
||||
};
|
||||
|
||||
static inline bool qvirtio_is_big_endian(QVirtioDevice *d)
|
||||
{
|
||||
/* FIXME: virtio 1.0 is always little-endian */
|
||||
return qtest_big_endian(global_qtest);
|
||||
}
|
||||
|
||||
static inline uint32_t qvring_size(uint32_t num, uint32_t align)
|
||||
{
|
||||
return ((sizeof(struct vring_desc) * num + sizeof(uint16_t) * (3 + num)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue