Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 87584a45 authored by David Dai's avatar David Dai Committed by Gerrit - the friendly Code Review server
Browse files

msm: msm_bus: Add snapshot of msm_bus driver



Initial port of msm bus codebase into new kernel version from msm-4.4,
commit f600d8b9ec91f ("msm-core: Move get_user out side critical section")

Change-Id: I596f206fc841f46ac08b963093680df26255917c
Signed-off-by: default avatarDavid Dai <daidavid1@codeaurora.org>
parent 305908c1
Loading
Loading
Loading
Loading
+258 −0
Original line number Original line Diff line number Diff line
MSM Bus Devices

The bus devices (fabrics/NoCs) are the interconnects between various
components on chipsets. These devices form the backbone of the chip
topology. Entire topology of the chipset is built using the
device-tree data of these bus devices.

To add the bus devices following properties are required:

compatible:		The bus devices need to be compatible with
			msm-bus-fabric
cell-id:		A 32 bit integer unique per bus per chipset. The IDs
			for buses are in multiples of 1024.
label:			Bus name
qcom,fabclk-dual:	Dual set (active/sleep) bus clock name
qcom,fabclk-active:	Active set bus clock name
qcom,nfab:		An integer property which specifies the total number
			of buses on the chipset.

The following properties are optional as a bus might not support
these features:

qcom,ntieredslaves:	Number of tiered slaves on the bus.
qcom,qos-freq:		QoS frequency (In KHz)
qcom,hw-sel:		A string which decides whether QoS data
			should be sent to RPM, set using BIMC or NoCs.
			It can be set to "RPM", "NoC" or "BIMC".
qcom,qos-baseoffset:	Base address offset of QoS registers from the bus device
			base address.
qcom,qos-delta:	 	Address delta between QoS registers of different masters.
qcom,rpm-en:		A boolean flag indicating whether RPM transactions are
			supported for nodes of the bus.
qcom,ahb:		A boolean flag indicating whether the bus is ahb type.
qcom,virt:		A boolean property indicating this is a virtual bus.
reg:			Register space of the bus device. Not required in case
			the bus is virtual.
qom,nr-lim-thresh	The threshold below which to apply throttling of non
			real time masters.
qcom,eff-fact		The DDR effeciency factor to be assumed. This only
			comes into play for buses that connect to the DDR.


The following properties are optional as collecting data via coresight might
not be supported for every bus. The documentation for coresight properties
can be found in:
Documentation/devicetree/bindings/coresight/coresight.txt

coreisght-id		Unique integer identifier for the bus.
coresight-name		Unique descriptive name of the bus.
coresight-nr-inports	Number of input ports on the bus.
coresight-outports	List of output port numbers on the bus.
coresight-child-list	List of phandles pointing to the children of this
			component.
coresight-child-ports	List of input port numbers of the children.


Any interconnect on the bus is represented as a child node.
A child node can be of type: master, slave or a gateway.
A gateway is an interconnect between buses and can be of both
master and slave type.

The following properties are available to characterize a child node.
The properties can be chosen depending on the type of child node.

cell-id:		For a master the ID is between 0 - 512
			For a slave the ID is between 512 - 1024
label:			Name of the master/slave/gateway
qcom,masterp:		Hardware master port number(s)
qcom,tier:		The tier to which a master/slave belongs.
			Note that tiering might not be supported on
			all architectures.
qcom,hw-sel:		A string which decides whether QoS data should be sent
			to RPM, set using BIMC or NoCs.
			It can be set to "RPM", "NoC" or "BIMC".
qcom,mode:		Used for masters on NoC/BIMC. Indicates which of the
			four modes (Fixed/Limiter/Bypass/Regulator) the master
			belongs to.
qcom,perm-mode:		Permissible mode switches. Indicates which of the four
			modes are supported of the master node. Generally,
			modes are set at boot-up and not switched at run-time.
qcom,qport:		QoS port number. This can be different from the
			master-port number.
qcom,ws:		Window size (in Hz), used for NoC/BIMC masters to
			calculate saturation values.
qcom,mas-hw-id:		A unique hardware ID agreed upon by processors across
			the system. This ID is assigned to every master. It can
			be used to send master specific data from
			Apps/Modem/LPASS to RPM.
qcom,slv-hw-id:		A unique hardware ID agreed upon by processors across
			the system. This ID is assigned to every slave. It can
			be used to send slave specific data from
qcom,slaveclk-dual:	Dual set (active/sleep) slave clock name
qcom,slaveclk-active:	Active set slave clock name
			Apps/Modem/LPASS to RPM.
qcom,gateway:		Flag indicating whether a particular node is a gateway.
qcom,slavep:		Hardware slave port number(s).
qcom,buswidth:		Width of the interconnect between a node and the bus.
			(In Bytes).
qcom,prio-rd:		Read priority for a BIMC bus master (Can be 0/1/2)
qcom,prio-wr:		Write priority for a BIMC bus master (Can be 0/1/2)
qcom,prio0:		Priority low signal for a NoC bus master
			(Can be 0/1/2).
qcom,prio1:		Priority high signal for a NoC bus master
			(Can be 0/1/2)
qcom,dual-conf:		Indicates whether a BIMC/NoC master can be configured
			in multiple modes at run-time. (Boolean)
qcom,mode-thresh:	Threshold mode for a BIMC/NoC master. Beyond a certain
			threshold frequency, a threshold mode can be used.
			(Can be Fixed/Limiter/Bypass/Regulator)
qcom,bimc,bw:		Bandwidth limit for a BIMC master using dual modes.
			This bandwidth is used to calculate Grant count and
			other parameters used in Limiter and Regular mode.
			for static BKE configuration. It is defined in KBytes/s.
qcom,bimc,gp:		Grant Period for configuring a master in limiter
			mode. This is an integer value in nano-seconds.
qcom,bimc,thmp:		Medium threshold percentage for BIMC masters.
			This percentage is used to calculate medium threshold
			value for BIMC Masters in Limiter mode for static
			configuration. This can be any integer value between
			1 and 100.
qcom,thresh:		Beyond this threshold frequency, the mode usage is
			switched from mode specified by property qcom,mode
			to the one specified by qcom,mode-thresh. These thresholds
			can be setup in increasing order of thresholds, so the
			requested IB is evaluated at each threshold level before
			making the decision to switch QoS modes and applying the
			corresponding qcom,bimc,bw limitig bw as needed.
			This is specified in KBytes/s.
qcom,rt-mas:		Indicates if a master node is a realtime master with
			hard deadlines.
qcom,nr-lim:		Indicates that this is non-real time master which can
			be throttled in case of concurrent scenarios.
qcom,floor-bw:		Represents the floor bandwidth below which this master
			cannot be throttled. This floor bandwidth is specified in
			KBytes/s.
qcom,ff:		The fudge factor used by clients when voting for
			bandwidth from the node.



Example:


	msm-mmss-noc@fc478000 {
		compatible = "msm-bus-fabric";
		reg = <0xfc478000 0x00004000>;
		cell-id = <2048>;
		label = "msm_mmss_noc";
		qcom,fabclk-dual = "bus_clk";
		qcom,fabclk-active = "bus_a_clk";
		qcom,ntieredslaves = <0>;
		qcom,qos-freq = <4800>;
		qcom,hw-sel = "NoC";
		qcom,rpm-en;
		qcom,nfab = <6>;

		mas-gfx3d {
			cell-id = <26>;
			label = "mas-gfx3d";
			qcom,masterp = <2 3>;
			qcom,tier = <2>;
			qcom,hw-sel = "NoC";
			qcom,perm-mode = "Bypass";
			qcom,mode = "Bypass";
			qcom,ws = <10000>;
			qcom,qport = <2 3>;
			qcom,mas-hw-id = <6>;
		};

		mas-jpeg {
			cell-id = <62>;
			label = "mas-jpeg";
			qcom,masterp = <4>;
			qcom,tier = <2>;
			qcom,hw-sel = "NoC";
			qcom,perm-mode = "Bypass";
			qcom,mode = "Bypass";
			qcom,qport = <0>;
			qcom,ws = <10000>;
			qcom,mas-hw-id = <7>;
		};
	};

	msm-bimc@0xfc380000 {
		compatible = "msm-bus-fabric";
		reg = <0xfc380000 0x0006A000>;
		cell-id = <0>;
		label = "msm_bimc";
		qcom,fabclk-dual = "mem_clk";
		qcom,fabclk-active = "mem_a_clk";
		qcom,ntieredslaves = <0>;
		qcom,qos-freq = <19200>;
		qcom,hw-sel = "BIMC";
		qcom,rpm-en;

		coresight-id = <55>;
		coresight-name = "coresight-bimc";
		coresight-nr-inports = <0>;
		coresight-outports = <0>;
		coresight-child-list = <&funnel_in1>;
		coresight-child-ports = <3>;

		mas-ampss-m0 {
			cell-id = <1>;
			label = "mas-ampss-m0";
			qcom,masterp = <0>;
			qcom,tier = <2>;
			qcom,hw-sel = "BIMC";
			qcom,mode = "Limiter";
			qcom,qport = <0>;
			qcom,ws = <10000>;
			qcom,mas-hw-id = <0>;
			qcom,prio-rd = <0>;
			qcom,prio-wr = <0>;
			qcom,mode-thresh = "Fixed";
			qcom,thresh = <2000000>;
			qcom,dual-conf;
			qcom,bimc,bw = <300000>;
			qcom,bimc,gp = <5>;
			qcom,bimc,thmp = <50>;
		};
	};




The bus scaling driver also provides the ability to configure
bus performance parameters across the entire chip-set.
Various clients use MSM scaling APIs to request bandwidth
between multiple master-slave pairs. The bus driver then finds
the optimal path between the master and the slave, and aggregates
the bandwidth and clock requests for all master-slave pairs on
that path, and programs hardware accordingly.

The device-tree data required for bus-scaling can be embedded within
the clients' device nodes. The clients can register with the bus driver
using the following properties:

- qcom,msm-bus,name:		String representing the client-name
- qcom,msm-bus,num-cases:	Total number of usecases
- qcom,msm-bus,active-only:	Boolean context flag for requests in active or
				dual (active & sleep) contex
- qcom,msm-bus,num-paths:	Total number of master-slave pairs
- qcom,msm-bus,vectors-KBps:	Arrays of unsigned integers representing:
				master-id, slave-id, arbitrated bandwidth
				in KBps, instantaneous bandwidth in KBps

Example:

	qcom,msm-bus,name = "client-name";
	qcom,msm-bus,num-cases = <3>;
	qcom,msm-bus,active-only;
	qcom,msm-bus,num-paths = <2>;
	qcom,msm-bus,vectors =
			<22 512 0 0>, <26 512 0 0>,
			<22 512 320000 3200000>, <26 512 3200000 3200000>,
			<22 512 160000 1600000>, <26 512 1600000 1600000>;
+231 −0
Original line number Original line Diff line number Diff line
MSM Bus Devices for adhoc bus topologies

Buses are the interconnects between various devices. The devices are
connected in different topologies. The bus scaling driver accepts
bandwidth requests from clients and ensures that the bandwidth requests
can be met between the source and destination for that client.
In order to accept and honor bandwidth requests the bus scaling driver
needs to know about the bus topology.
This device tree binding represents the bus devices in the SOC, their
connections to other bus devices and the resources associated with each
node. The bus scaling driver uses this device tree to setup the bus
topology in order to apply client bandwidth requests.

The mandatory properties for bus driver are:

compatible:		"qcom,msm-bus-device"

The register space associated with the bus devices are represented with
the following optional properties:
reg:			Register space for a bus device.
reg-name:		Name of the register space for the bus device.

The child nodes represent the devices on the bus.

The following properties are mandatory for a child node

cell-id:		The unique device id of the child node.
			For a master the ID is between 0 - 512
			For a slave the ID is between 512 - 1024
			For internal nodes the range is > 10000
			The range of ids for the different types of child
			devices are chosen for convenience, the only
			requirement is that the id's be unique among the
			child devices.
label:			Unique name of the device.

The following are optional properties for child nodes:


qcom,fab-dev:		Optional boolean parameter that states if the device
			is a fabric device or not.
			Typically these optional properties are used for
			devices that represent fabric devices.
qcom,bypass-qos-prg:	Optional debug parameter to avoid programming the QoS
			HW registers for a given fabric device.
			Typically these optional properties are used for
			devices that represent fabric devices.
qcom,base-name:		Parameter that specifies the physical base address for
			accessing registers associated with the child device.
			Typically these optional properties are used for
			devices that represent fabric devices.
qcom,base-offset:	Parameter that gives the offset from the base address to access
			the QoS registers.
			Typically these optional properties are used for
			devices that represent fabric devices.
qcom,qos-off:		Parameter that represents the delta between QoS register address
			space for different devices.
			Typically these optional properties are used for
			devices that represent fabric devices.
qcom,agg-scheme:	Parameter that represents the aggregation scheme to be used for the
			node. This parameter defaults to LEGACY scheme. The valid options
			are LEGACY/SCHEME_1.
qcom,util-fact:		Parameter that represents the DDR utilization factor to be used in
			LEGACY scheme. It is represented as actual util-factor * 100.
qcom,vrail-comp:	Parameter that represents the voltage rail compensation to push
			the bus to the next level if needed in LEGACY and SCHEME 1 aggregation
			schemes. It is represented as actual vrail-comp * 100.
qcom,util-levels:	Array of tuples that represent a bandwidth threshold and util factor
			to be used uptil the given threshold.
qcom,bus-type:		Parameter that represents the bus type such as BIMC or NOC.
			Typically these optional properties are used for
			devices that represent fabric devices.
bus-gdsc-supply:	Optional fabric device parameter that is a reference to the dual
			context GDSC supply that is needed before clock operations.
bus-a-gdsc-supply:	Optional fabric device parameter that is a reference to an active
			only context GDSC supply that is needed before clock operations.
bus-qos-gdsc-supply:	Optional node or fabric device parameter that is a reference to a GDSC
			supply that is needed before use of the clock needed to program
			QoS registers.
node-gdsc-supply:	Optional node device parameter that is a reference to a GDSC supply
			that is needed before node-clock operations.
qcom,enable-only-clk:   Optional property that is represents if the clock doesn't support
                        the clk_set_rate API and should only be enabled/disabled.
qcom,setrate-only-clk:   Optional property that is indicates that bus driver should only
			set a rate on a clock handle and not call the enable/disable
			clock API.
clock-names:		Optional property that represents the clock name associated
			with the device "bus_clk", "bus_a_clk";
clocks:			Property pair that represents the clock controller and the clock
			id. This in combimination with the clock-name is used to obtain
			the handle for the clock associated with this device.
qcom,virt-dev:		Parameter used for devices that represent virtual devices. Virtual
			devices aren't real devices on the SOC but are used to aggregate
			resources in some special cases.
qcom,qport:		The offset index into the masters QoS register space.
qcom,num-ports:		The number of ports that the device has.
qcom,ap-owned:		Property that states if the device is "owned" by the Apps processor.
			If true then the AP will program the QoS registers for the device
			else it is done by RPM.
qcom,connections:	An array of phandles that represent the devices this device is connected to.;
qcom,bus-dev:		Phandle that represents the fabric device that this child node belongs to.
qcom,qos-mode:		QoS mode to be programmed for this device, only applicable for AP owned resource.
qcom,prio-rd:		Read priority for a BIMC bus master (Can be 0/1/2)
qcom,prio-wr:		Write priority for a BIMC bus master (Can be 0/1/2)
qcom,prio0:		Priority low signal for a NoC bus master
			(Can be 0/1/2).
qcom,reg-prio1:		Regulator mode Priority high signal for a NoC bus master if the master port is in
			regulator QoS mode
qcom,reg-prio0:		Regulator Priority low signal for a NoC bus master if the master port is in
			regulator Qos mode.
			(Can be 0/1/2).
qcom,prio1:		Priority high signal for a NoC bus master
qcom,bw_buffer:		Optional parameter in KBytes used to specify a buffer value that should be added to
			the voted bandwidth value to figure out the limiting bandwidth for a master port.
qcom,buswidth:		The buswidth at the device, default is 8 bytes.
qcom,mas-rpm-id:	For non-AP owned device this is the RPM id for devices that are bus masters.
			This is the id that is used when sending a message to RPM for this device.
qcom,slv-rpm-id:	For non-AP owned device this is the RPM id for devices that are bus slaves.
			This is the id that is used when sending a message to RPM for this device.
qcom,blacklist:         An array of phandles that represent devices that this device
			cannot connect to either directly or via any number of
			intermediate nodes.
qcom,agg-ports:		The number of aggregation ports on the bus.

The following properties are optional as collecting data via coresight might
and are present on child nodes that represent NOC devices. The documentation
for coresight properties can be found in:
Documentation/devicetree/bindings/coresight/coresight.txt

coreisght-id		Unique integer identifier for the bus.
coresight-name		Unique descriptive name of the bus.
coresight-nr-inports	Number of input ports on the bus.
coresight-outports	List of output port numbers on the bus.
coresight-child-list	List of phandles pointing to the children of this
			component.
coresight-child-ports	List of input port numbers of the children.

The following sub-nodes are optional parameters:

qcom,node-qos-clks:	Optional node listing all the clocks and regulators required for programming of
			QoS registers. Usually these are associated with fabric nodes.
	clock-names:	An array of clock names for QoS programming,
	clocks:		An array of clock phandles corresponding to the clock names listed above.
	clock-name-gdsc:
			An optional property listing the regulator associated with a given clock name.

Example:

&ad_hoc_bus {
        compatible = "msm-bus-device";
        reg = <0x580000 0x62000>;
        reg-names = "snoc-base";

        fab_snoc: fab-snoc {
                cell-id = <1024>;
                label = "fab-snoc";
                qcom,fab-dev;
                qcom,bypass-qos-prg;
		qcom,agg-scheme = <SCHEME_1>;
		qcom,util-levels = <450000 133>,
			<750000 154>;
                qcom,base-name = "snoc-base";
                qcom,base-offset = <0x7000>;
                qcom,qos-off = <0x1000>;
                qcom,bus-type = <1>;
                clock-names = "bus_clk", "bus_a_clk";
                clocks = <&clock_rpm  clk_snoc_msmbus_clk>,
                      <&clock_rpm  clk_snoc_msmbus_a_clk>;
		qcom,node-qos-clks {
			clock-names = "q0-clk", "q1-clk";
			clocks = <&clock_gcc clk_q0_clk>,
				<&clock_gcc clk_q1_clk>;
			q0-clk-supply = <&gdsc_q0_clk>;
		};
        };

        mm_int_bimc: mm-int-bimc {
                cell-id = <10003>;
                label = "mm-int-bimc";
		qcom,util-fact = <154>;
		qcom,vrail-comp = <100>;
                qcom,ap-owned;
                qcom,connections = <&snoc_bimc_1_mas>;
                qcom,bus-dev = <&fab_snoc>;
                qcom,buswidth = <16>;
        };

        snoc_int_0: snoc-int-0 {
                cell-id = <10004>;
                label = "snoc-int-0";
                qcom,connections = <&slv_qdss_stm &slv_imem &snoc_pnoc_mas>;
                qcom,bus-dev = <&fab_snoc>;
                qcom,mas-rpm-id = <99>;
                qcom,slv-rpm-id = <130>;
                qcom,buswidth = <8>;
        };
};


The bus scaling driver also provides the ability to configure
bus performance parameters across the entire chip-set.
Various clients use MSM scaling APIs to request bandwidth
between multiple master-slave pairs. The bus driver then finds
the optimal path between the master and the slave, and aggregates
the bandwidth and clock requests for all master-slave pairs on
that path, and programs hardware accordingly.

The device-tree data required for bus-scaling can be embedded within
the clients' device nodes. The clients can register with the bus driver
using the following properties:

- qcom,msm-bus,name:		String representing the client-name
- qcom,msm-bus,num-cases:	Total number of usecases
- qcom,msm-bus,active-only:	Boolean context flag for requests in active or
				dual (active & sleep) contex
- qcom,msm-bus,num-paths:	Total number of master-slave pairs
- qcom,msm-bus,vectors-KBps:	Arrays of unsigned integers representing:
				master-id, slave-id, arbitrated bandwidth
				in KBps, instantaneous bandwidth in KBps

Example:

	qcom,msm-bus,name = "client-name";
	qcom,msm-bus,num-cases = <3>;
	qcom,msm-bus,active-only;
	qcom,msm-bus,num-paths = <2>;
	qcom,msm-bus,vectors =
			<22 512 0 0>, <26 512 0 0>,
			<22 512 320000 3200000>, <26 512 3200000 3200000>,
			<22 512 160000 1600000>, <26 512 1600000 1600000>;
+62 −0
Original line number Original line Diff line number Diff line
MSM Bus static bandwidth rules for adhoc bus topologies

Buses are the interconnects between various devices. The devices are
connected in different topologies. The static bandwidth rules allow
setting up SOC specific rules to monitor certain bandwidth requests
at different bus nodes. When the conditions of the rule are met
the bus driver will be given a list of actions to be take on specific
bus master ports (throttle on/off, what bandwidth to throttle to etc).

The mandatory properties for bus driver are:

compatible:	"qcom,msm-bus-static-bw-rules"

The static_rules node can have numerous rules for the different bandwidth voting
conditions to be monitored. The mandatory properties for the rules are

- qcom,src-nodes:		An array of phandles denoting the source nodes
				whose bandwidth votes need to be monitored.
- qcom,src-field:		This field represents the voted field of the
				source node to be monitored. Possible values
				are FLD_IB/FLD_AB/FLD_CLK
- qcom,src-op:			The operand to be used when evaluating a node's
				bandwidth vote with a threshold.Possible values
				are OP_LE/OP_LT/OP_GT/OP_GE.
- qcom,thresh:			The threshold in Kbytes/s to be used in vote
				evaluation.
- qcom,mode:			The QoS mode to be applied when this rule's
				criterion are satisfied. Possible values are
				THROTTLE_ON/THROTTLE_OFF
- qcom,dest-node:		An array of phandles representing the nodes to
				which the QoS mode is to be applied.

The optional properties for the rule node are:
- qcom,dest-bw:			The destination bandwidth value in Kbytes/s to
				be used toward the QoS mode for the destination
				node.

Example:
	static-rules {
		compatible = "qcom,msm-bus-static-bw-rules";
		#address-cells = <1>;
		#size-cells = <0>;

		rule@0 {
			qcom,src-nodes = <&mas_apss>;
			qcom,src-field = <FLD_IB>;
			qcom,src-op = <OP_LE>;
			qcom,thresh = <1599078>;
			qcom,mode = <THROTTLE_ON>;
			qcom,dest-node = <&mas_apss>;
			qcom,dest-bw = <1599078>;
		};

		rule@1 {
			qcom,src-nodes = <&mas_apss>;
			qcom,src-field = <FLD_IB>;
			qcom,src-op = <OP_GT>;
			qcom,thresh = <1599078>;
			qcom,mode = <THROTTLE_OFF>;
			qcom,dest-node = <&mas_apss>;
		};
	};
+8 −0
Original line number Original line Diff line number Diff line
@@ -184,3 +184,11 @@ config QCOM_MEMORY_DUMP_V2
	  subsystems to register respective dump regions. At the time
	  subsystems to register respective dump regions. At the time
	  of deadlocks or cpu hangs these dump regions are captured to
	  of deadlocks or cpu hangs these dump regions are captured to
	  give a snapshot of the system at the time of the crash.
	  give a snapshot of the system at the time of the crash.

config QCOM_BUS_SCALING
	bool "Bus scaling driver"
	help
	This option enables bus scaling on MSM devices.  Bus scaling
	allows devices to request the clocks be set to rates sufficient
	for the active devices needs without keeping the clocks at max
	frequency when a slower speed is sufficient.
+13 −0
Original line number Original line Diff line number Diff line
#
# Makefile for msm-bus driver specific files
#
obj-y +=  msm_bus_core.o msm_bus_client_api.o
obj-$(CONFIG_OF) += msm_bus_of.o
obj-$(CONFIG_MSM_RPM_SMD) += msm_bus_rpm_smd.o
obj-y += msm_bus_fabric_adhoc.o msm_bus_arb_adhoc.o msm_bus_rules.o \
	msm_bus_bimc_adhoc.o msm_bus_noc_adhoc.o
obj-$(CONFIG_OF) += msm_bus_of_adhoc.o
obj-$(CONFIG_DEBUG_BUS_VOTER) += msm_bus_dbg_voter.o
obj-$(CONFIG_CORESIGHT) +=  msm_buspm_coresight_adhoc.o

obj-$(CONFIG_DEBUG_FS) += msm_bus_dbg.o
Loading