Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions drivers/virtio/virtio_mem.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,14 @@ struct virtio_mem {
uint64_t requested_size;

/* The device block size (for communicating with the device). */
uint32_t device_block_size;
uint64_t device_block_size;
/* The translated node id. NUMA_NO_NODE in case not specified. */
int nid;
/* Physical start address of the memory region. */
uint64_t addr;

/* The subblock size. */
uint32_t subblock_size;
uint64_t subblock_size;
/* The number of subblocks per memory block. */
uint32_t nb_sb_per_mb;

Expand Down Expand Up @@ -1713,9 +1713,9 @@ static int virtio_mem_init(struct virtio_mem *vm)
* - At least the device block size.
* In the worst case, a single subblock per memory block.
*/
vm->subblock_size = PAGE_SIZE * 1u << max_t(uint32_t, MAX_ORDER - 1,
pageblock_order);
vm->subblock_size = max_t(uint32_t, vm->device_block_size,
vm->subblock_size = PAGE_SIZE * 1ul << max_t(uint32_t, MAX_ORDER - 1,
pageblock_order);
vm->subblock_size = max_t(uint64_t, vm->device_block_size,
vm->subblock_size);
vm->nb_sb_per_mb = memory_block_size_bytes() / vm->subblock_size;

Expand All @@ -1727,12 +1727,12 @@ static int virtio_mem_init(struct virtio_mem *vm)

dev_info(&vm->vdev->dev, "start address: 0x%llx", vm->addr);
dev_info(&vm->vdev->dev, "region size: 0x%llx", region_size);
dev_info(&vm->vdev->dev, "device block size: 0x%x",
vm->device_block_size);
dev_info(&vm->vdev->dev, "device block size: 0x%llx",
(unsigned long long)vm->device_block_size);
dev_info(&vm->vdev->dev, "memory block size: 0x%lx",
memory_block_size_bytes());
dev_info(&vm->vdev->dev, "subblock size: 0x%x",
vm->subblock_size);
dev_info(&vm->vdev->dev, "subblock size: 0x%llx",
(unsigned long long)vm->subblock_size);

return 0;
}
Expand Down
4 changes: 2 additions & 2 deletions include/uapi/linux/virtio_mem.h
Original file line number Diff line number Diff line change
Expand Up @@ -182,10 +182,10 @@ struct virtio_mem_resp {

struct virtio_mem_config {
/* Block size and alignment. Cannot change. */
__u32 block_size;
__u64 block_size;
/* Valid with VIRTIO_MEM_F_ACPI_PXM. Cannot change. */
__u16 node_id;
__u16 padding;
__u8 padding[6];
/* Start address of the memory region. Cannot change. */
__u64 addr;
/* Region size (maximum). Cannot change. */
Expand Down