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

Commit 904edec2 authored by Kyle Yan's avatar Kyle Yan Committed by Runmin Wang
Browse files

soc: qcom: add snapshot of PIL, SSR, SYSMON and SERVICE LOCATOR



This is a snapshot of PIL, SSR ,SYSMON and SERVICE LOCATOR drivers
, header files and libraries as of msm-4.9 commit <b89a6539f53cd9>
(Merge "ARM: dts: msm: add rotator reg bus bw setting for sdm845").

Change-Id: I6d01f835a634f894ba1cbab7c63174b389ba0da1
Signed-off-by: default avatarRunmin Wang <runminw@codeaurora.org>
parent 2d9d9935
Loading
Loading
Loading
Loading
+136 −0
Original line number Diff line number Diff line
* Generic Subsystem Peripheral Image Loader

subsys-pil-tz is a generic peripheral image loader (PIL) driver. It is
used for loading the firmware images of the subsystems into memory and
preparing the subsystem's processor to execute code. It's also responsible
for shutting down the processor when it's not needed.

Required properties:
- compatible:	      Must be "qcom,pil-tz-generic"
- qcom,firmware-name: Base name of the firmware image.

Optional properties:
- reg:		      Pairs of physical base addresses and region sizes of
		      memory mapped registers.
- reg-names:	      Names of the bases for the above registers. Not required for
		      PIL usage. Ex. "wrapper_base", "vbif_base".
- interrupts:	      Subsystem to Apps watchdog bite interrupt.
- vdd_'reg'-supply: Reference to the regulator that supplies the corresponding
		    'reg' domain.
- qcom,proxy-reg-names: Names of the regulators that need to be turned on/off
			during proxy voting/unvoting.
- qcom,active-reg-names: Names of the regulators that need to be turned on for the
			subsystem to run. Turned off when the subsystem is shutdown.
- qcom,vdd_'reg'-uV-uA:    Voltage and current values for the 'reg' regulator.
- qcom,proxy-clock-names:  Names of the clocks that need to be turned on/off during
			   proxy voting/unvoting.
- qcom,active-clock-names: Names of the clocks that need to be turned on for the
			   subsystem to run. Turned off when the subsystem is shutdown.
- clock-names:	      Names of all the clocks that are accessed by the subsystem.
- qcom,<clock-name>-freq: Frequency to be set for that clock in Hz. If the property
			  isn't added for a clock, then the default clock frequency
			  would be set to 19200000 Hz.
- qcom,msm-bus,name:  Name of the bus client for the subsystem.
- qcom,msm-bus,num-cases: Number of use-cases.
- qcom,msm-bus,num-paths: Number of paths.
- qcom,msm-bus,active-only: If not set, uses the dual context by default.
- qcom,msm-bus,vectors-KBps: Vector array of master id, slave id, arbitrated
			     bandwidth and instantaneous bandwidth.
- qcom,pas-id:	      pas_id of the subsystem.
- qcom,proxy-timeout-ms: Proxy vote timeout value for the subsystem.
- qcom,smem-id:	      ID of the SMEM item for the subsystem.
- qcom,is-not-loadable: Boolean. Present if the subsystem's firmware image does not
			need to be loaded.
- qcom,pil-no-auth: Boolean. Present if the subsystem is not authenticated and brought
		    out of reset by using the PIL ops.
- qcom,mem-protect-id: Virtual ID used by PIL to call into TZ/HYP to protect/unprotect
			subsystem related memory.
- qcom,gpio-err-fatal: GPIO used by the subsystem to indicate error fatal to the apps.
- qcom,gpio-err-ready: GPIO used by the subsystem to indicate error ready to the apps.
- qcom,gpio-proxy-unvote: GPIO used by the subsystem to trigger proxy unvoting in
			  the apps.
- qcom,gpio-force-stop: GPIO used by the apps to force the subsystem to shutdown.
- qcom,gpio-stop-ack: GPIO used by the subsystem to ack force stop or a graceful stop
		      to the apps.
- qcom,restart-group: List of subsystems that will need to restart together.
- qcom,keep-proxy-regs-on: Boolean. Present if during proxy unvoting, PIL needs to leave
			the regulators enabled after removing the voltage/current votes.
- qcom,edge:		GLINK logical name of the remote subsystem
- qcom,ssctl-instance-id: Instance id used by the subsystem to connect with the SSCTL
			  service.
- qcom,sysmon-id:	platform device id that sysmon is probed with for the subsystem.
- qcom,pil-force-shutdown: Boolean. If set, the SSR framework will not trigger graceful shutdown
                           on behalf of the subsystem driver.
- qcom,pil-generic-irq-handler: generic interrupt handler used for communication with subsytem
				based on bit values in scsr registers.
- qcom,spss-scsr-bits: array of bit positions into the scsr registers used in generic handler.
- qcom,complete-ramdump: Boolean. If set, complete ramdump i.e. region between start address of
			first segment to end address of last segment will be collected without
			leaving any hole in between.
- qcom,ignore-ssr-failure: Boolean. If set, SSR failures are not considered fatal.

Example:
	qcom,venus@fdce0000 {
		compatible = "qcom,pil-tz-generic";
		reg = <0xfdce0000 0x4000>,
		      <0xfdc80000 0x400>;

		vdd-supply = <&gdsc_venus>;
		qcom,proxy-reg-names = "vdd";
		clock-names = "core_clk", "iface_clk", "bus_clk", "mem_clk",
				"scm_core_clk", "scm_iface_clk", "scm_bus_clk",
				"scm_core_clk_src";
		qcom,proxy-clock-names = "core_clk", "iface_clk", "bus_clk",
					"mem_clk", "scm_core_clk",
					"scm_iface_clk", "scm_bus_clk",
					"scm_core_clk_src";
		qcom,scm_core_clk_src-freq = <50000000>;

		qcom,msm-bus,name = "pil-venus";
		qcom,msm-bus,num-cases = <2>;
		qcom,msm-bus,num-paths = <1>;
		qcom,msm-bus,active-only = <0>;
		qcom,msm-bus,vectors-KBps =
				<63 512 0 0>,
				<63 512 0 304000>;

		qcom,pas-id = <9>;
		qcom,proxy-timeout-ms = <2000>;
		qcom,firmware-name = "venus";
	};

	qcom,lpass@fe200000 {
		compatible = "qcom,pil-tz-generic";
		reg = <0xfe200000 0x00100>,
		      <0xfd485100 0x00010>,
		      <0xfc4016c0 0x00004>;

		interrupts = <0 162 1>;

		vdd_cx-supply = <&pm8841_s2_corner>;
		qcom,proxy-reg-names = "vdd_cx";
		qcom,vdd_cx-uV-uA = <7 100000>;
		clock-names = "bus_clk", "xo", "scm_core_clk", "scm_iface_clk",
				"scm_bus_clk", "scm_core_clk_src";
		qcom,active-clock-names = "bus_clk";
		qcom,proxy-clock-names = "xo", "scm_core_clk", "scm_iface_clk",
					"scm_bus_clk", "scm_core_clk_src";
		qcom,scm_core_clk_src-freq = <50000000>;

		qcom,smem-id = <423>;
		qcom,pas-id = <1>;
		qcom,proxy-timeout-ms = <10000>;
		qcom,firmware-name = "adsp";
		qcom,edge = "lpass";

		/* GPIO inputs from lpass */
		qcom,gpio-err-fatal = <&smp2pgpio_ssr_smp2p_2_in 0 0>;
		qcom,gpio-proxy-unvote = <&smp2pgpio_ssr_smp2p_2_in 2 0>;
		qcom,gpio-err-ready = <&smp2pgpio_ssr_smp2p_2_in 1 0>;
		qcom,gpio-stop-ack = <&smp2pgpio_ssr_smp2p_2_in 3 0>;

		/* GPIO output to lpass */
		qcom,gpio-force-stop = <&smp2pgpio_ssr_smp2p_2_out 0 0>;
		qcom,ssctl-instance-id = <14>;
		qcom,sysmon-id = <1>;
	};
+58 −0
Original line number Diff line number Diff line
@@ -119,6 +119,64 @@ config QCOM_WCNSS_CTRL
	  Client driver for the WCNSS_CTRL SMD channel, used to download nv
	  firmware to a newly booted WCNSS chip.

config MSM_SERVICE_LOCATOR
	bool "Service Locator"
	depends on MSM_QMI_INTERFACE
	help
	  The Service Locator provides a library to retrieve location
	  information given a service identifier. Location here translates
	  to what process domain exports the service, and which subsystem
	  that process domain will execute in.

config MSM_SERVICE_NOTIFIER
	bool "Service Notifier"
	depends on MSM_SERVICE_LOCATOR && MSM_SUBSYSTEM_RESTART
	help
	  The Service Notifier provides a library for a kernel client to
	  register for state change notifications regarding a remote service.
	  A remote service here refers to a process providing certain services
	  like audio, the identifier for which is provided by the service
	  locator.

config MSM_SUBSYSTEM_RESTART
       bool "MSM Subsystem Restart"
       help
         This option enables the MSM subsystem restart framework.

         The MSM subsystem restart framework provides support to boot,
         shutdown, and restart subsystems with a reference counted API.
         It also notifies userspace of transitions between these states via
         sysfs.

config MSM_PIL
       bool "Peripheral image loading"
       select FW_LOADER
       default n
       help
         Some peripherals need to be loaded into memory before they can be
         brought out of reset.

         Say yes to support these devices.

config MSM_SYSMON_GLINK_COMM
       bool "MSM System Monitor communication support using GLINK transport"
       depends on MSM_GLINK && MSM_SUBSYSTEM_RESTART
       help
         This option adds support for MSM System Monitor APIs using the GLINK
         transport layer. The APIs provided may be used for notifying
         subsystems within the SoC about other subsystems' power-up/down
         state-changes.

config MSM_PIL_SSR_GENERIC
       tristate "MSM Subsystem Boot Support"
       depends on MSM_PIL && MSM_SUBSYSTEM_RESTART
       help
         Support for booting and shutting down MSM Subsystem processors.
         This driver also monitors the SMSM status bits and the watchdog
         interrupt for the subsystem and restarts it on a watchdog bite
         or a fatal error. Subsystems include LPASS, Venus, VPU, WCNSS and
         BCSS.

config MSM_BOOT_STATS
	bool "Use MSM boot stats reporting"
	help
+11 −0
Original line number Diff line number Diff line
@@ -18,3 +18,14 @@ obj-$(CONFIG_MSM_CORE_HANG_DETECT) += core_hang_detect.o
obj-$(CONFIG_MSM_GLADIATOR_HANG_DETECT) += gladiator_hang_detect.o
obj-$(CONFIG_QCOM_SECURE_BUFFER) += secure_buffer.o
obj-$(CONFIG_ICNSS) += icnss.o wlan_firmware_service_v01.o icnss_utils.o
obj-$(CONFIG_MSM_SERVICE_NOTIFIER) += service-notifier.o
obj-$(CONFIG_MSM_SERVICE_LOCATOR) += service-locator.o
obj-$(CONFIG_MSM_SYSMON_GLINK_COMM) += sysmon-glink.o sysmon-qmi.o
obj-$(CONFIG_MSM_PIL_SSR_GENERIC) += subsys-pil-tz.o
obj-$(CONFIG_MSM_PIL)   +=      peripheral-loader.o

ifdef CONFIG_MSM_SUBSYSTEM_RESTART
       obj-y += subsystem_notif.o
       obj-y += subsystem_restart.o
       obj-y += ramdump.o
endif
+1161 −0

File added.

Preview size limit exceeded, changes collapsed.

+153 −0
Original line number Diff line number Diff line
/* Copyright (c) 2010-2017, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
 * only version 2 as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */
#ifndef __MSM_PERIPHERAL_LOADER_H
#define __MSM_PERIPHERAL_LOADER_H

struct device;
struct module;
struct pil_priv;

/**
 * struct pil_desc - PIL descriptor
 * @name: string used for pil_get()
 * @fw_name: firmware name
 * @dev: parent device
 * @ops: callback functions
 * @owner: module the descriptor belongs to
 * @proxy_timeout: delay in ms until proxy vote is removed
 * @flags: bitfield for image flags
 * @priv: DON'T USE - internal only
 * @attrs: DMA attributes to be used during dma allocation.
 * @proxy_unvote_irq: IRQ to trigger a proxy unvote. proxy_timeout
 * is ignored if this is set.
 * @map_fw_mem: Custom function used to map physical address space to virtual.
 * This defaults to ioremap if not specified.
 * @unmap_fw_mem: Custom function used to undo mapping by map_fw_mem.
 * This defaults to iounmap if not specified.
 * @shutdown_fail: Set if PIL op for shutting down subsystem fails.
 * @modem_ssr: true if modem is restarting, false if booting for first time.
 * @clear_fw_region: Clear fw region on failure in loading.
 * @subsys_vmid: memprot id for the subsystem.
 */
struct pil_desc {
	const char *name;
	const char *fw_name;
	struct device *dev;
	const struct pil_reset_ops *ops;
	struct module *owner;
	unsigned long proxy_timeout;
	unsigned long flags;
#define PIL_SKIP_ENTRY_CHECK	BIT(0)
	struct pil_priv *priv;
	unsigned long attrs;
	unsigned int proxy_unvote_irq;
	void * (*map_fw_mem)(phys_addr_t phys, size_t size, void *data);
	void (*unmap_fw_mem)(void *virt, size_t size, void *data);
	void *map_data;
	bool shutdown_fail;
	bool modem_ssr;
	bool clear_fw_region;
	u32 subsys_vmid;
};

/**
 * struct pil_image_info - info in IMEM about image and where it is loaded
 * @name: name of image (may or may not be NULL terminated)
 * @start: indicates physical address where image starts (little endian)
 * @size: size of image (little endian)
 */
struct pil_image_info {
	char name[8];
	__le64 start;
	__le32 size;
} __attribute__((__packed__));

/**
 * struct pil_reset_ops - PIL operations
 * @init_image: prepare an image for authentication
 * @mem_setup: prepare the image memory region
 * @verify_blob: authenticate a program segment, called once for each loadable
 *		 program segment (optional)
 * @proxy_vote: make proxy votes before auth_and_reset (optional)
 * @auth_and_reset: boot the processor
 * @proxy_unvote: remove any proxy votes (optional)
 * @deinit_image: restore actions performed in init_image if necessary
 * @shutdown: shutdown the processor
 */
struct pil_reset_ops {
	int (*init_image)(struct pil_desc *pil, const u8 *metadata,
			  size_t size);
	int (*mem_setup)(struct pil_desc *pil, phys_addr_t addr, size_t size);
	int (*verify_blob)(struct pil_desc *pil, phys_addr_t phy_addr,
			   size_t size);
	int (*proxy_vote)(struct pil_desc *pil);
	int (*auth_and_reset)(struct pil_desc *pil);
	void (*proxy_unvote)(struct pil_desc *pil);
	int (*deinit_image)(struct pil_desc *pil);
	int (*shutdown)(struct pil_desc *pil);
};

#ifdef CONFIG_MSM_PIL
extern int pil_desc_init(struct pil_desc *desc);
extern int pil_boot(struct pil_desc *desc);
extern void pil_shutdown(struct pil_desc *desc);
extern void pil_free_memory(struct pil_desc *desc);
extern void pil_desc_release(struct pil_desc *desc);
extern phys_addr_t pil_get_entry_addr(struct pil_desc *desc);
extern int pil_do_ramdump(struct pil_desc *desc, void *ramdump_dev);
extern int pil_assign_mem_to_subsys(struct pil_desc *desc, phys_addr_t addr,
						size_t size);
extern int pil_assign_mem_to_linux(struct pil_desc *desc, phys_addr_t addr,
						size_t size);
extern int pil_assign_mem_to_subsys_and_linux(struct pil_desc *desc,
						phys_addr_t addr, size_t size);
extern int pil_reclaim_mem(struct pil_desc *desc, phys_addr_t addr, size_t size,
						int VMid);
extern bool is_timeout_disabled(void);
#else
static inline int pil_desc_init(struct pil_desc *desc) { return 0; }
static inline int pil_boot(struct pil_desc *desc) { return 0; }
static inline void pil_shutdown(struct pil_desc *desc) { }
static inline void pil_free_memory(struct pil_desc *desc) { }
static inline void pil_desc_release(struct pil_desc *desc) { }
static inline phys_addr_t pil_get_entry_addr(struct pil_desc *desc)
{
	return 0;
}
static inline int pil_do_ramdump(struct pil_desc *desc, void *ramdump_dev)
{
	return 0;
}
static inline int pil_assign_mem_to_subsys(struct pil_desc *desc,
						phys_addr_t addr, size_t size)
{
	return 0;
}
static inline int pil_assign_mem_to_linux(struct pil_desc *desc,
						phys_addr_t addr, size_t size)
{
	return 0;
}
static inline int pil_assign_mem_to_subsys_and_linux(struct pil_desc *desc,
						phys_addr_t addr, size_t size)
{
	return 0;
}
static inline int pil_reclaim_mem(struct pil_desc *desc, phys_addr_t addr,
					size_t size, int VMid)
{
	return 0;
}
extern bool is_timeout_disabled(void) { return false; }
#endif

#endif
Loading