From 247c7f20b57aef6eb12eec7d54a5dbce2ce13996 Mon Sep 17 00:00:00 2001 From: Patrick Daly Date: Tue, 28 Jun 2022 22:04:11 -0700 Subject: [PATCH 1/4] bindings: Document qcom,virtio-mem device Document current properties of the qcom,virtio-mem device. Change-Id: I210961afe6a07cdd6fe13b72413e774bad8cecb9 --- bindings/virtio/qcom,virtio-mem.yaml | 35 ++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 bindings/virtio/qcom,virtio-mem.yaml diff --git a/bindings/virtio/qcom,virtio-mem.yaml b/bindings/virtio/qcom,virtio-mem.yaml new file mode 100644 index 00000000..87aec660 --- /dev/null +++ b/bindings/virtio/qcom,virtio-mem.yaml @@ -0,0 +1,35 @@ +%YAML 1.2 +--- +$id: "http://devicetree.org/schemas/soc/qcom/qcom,secure-buffer.yaml#" +$schema: "http://devicetree.org/meta-schemas/core.yaml#" + +title: Qualcomm Technologies, Inc. Virtio-Mem bindings + +description: | + QCOM virtio mem driver supports Guest initiated memory hotplug operations + which transfer memory from Host to Guest. + +properties: + compatible: + items: + - const: qcom,virtio-mem + + reg: + description: + Physical address and size of hotpluggable region. Must be aligned + to memory_block_size_bytes() - 128 Mb on arm64. + + qcom,block_size: + description: + Minimum transfer size in bytes. Should be multiple of PAGE_SIZE. + +required: + - compatible + - qcom,block-size + +example: + virtio_mem_device { + compatible = "qcom,virtio-mem"; + reg = <0x60000000 0x10000000>; + qcom,block_size = <0x400000>; + }; From b6a46f974eac1162b173b9319f911ed695937f0e Mon Sep 17 00:00:00 2001 From: Patrick Daly Date: Tue, 28 Jun 2022 22:04:16 -0700 Subject: [PATCH 2/4] ARM: dts: msm: Add qcom,virtio-mem device on kalama-vm The qcom,virtio-mem device allows clients to request addtional memory be added to the system via memory hotplug. The memory is sourced from primary VM. Change-Id: I3300c0899b28b451252fef8c8d7df7099822e4c6 --- qcom/kalama-vm.dtsi | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/qcom/kalama-vm.dtsi b/qcom/kalama-vm.dtsi index 40e00188..cda0f343 100644 --- a/qcom/kalama-vm.dtsi +++ b/qcom/kalama-vm.dtsi @@ -628,6 +628,12 @@ qcom,support-hypervisor; }; + virtio_mem_device { + compatible = "qcom,virtio-mem"; + /* Must be memory_block_size_bytes() aligned */ + reg = <0x60000000 0x8000000>; + qcom,block-size = <0x400000>; + }; }; #include "msm-arm-smmu-kalama-vm.dtsi" From 6eda382a324d1f598006ec45d9e82fb89aeacfff Mon Sep 17 00:00:00 2001 From: Patrick Daly Date: Tue, 28 Jun 2022 22:04:23 -0700 Subject: [PATCH 3/4] ARM: dts: msm: Add mem_buf_cma region for kalama Add a cma regions for use by the mem-buf driver for hotplugging additional memory to TUIVM. Change-Id: I4eff46465b82425f60b68d4bc2d81e5da7e5e560 --- qcom/kalama.dtsi | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/qcom/kalama.dtsi b/qcom/kalama.dtsi index 911834b0..cd66d43b 100644 --- a/qcom/kalama.dtsi +++ b/qcom/kalama.dtsi @@ -669,6 +669,15 @@ mem-type = <2>; }; + mem_buf_cma: mem_buf_cma { + compatible = "shared-dma-pool"; + alloc-ranges = <0x1 0x00000000 0xfffffffe 0xffffffff>; + reusable; + alignment = <0x0 0x400000>; + /* 16 Mb */ + size = <0x0 0x1000000>; + }; + /* global autoconfigured region for contiguous allocations */ system_cma: linux,cma { compatible = "shared-dma-pool"; @@ -1480,6 +1489,7 @@ compatible = "qcom,mem-buf"; qcom,mem-buf-capabilities = "supplier"; qcom,vmid = <3>; + memory-region = <&mem_buf_cma>; }; qcom,mem-buf-msgq { From 82c012d10eb5c5266ba5975c368de7eba4adb327 Mon Sep 17 00:00:00 2001 From: Patrick Daly Date: Tue, 28 Jun 2022 22:04:31 -0700 Subject: [PATCH 4/4] ARM: dts: msm: Online memory blocks as movable by default Online hotplugged memory blocks to movable zone automatically. Change-Id: I4e6d9eed19bd81c34d66fc160140034b0f481f68 --- qcom/kalama-vm.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qcom/kalama-vm.dtsi b/qcom/kalama-vm.dtsi index cda0f343..0b807655 100644 --- a/qcom/kalama-vm.dtsi +++ b/qcom/kalama-vm.dtsi @@ -19,7 +19,7 @@ }; chosen { - bootargs = "nokaslr log_buf_len=256K root=/dev/ram rw init=/init console=hvc0 loglevel=8"; + bootargs = "nokaslr log_buf_len=256K root=/dev/ram rw init=/init console=hvc0 loglevel=8 memhp_default_state=online_movable"; };