Skip to content

Commit 99e0d04

Browse files
committed
virtio_mem: convert to LE accessors
Virtio mem is modern-only. Use LE accessors for config space. Signed-off-by: Michael S. Tsirkin <[email protected]>
1 parent 115a71d commit 99e0d04

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

drivers/virtio/virtio_mem.c

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1530,21 +1530,21 @@ static void virtio_mem_refresh_config(struct virtio_mem *vm)
15301530
uint64_t new_plugged_size, usable_region_size, end_addr;
15311531

15321532
/* the plugged_size is just a reflection of what _we_ did previously */
1533-
virtio_cread(vm->vdev, struct virtio_mem_config, plugged_size,
1534-
&new_plugged_size);
1533+
virtio_cread_le(vm->vdev, struct virtio_mem_config, plugged_size,
1534+
&new_plugged_size);
15351535
if (WARN_ON_ONCE(new_plugged_size != vm->plugged_size))
15361536
vm->plugged_size = new_plugged_size;
15371537

15381538
/* calculate the last usable memory block id */
1539-
virtio_cread(vm->vdev, struct virtio_mem_config,
1540-
usable_region_size, &usable_region_size);
1539+
virtio_cread_le(vm->vdev, struct virtio_mem_config,
1540+
usable_region_size, &usable_region_size);
15411541
end_addr = vm->addr + usable_region_size;
15421542
end_addr = min(end_addr, phys_limit);
15431543
vm->last_usable_mb_id = virtio_mem_phys_to_mb_id(end_addr) - 1;
15441544

15451545
/* see if there is a request to change the size */
1546-
virtio_cread(vm->vdev, struct virtio_mem_config, requested_size,
1547-
&vm->requested_size);
1546+
virtio_cread_le(vm->vdev, struct virtio_mem_config, requested_size,
1547+
&vm->requested_size);
15481548

15491549
dev_info(&vm->vdev->dev, "plugged size: 0x%llx", vm->plugged_size);
15501550
dev_info(&vm->vdev->dev, "requested size: 0x%llx", vm->requested_size);
@@ -1677,16 +1677,16 @@ static int virtio_mem_init(struct virtio_mem *vm)
16771677
}
16781678

16791679
/* Fetch all properties that can't change. */
1680-
virtio_cread(vm->vdev, struct virtio_mem_config, plugged_size,
1681-
&vm->plugged_size);
1682-
virtio_cread(vm->vdev, struct virtio_mem_config, block_size,
1683-
&vm->device_block_size);
1684-
virtio_cread(vm->vdev, struct virtio_mem_config, node_id,
1685-
&node_id);
1680+
virtio_cread_le(vm->vdev, struct virtio_mem_config, plugged_size,
1681+
&vm->plugged_size);
1682+
virtio_cread_le(vm->vdev, struct virtio_mem_config, block_size,
1683+
&vm->device_block_size);
1684+
virtio_cread_le(vm->vdev, struct virtio_mem_config, node_id,
1685+
&node_id);
16861686
vm->nid = virtio_mem_translate_node_id(vm, node_id);
1687-
virtio_cread(vm->vdev, struct virtio_mem_config, addr, &vm->addr);
1688-
virtio_cread(vm->vdev, struct virtio_mem_config, region_size,
1689-
&vm->region_size);
1687+
virtio_cread_le(vm->vdev, struct virtio_mem_config, addr, &vm->addr);
1688+
virtio_cread_le(vm->vdev, struct virtio_mem_config, region_size,
1689+
&vm->region_size);
16901690

16911691
/*
16921692
* We always hotplug memory in memory block granularity. This way,

0 commit comments

Comments
 (0)