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>; + }; diff --git a/qcom/kalama-vm.dtsi b/qcom/kalama-vm.dtsi index 40e00188..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"; }; @@ -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" diff --git a/qcom/kalama.dtsi b/qcom/kalama.dtsi index a3bf22b7..8fd58e42 100644 --- a/qcom/kalama.dtsi +++ b/qcom/kalama.dtsi @@ -679,6 +679,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"; @@ -1490,6 +1499,7 @@ compatible = "qcom,mem-buf"; qcom,mem-buf-capabilities = "supplier"; qcom,vmid = <3>; + memory-region = <&mem_buf_cma>; }; qcom,mem-buf-msgq {