# SPDX-License-Identifier: GPL-2.0
config ION_SYSTEM_HEAP
	tristate "Ion system heap"
	depends on ION
	help
	  Choose this option to enable the Ion system heap. The system heap
	  is backed by pages from the buddy allocator. If in doubt, say Y.

config ION_CARVEOUT_HEAP
	bool "Ion carveout heap support"
	depends on ION
	help
	  Choose this option to enable carveout heaps with Ion. Carveout heaps
	  are backed by memory reserved from the system. Allocation times are
	  typically faster at the cost of memory not being used. Unless you
	  know your system has these regions, you should say N here.

config ION_CMA_HEAP
	tristate "Ion CMA heap support"
	depends on ION && DMA_CMA
	help
	  Choose this option to enable CMA heaps with Ion. This heap is backed
	  by the Contiguous Memory Allocator (CMA). If your system has these
	  regions, you should say Y here.

config ION_MSM_HEAPS
	tristate "MSM platform-based Ion heaps support"
	depends on ION
	help
	  Enable this option to enable platform-based Ion heaps. The heaps
          will register with the Ion core framework, at which point userspace
          clients can allocate different types of memory (e.g. secure, cached,
          and uncached) from the different types of heaps. The MSM heaps
          allow Ion buffers to be shared through the shared DMA buffer framework
          and the heaps implement their own cache maintenance operations.
          If you're not sure, enable here.

config ION_FORCE_DMA_SYNC
	bool "Force ION to always DMA sync buffer memory"
	depends on ION
	help
	  Force ION to DMA sync buffer memory when it is allocated and to
	  always DMA sync the buffer memory on calls to begin/end cpu
	  access. This makes ION DMA sync behavior similar to that of the
	  older version of ION.
	  We generally don't want to enable this config as it breaks the
	  cache maintenance model.
	  If you're not sure say N here.

config ION_DEFER_FREE_NO_SCHED_IDLE
	bool "Increases the priority of ION defer free thread"
	depends on ION
	help
	  Certain heaps such as the system heaps make use of a low priority
	  thread to help free buffer allocations back to the pool which might
	  result in future allocations requests going to the buddy instead of
	  the pool when there is a high buffer allocation rate.
	  Choose this option to remove the SCHED_IDLE flag in case of defer
	  free thereby increasing the priority of defer free thread.
	  if you're not sure say Y here.

config ION_POOL_AUTO_REFILL
	bool "Refill the ION heap pools automatically"
	depends on ION && QGKI && ION_MSM_HEAPS=y
	help
	  Choose this option to refill the ION system heap pools (non-secure)
	  automatically when the pool pages count becomes lower than a set low mark.
	  This refilling is done by worker thread which is invoked asynchronously
	  when the pool count reaches below low mark.
	  if you're not sure say Y here.

config ION_POOL_FILL_MARK
	int "ion pool fillmark size in MB"
	depends on ION_POOL_AUTO_REFILL
	range 16 256
	default 100
	help
	  Set the fillmark of the pool in terms of mega bytes and the lowmark is
	  ION_POOL_LOW_MARK_PERCENT of fillmark value.

config ALLOC_BUFFERS_IN_4K_CHUNKS
	bool "Turns off allocation optimization and allocate only 4K pages"
	depends on ARCH_QCOM && ION
	help
	  Choose this option if you want ION to allocate buffers in only 4KB chunks.

config ION_DEBUGGING
    bool "ion allocation owner and size for debugging"
	depends on ION
	help
	  Choose this option if you want to debug ion owner and size.
	  cat /sys/kernel/debug/ion/system/system_stats

config ION_DEBUGGING_PROCFS
	bool "ion debugging with /proc/ioninfo"
	depends on ION_DEBUGGING
	help
	  Choose this option to debug with /proc/ioninfo. R OS doesn't support debugfs
	  and need to debug ion memory. Instead of debugfs, procfs will be added.
