Skip to contentSkip to conversation

Add OCMEM support (v2)

PATCH In review Rob Clark 3 participants 23 messages Sep 29, 2015 – Oct 2, 2015

Subsystems (4)
lore
Share & tools
lore

Rob Clark

author
#0 lore raw

cover Add OCMEM support (v2)

Updates for review comments, plus a couple misc qcom-scm fixes

Quoted 1 line

From original cover-letter:

For devices such as 8x74 and 8084, which have a separate OCMEM block used by the GPU (and some other devices), rather than an internal GMEM block inside the GPU, we need a driver to power up and configure OCMEM in order to get the GPU working.

This patchset implements a vastly simplified version of the downstream vendor kernel's OCMEM driver. Currently it is just enough to enable the GPU. But we can worry about other OCMEM users when they have up- stream drivers.

The first patch adds support for the necessary scm interfaces, for the parts of the OCMEM configuration that must be done from secure mode. The second patch can be dropped, as so far this doesn't seem needed for the GPU (I'm just sending the patch now so it can be found later if it turns out to be needed).

The remaining two patches add the OCMEM driver inside drm/msm. If we eventually have other upstream OCMEM users, this would need to be split out. But that should not effect DT bindings, etc, so that is something that can easily be done later when the need arises.

Rob Clark (6):
qcom-scm: fix endianess issue in __qcom_scm_is_call_available
qcom-scm: fix header compile errors
qcom-scm: add missing prototype for qcom_scm_is_available()
qcom-scm: add ocmem support
drm/msm: update generated headers
drm/msm: add OCMEM driver

 drivers/firmware/qcom_scm-32.c                 |  59 +++-
 drivers/firmware/qcom_scm-64.c                 |  16 +
 drivers/firmware/qcom_scm.c                    |  61 ++++
 drivers/firmware/qcom_scm.h                    |  12 +
 drivers/gpu/drm/msm/Makefile                   |   3 +-
 drivers/gpu/drm/msm/adreno/a2xx.xml.h          |   9 +-
 drivers/gpu/drm/msm/adreno/a3xx.xml.h          |  27 +-
 drivers/gpu/drm/msm/adreno/a3xx_gpu.c          |  19 +-
 drivers/gpu/drm/msm/adreno/a4xx.xml.h          |  15 +-
 drivers/gpu/drm/msm/adreno/a4xx_gpu.c          |  19 +-
 drivers/gpu/drm/msm/adreno/adreno_common.xml.h |  13 +-
 drivers/gpu/drm/msm/adreno/adreno_pm4.xml.h    |   9 +-
 drivers/gpu/drm/msm/dsi/dsi.xml.h              |   4 +-
 drivers/gpu/drm/msm/dsi/mmss_cc.xml.h          |   4 +-
 drivers/gpu/drm/msm/dsi/sfpb.xml.h             |   4 +-
 drivers/gpu/drm/msm/edp/edp.xml.h              |   4 +-
 drivers/gpu/drm/msm/hdmi/hdmi.xml.h            |   4 +-
 drivers/gpu/drm/msm/hdmi/qfprom.xml.h          |   4 +-
 drivers/gpu/drm/msm/mdp/mdp4/mdp4.xml.h        |   4 +-
 drivers/gpu/drm/msm/mdp/mdp5/mdp5.xml.h        |  82 ++++-
 drivers/gpu/drm/msm/mdp/mdp_common.xml.h       |  11 +-
 drivers/gpu/drm/msm/msm_drv.c                  |   2 +
 drivers/gpu/drm/msm/msm_gpu.h                  |   3 +
 drivers/gpu/drm/msm/ocmem/ocmem.c              | 399 +++++++++++++++++++++++++
 drivers/gpu/drm/msm/ocmem/ocmem.h              |  46 +++
 drivers/gpu/drm/msm/ocmem/ocmem.xml.h          | 113 +++++++
 include/linux/qcom_scm.h                       |  16 +-
 27 files changed, 889 insertions(+), 73 deletions(-)
 create mode 100644 drivers/gpu/drm/msm/ocmem/ocmem.c
 create mode 100644 drivers/gpu/drm/msm/ocmem/ocmem.h
 create mode 100644 drivers/gpu/drm/msm/ocmem/ocmem.xml.h
Signature · 1 line
2.4.3
author
#1 lore raw

PATCH 1/6 qcom-scm: fix endianess issue in __qcom_scm_is_call_available

---
 drivers/firmware/qcom_scm-32.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/firmware/qcom_scm-32.c +3 -3
index e9c306b..c1e4325 100644
@@ -480,15 +480,15 @@ void __qcom_scm_cpu_power_down(u32 flags)
 int __qcom_scm_is_call_available(u32 svc_id, u32 cmd_id)
 {
 	int ret;
-	u32 svc_cmd = (svc_id << 10) | cmd_id;
-	u32 ret_val = 0;
+	__le32 svc_cmd = cpu_to_le32((svc_id << 10) | cmd_id);
+	__le32 ret_val = 0;
 
 	ret = qcom_scm_call(QCOM_SCM_SVC_INFO, QCOM_IS_CALL_AVAIL_CMD, &svc_cmd,
 			sizeof(svc_cmd), &ret_val, sizeof(ret_val));
 	if (ret)
 		return ret;
 
-	return ret_val;
+	return le32_to_cpu(ret_val);
 }
 
 int __qcom_scm_hdcp_req(struct qcom_scm_hdcp_req *req, u32 req_cnt, u32 *resp)
Signature · 1 line
2.4.3
author
#3 lore raw

PATCH 2/6 qcom-scm: fix header compile errors

In reply to Rob Clark

Add missing #include for types.h to have u32, etc. And fwd declare 'struct cpumask'.

---
 include/linux/qcom_scm.h | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
include/linux/qcom_scm.h +5 -2
index 46d41e4..c536b70 100644
@@ -13,8 +13,11 @@
 #ifndef __QCOM_SCM_H
 #define __QCOM_SCM_H
 
-extern int qcom_scm_set_cold_boot_addr(void *entry, const cpumask_t *cpus);
-extern int qcom_scm_set_warm_boot_addr(void *entry, const cpumask_t *cpus);
+#include <linux/types.h>
+
+struct cpumask;
+extern int qcom_scm_set_cold_boot_addr(void *entry, const struct cpumask *cpus);
+extern int qcom_scm_set_warm_boot_addr(void *entry, const struct cpumask *cpus);
 
 #define QCOM_SCM_HDCP_MAX_REQ_CNT	5
 
Signature · 1 line
2.4.3
author
#5 lore raw

PATCH 3/6 qcom-scm: add missing prototype for qcom_scm_is_available()

In reply to Rob Clark
---
 include/linux/qcom_scm.h | 2 ++
 1 file changed, 2 insertions(+)
include/linux/qcom_scm.h +2 -0
index c536b70..e407c0a 100644
@@ -26,6 +26,8 @@ struct qcom_scm_hdcp_req {
 	u32 val;
 };
 
+extern bool qcom_scm_is_available(void);
+
 extern bool qcom_scm_hdcp_available(void);
 extern int qcom_scm_hdcp_req(struct qcom_scm_hdcp_req *req, u32 req_cnt,
 		u32 *resp);
Signature · 1 line
2.4.3
author
#6 lore raw

PATCH 4/6 qcom-scm: add ocmem support

In reply to Rob Clark

Add interfaces needed for configuring OCMEM.

---
 drivers/firmware/qcom_scm-32.c | 53 ++++++++++++++++++++++++++++++++++++
 drivers/firmware/qcom_scm-64.c | 16 +++++++++++
 drivers/firmware/qcom_scm.c    | 61 ++++++++++++++++++++++++++++++++++++++++++
 drivers/firmware/qcom_scm.h    | 12 +++++++++
 include/linux/qcom_scm.h       |  7 +++++
 5 files changed, 149 insertions(+)
drivers/firmware/qcom_scm-32.c +53 -0
index c1e4325..e1ac97f 100644
@@ -500,6 +500,59 @@ int __qcom_scm_hdcp_req(struct qcom_scm_hdcp_req *req, u32 req_cnt, u32 *resp)
 		req, req_cnt * sizeof(*req), resp, sizeof(*resp));
 }
 
+int __qcom_scm_ocmem_secure_cfg(unsigned sec_id)
+{
+	int ret, scm_ret = 0;
+	struct msm_scm_sec_cfg {
+		__le32 id;
+		__le32 spare;
+	} cfg;
+
+	cfg.id = cpu_to_le32(sec_id);
+
+	ret = qcom_scm_call(QCOM_SCM_OCMEM_SECURE_SVC, QCOM_SCM_OCMEM_SECURE_CFG,
+			&cfg, sizeof(cfg), &scm_ret, sizeof(scm_ret));
+
+	if (ret || scm_ret)
+		return ret ? ret : -EINVAL;
+
+	return 0;
+}
+
+int __qcom_scm_ocmem_lock(u32 id, u32 offset, u32 size, u32 mode)
+{
+	struct ocmem_tz_lock {
+		__le32 id;
+		__le32 offset;
+		__le32 size;
+		__le32 mode;
+	} request;
+
+	request.id     = cpu_to_le32(id);
+	request.offset = cpu_to_le32(offset);
+	request.size   = cpu_to_le32(size);
+	request.mode   = cpu_to_le32(mode);
+
+	return qcom_scm_call(QCOM_SCM_OCMEM_SVC, QCOM_SCM_OCMEM_LOCK_CMD,
+			&request, sizeof(request), NULL, 0);
+}
+
+int __qcom_scm_ocmem_unlock(u32 id, u32 offset, u32 size)
+{
+	struct ocmem_tz_unlock {
+		__le32 id;
+		__le32 offset;
+		__le32 size;
+	} request;
+
+	request.id     = cpu_to_le32(id);
+	request.offset = cpu_to_le32(offset);
+	request.size   = cpu_to_le32(size);
+
+	return qcom_scm_call(QCOM_SCM_OCMEM_SVC, QCOM_SCM_OCMEM_UNLOCK_CMD,
+			&request, sizeof(request), NULL, 0);
+}
+
 bool __qcom_scm_pas_supported(u32 peripheral)
 {
 	__le32 out;
drivers/firmware/qcom_scm-64.c +16 -0
index e64fd92..ef5c59e 100644
@@ -62,6 +62,22 @@ int __qcom_scm_hdcp_req(struct qcom_scm_hdcp_req *req, u32 req_cnt, u32 *resp)
 	return -ENOTSUPP;
 }
 
+int __qcom_scm_ocmem_secure_cfg(unsigned sec_id)
+{
+	return -ENOTSUPP;
+}
+
+int __qcom_scm_ocmem_lock(uint32_t id, uint32_t offset, uint32_t size,
+		uint32_t mode)
+{
+	return -ENOTSUPP;
+}
+
+int __qcom_scm_ocmem_unlock(uint32_t id, uint32_t offset, uint32_t size)
+{
+	return -ENOTSUPP;
+}
+
 bool __qcom_scm_pas_supported(u32 peripheral)
 {
 	return false;
drivers/firmware/qcom_scm.c +61 -0

67 lines not on this page · raw message

drivers/firmware/qcom_scm.h +12 -0
index 220d19c..c41228d 100644
@@ -36,6 +36,18 @@ extern int __qcom_scm_is_call_available(u32 svc_id, u32 cmd_id);
 extern int __qcom_scm_hdcp_req(struct qcom_scm_hdcp_req *req, u32 req_cnt,
 		u32 *resp);
 
+#define QCOM_SCM_OCMEM_SECURE_SVC		0xc
+#define QCOM_SCM_OCMEM_SECURE_CFG		0x2
+
+extern int __qcom_scm_ocmem_secure_cfg(unsigned sec_id);
+
+#define QCOM_SCM_OCMEM_SVC			0xf
+#define QCOM_SCM_OCMEM_LOCK_CMD		0x1
+#define QCOM_SCM_OCMEM_UNLOCK_CMD		0x2
+
+extern int __qcom_scm_ocmem_lock(u32 id, u32 offset, u32 size, u32 mode);
+extern int __qcom_scm_ocmem_unlock(u32 id, u32 offset, u32 size);
+
 #define QCOM_SCM_SVC_PIL		0x2
 #define QCOM_SCM_PAS_INIT_IMAGE_CMD	0x1
 #define QCOM_SCM_PAS_MEM_SETUP_CMD	0x2
include/linux/qcom_scm.h +7 -0
index e407c0a..86bc6ba7 100644
@@ -32,6 +32,13 @@ extern bool qcom_scm_hdcp_available(void);
 extern int qcom_scm_hdcp_req(struct qcom_scm_hdcp_req *req, u32 req_cnt,
 		u32 *resp);
 
+extern bool qcom_scm_ocmem_secure_available(void);
+extern int qcom_scm_ocmem_secure_cfg(unsigned sec_id);
+
+extern bool qcom_scm_ocmem_lock_available(void);
+extern int qcom_scm_ocmem_lock(u32 id, u32 offset, u32 size, u32 mode);
+extern int qcom_scm_ocmem_unlock(u32 id, u32 offset, u32 size);
+
 extern bool qcom_scm_pas_supported(u32 peripheral);
 extern int qcom_scm_pas_init_image(u32 peripheral, const void *metadata, size_t size);
 extern int qcom_scm_pas_mem_setup(u32 peripheral, phys_addr_t addr, phys_addr_t size);
Signature · 1 line
2.4.3
author
#12 lore raw

PATCH 5/6 drm/msm: update generated headers

In reply to Rob Clark

Update generated headers to pull in OCMEM register definitions.

---
 drivers/gpu/drm/msm/adreno/a2xx.xml.h          |   9 +-
 drivers/gpu/drm/msm/adreno/a3xx.xml.h          |  27 ++++--
 drivers/gpu/drm/msm/adreno/a4xx.xml.h          |  15 ++--
 drivers/gpu/drm/msm/adreno/adreno_common.xml.h |  13 ++-
 drivers/gpu/drm/msm/adreno/adreno_pm4.xml.h    |   9 +-
 drivers/gpu/drm/msm/dsi/dsi.xml.h              |   4 +-
 drivers/gpu/drm/msm/dsi/mmss_cc.xml.h          |   4 +-
 drivers/gpu/drm/msm/dsi/sfpb.xml.h             |   4 +-
 drivers/gpu/drm/msm/edp/edp.xml.h              |   4 +-
 drivers/gpu/drm/msm/hdmi/hdmi.xml.h            |   4 +-
 drivers/gpu/drm/msm/hdmi/qfprom.xml.h          |   4 +-
 drivers/gpu/drm/msm/mdp/mdp4/mdp4.xml.h        |   4 +-
 drivers/gpu/drm/msm/mdp/mdp5/mdp5.xml.h        |  82 +++++++++++++++++-
 drivers/gpu/drm/msm/mdp/mdp_common.xml.h       |  11 ++-
 drivers/gpu/drm/msm/ocmem/ocmem.xml.h          | 113 +++++++++++++++++++++++++
 15 files changed, 267 insertions(+), 40 deletions(-)
 create mode 100644 drivers/gpu/drm/msm/ocmem/ocmem.xml.h
drivers/gpu/drm/msm/adreno/a2xx.xml.h +5 -4
index 0261f0d..9e2aceb 100644
@@ -8,13 +8,14 @@ http://github.com/freedreno/envytools/
 git clone https://github.com/freedreno/envytools.git
 
 The rules-ng-ng source files this header was generated from are:
-- /home/robclark/src/freedreno/envytools/rnndb/adreno.xml               (    364 bytes, from 2015-05-20 20:03:07)
+- /home/robclark/src/freedreno/envytools/rnndb/adreno.xml               (    398 bytes, from 2015-09-24 17:25:31)
 - /home/robclark/src/freedreno/envytools/rnndb/freedreno_copyright.xml  (   1453 bytes, from 2015-05-20 20:03:07)
 - /home/robclark/src/freedreno/envytools/rnndb/adreno/a2xx.xml          (  32901 bytes, from 2015-05-20 20:03:14)
-- /home/robclark/src/freedreno/envytools/rnndb/adreno/adreno_common.xml (  10551 bytes, from 2015-05-20 20:03:14)
+- /home/robclark/src/freedreno/envytools/rnndb/adreno/adreno_common.xml (  10755 bytes, from 2015-09-14 20:46:55)
 - /home/robclark/src/freedreno/envytools/rnndb/adreno/adreno_pm4.xml    (  14968 bytes, from 2015-05-20 20:12:27)
-- /home/robclark/src/freedreno/envytools/rnndb/adreno/a3xx.xml          (  67120 bytes, from 2015-08-14 23:22:03)
-- /home/robclark/src/freedreno/envytools/rnndb/adreno/a4xx.xml          (  63785 bytes, from 2015-08-14 18:27:06)
+- /home/robclark/src/freedreno/envytools/rnndb/adreno/a3xx.xml          (  67771 bytes, from 2015-09-14 20:46:55)
+- /home/robclark/src/freedreno/envytools/rnndb/adreno/a4xx.xml          (  63970 bytes, from 2015-09-14 20:50:12)
+- /home/robclark/src/freedreno/envytools/rnndb/adreno/ocmem.xml         (   1773 bytes, from 2015-09-24 17:30:00)
 
 Copyright (C) 2013-2015 by the following authors:
 - Rob Clark <[email protected]> (robclark)
drivers/gpu/drm/msm/adreno/a3xx.xml.h +22 -5
index 48d1337..97dc1c6 100644
@@ -8,13 +8,14 @@ http://github.com/freedreno/envytools/
 git clone https://github.com/freedreno/envytools.git
 
 The rules-ng-ng source files this header was generated from are:
-- /home/robclark/src/freedreno/envytools/rnndb/adreno.xml               (    364 bytes, from 2015-05-20 20:03:07)
+- /home/robclark/src/freedreno/envytools/rnndb/adreno.xml               (    398 bytes, from 2015-09-24 17:25:31)
 - /home/robclark/src/freedreno/envytools/rnndb/freedreno_copyright.xml  (   1453 bytes, from 2015-05-20 20:03:07)
 - /home/robclark/src/freedreno/envytools/rnndb/adreno/a2xx.xml          (  32901 bytes, from 2015-05-20 20:03:14)
-- /home/robclark/src/freedreno/envytools/rnndb/adreno/adreno_common.xml (  10551 bytes, from 2015-05-20 20:03:14)
+- /home/robclark/src/freedreno/envytools/rnndb/adreno/adreno_common.xml (  10755 bytes, from 2015-09-14 20:46:55)
 - /home/robclark/src/freedreno/envytools/rnndb/adreno/adreno_pm4.xml    (  14968 bytes, from 2015-05-20 20:12:27)
-- /home/robclark/src/freedreno/envytools/rnndb/adreno/a3xx.xml          (  67120 bytes, from 2015-08-14 23:22:03)
-- /home/robclark/src/freedreno/envytools/rnndb/adreno/a4xx.xml          (  63785 bytes, from 2015-08-14 18:27:06)
+- /home/robclark/src/freedreno/envytools/rnndb/adreno/a3xx.xml          (  67771 bytes, from 2015-09-14 20:46:55)
+- /home/robclark/src/freedreno/envytools/rnndb/adreno/a4xx.xml          (  63970 bytes, from 2015-09-14 20:50:12)
+- /home/robclark/src/freedreno/envytools/rnndb/adreno/ocmem.xml         (   1773 bytes, from 2015-09-24 17:30:00)
 
 Copyright (C) 2013-2015 by the following authors:
 - Rob Clark <[email protected]> (robclark)
@@ -280,6 +281,8 @@ enum a3xx_rb_blend_opcode {
 enum a3xx_intp_mode {
 	SMOOTH = 0,
 	FLAT = 1,
+	ZERO = 2,
+	ONE = 3,
 };
 
 enum a3xx_repl_mode {
@@ -680,9 +683,16 @@ static inline uint32_t REG_A3XX_CP_PROTECT_REG(uint32_t i0) { return 0x00000460
 #define A3XX_GRAS_CL_CLIP_CNTL_VP_CLIP_CODE_IGNORE		0x00080000
 #define A3XX_GRAS_CL_CLIP_CNTL_VP_XFORM_DISABLE			0x00100000
 #define A3XX_GRAS_CL_CLIP_CNTL_PERSP_DIVISION_DISABLE		0x00200000
+#define A3XX_GRAS_CL_CLIP_CNTL_ZERO_GB_SCALE_Z			0x00400000
 #define A3XX_GRAS_CL_CLIP_CNTL_ZCOORD				0x00800000
 #define A3XX_GRAS_CL_CLIP_CNTL_WCOORD				0x01000000
 #define A3XX_GRAS_CL_CLIP_CNTL_ZCLIP_DISABLE			0x02000000
+#define A3XX_GRAS_CL_CLIP_CNTL_NUM_USER_CLIP_PLANES__MASK	0x1c000000
+#define A3XX_GRAS_CL_CLIP_CNTL_NUM_USER_CLIP_PLANES__SHIFT	26
+static inline uint32_t A3XX_GRAS_CL_CLIP_CNTL_NUM_USER_CLIP_PLANES(uint32_t val)
+{
+	return ((val) << A3XX_GRAS_CL_CLIP_CNTL_NUM_USER_CLIP_PLANES__SHIFT) & A3XX_GRAS_CL_CLIP_CNTL_NUM_USER_CLIP_PLANES__MASK;
+}
 
 #define REG_A3XX_GRAS_CL_GB_CLIP_ADJ				0x00002044
 #define A3XX_GRAS_CL_GB_CLIP_ADJ_HORZ__MASK			0x000003ff
@@ -773,7 +783,7 @@ static inline uint32_t A3XX_GRAS_SU_POINT_SIZE(float val)
 #define A3XX_GRAS_SU_POLY_OFFSET_SCALE_VAL__SHIFT		0
 static inline uint32_t A3XX_GRAS_SU_POLY_OFFSET_SCALE_VAL(float val)
 {
-	return ((((int32_t)(val * 16384.0))) << A3XX_GRAS_SU_POLY_OFFSET_SCALE_VAL__SHIFT) & A3XX_GRAS_SU_POLY_OFFSET_SCALE_VAL__MASK;
+	return ((((int32_t)(val * 1048576.0))) << A3XX_GRAS_SU_POLY_OFFSET_SCALE_VAL__SHIFT) & A3XX_GRAS_SU_POLY_OFFSET_SCALE_VAL__MASK;
 }
 
 #define REG_A3XX_GRAS_SU_POLY_OFFSET_OFFSET			0x0000206d
@@ -894,6 +904,9 @@ static inline uint32_t A3XX_RB_MODE_CONTROL_MRT(uint32_t val)
 #define A3XX_RB_MODE_CONTROL_PACKER_TIMER_ENABLE		0x00010000
 
 #define REG_A3XX_RB_RENDER_CONTROL				0x000020c1
+#define A3XX_RB_RENDER_CONTROL_DUAL_COLOR_IN_ENABLE		0x00000001
+#define A3XX_RB_RENDER_CONTROL_YUV_IN_ENABLE			0x00000002
+#define A3XX_RB_RENDER_CONTROL_COV_VALUE_INPUT_ENABLE		0x00000004
 #define A3XX_RB_RENDER_CONTROL_FACENESS				0x00000008
 #define A3XX_RB_RENDER_CONTROL_BIN_WIDTH__MASK			0x00000ff0
 #define A3XX_RB_RENDER_CONTROL_BIN_WIDTH__SHIFT			4
@@ -907,6 +920,8 @@ static inline uint32_t A3XX_RB_RENDER_CONTROL_BIN_WIDTH(uint32_t val)
 #define A3XX_RB_RENDER_CONTROL_YCOORD				0x00008000
 #define A3XX_RB_RENDER_CONTROL_ZCOORD				0x00010000
 #define A3XX_RB_RENDER_CONTROL_WCOORD				0x00020000
+#define A3XX_RB_RENDER_CONTROL_I_CLAMP_ENABLE			0x00080000
+#define A3XX_RB_RENDER_CONTROL_COV_VALUE_OUTPUT_ENABLE		0x00100000
 #define A3XX_RB_RENDER_CONTROL_ALPHA_TEST			0x00400000
 #define A3XX_RB_RENDER_CONTROL_ALPHA_TEST_FUNC__MASK		0x07000000
 #define A3XX_RB_RENDER_CONTROL_ALPHA_TEST_FUNC__SHIFT		24
@@ -914,6 +929,8 @@ static inline uint32_t A3XX_RB_RENDER_CONTROL_ALPHA_TEST_FUNC(enum adreno_compar
 {
 	return ((val) << A3XX_RB_RENDER_CONTROL_ALPHA_TEST_FUNC__SHIFT) & A3XX_RB_RENDER_CONTROL_ALPHA_TEST_FUNC__MASK;
 }
+#define A3XX_RB_RENDER_CONTROL_ALPHA_TO_COVERAGE		0x40000000
+#define A3XX_RB_RENDER_CONTROL_ALPHA_TO_ONE			0x80000000
 
 #define REG_A3XX_RB_MSAA_CONTROL				0x000020c2
 #define A3XX_RB_MSAA_CONTROL_DISABLE				0x00000400
drivers/gpu/drm/msm/adreno/a4xx.xml.h +10 -5
index ac55066..99de827 100644
@@ -8,13 +8,14 @@ http://github.com/freedreno/envytools/
 git clone https://github.com/freedreno/envytools.git
 
 The rules-ng-ng source files this header was generated from are:
-- /home/robclark/src/freedreno/envytools/rnndb/adreno.xml               (    364 bytes, from 2015-05-20 20:03:07)
+- /home/robclark/src/freedreno/envytools/rnndb/adreno.xml               (    398 bytes, from 2015-09-24 17:25:31)
 - /home/robclark/src/freedreno/envytools/rnndb/freedreno_copyright.xml  (   1453 bytes, from 2015-05-20 20:03:07)
 - /home/robclark/src/freedreno/envytools/rnndb/adreno/a2xx.xml          (  32901 bytes, from 2015-05-20 20:03:14)
-- /home/robclark/src/freedreno/envytools/rnndb/adreno/adreno_common.xml (  10551 bytes, from 2015-05-20 20:03:14)
+- /home/robclark/src/freedreno/envytools/rnndb/adreno/adreno_common.xml (  10755 bytes, from 2015-09-14 20:46:55)
 - /home/robclark/src/freedreno/envytools/rnndb/adreno/adreno_pm4.xml    (  14968 bytes, from 2015-05-20 20:12:27)
-- /home/robclark/src/freedreno/envytools/rnndb/adreno/a3xx.xml          (  67120 bytes, from 2015-08-14 23:22:03)
-- /home/robclark/src/freedreno/envytools/rnndb/adreno/a4xx.xml          (  63785 bytes, from 2015-08-14 18:27:06)
+- /home/robclark/src/freedreno/envytools/rnndb/adreno/a3xx.xml          (  67771 bytes, from 2015-09-14 20:46:55)
+- /home/robclark/src/freedreno/envytools/rnndb/adreno/a4xx.xml          (  63970 bytes, from 2015-09-14 20:50:12)
+- /home/robclark/src/freedreno/envytools/rnndb/adreno/ocmem.xml         (   1773 bytes, from 2015-09-24 17:30:00)
 
 Copyright (C) 2013-2015 by the following authors:
 - Rob Clark <[email protected]> (robclark)
@@ -162,10 +163,13 @@ enum a4xx_tex_fmt {
 	TFMT4_8_UNORM = 4,
 	TFMT4_8_8_UNORM = 14,
 	TFMT4_8_8_8_8_UNORM = 28,
+	TFMT4_8_SNORM = 5,
 	TFMT4_8_8_SNORM = 15,
 	TFMT4_8_8_8_8_SNORM = 29,
+	TFMT4_8_UINT = 6,
 	TFMT4_8_8_UINT = 16,
 	TFMT4_8_8_8_8_UINT = 30,
+	TFMT4_8_SINT = 7,
 	TFMT4_8_8_SINT = 17,
 	TFMT4_8_8_8_8_SINT = 31,
 	TFMT4_16_UINT = 21,
@@ -246,7 +250,8 @@ enum a4xx_tex_clamp {
 	A4XX_TEX_REPEAT = 0,
 	A4XX_TEX_CLAMP_TO_EDGE = 1,
 	A4XX_TEX_MIRROR_REPEAT = 2,
-	A4XX_TEX_CLAMP_NONE = 3,
+	A4XX_TEX_CLAMP_TO_BORDER = 3,
+	A4XX_TEX_MIRROR_CLAMP = 4,
 };
 
 enum a4xx_tex_aniso {
drivers/gpu/drm/msm/adreno/adreno_common.xml.h +9 -4
index 399a9e5..c304468 100644
@@ -8,13 +8,14 @@ http://github.com/freedreno/envytools/
 git clone https://github.com/freedreno/envytools.git
 
 The rules-ng-ng source files this header was generated from are:
-- /home/robclark/src/freedreno/envytools/rnndb/adreno.xml               (    364 bytes, from 2015-05-20 20:03:07)
+- /home/robclark/src/freedreno/envytools/rnndb/adreno.xml               (    398 bytes, from 2015-09-24 17:25:31)
 - /home/robclark/src/freedreno/envytools/rnndb/freedreno_copyright.xml  (   1453 bytes, from 2015-05-20 20:03:07)
 - /home/robclark/src/freedreno/envytools/rnndb/adreno/a2xx.xml          (  32901 bytes, from 2015-05-20 20:03:14)
-- /home/robclark/src/freedreno/envytools/rnndb/adreno/adreno_common.xml (  10551 bytes, from 2015-05-20 20:03:14)
+- /home/robclark/src/freedreno/envytools/rnndb/adreno/adreno_common.xml (  10755 bytes, from 2015-09-14 20:46:55)
 - /home/robclark/src/freedreno/envytools/rnndb/adreno/adreno_pm4.xml    (  14968 bytes, from 2015-05-20 20:12:27)
-- /home/robclark/src/freedreno/envytools/rnndb/adreno/a3xx.xml          (  67120 bytes, from 2015-08-14 23:22:03)
-- /home/robclark/src/freedreno/envytools/rnndb/adreno/a4xx.xml          (  63785 bytes, from 2015-08-14 18:27:06)
+- /home/robclark/src/freedreno/envytools/rnndb/adreno/a3xx.xml          (  67771 bytes, from 2015-09-14 20:46:55)
+- /home/robclark/src/freedreno/envytools/rnndb/adreno/a4xx.xml          (  63970 bytes, from 2015-09-14 20:50:12)
+- /home/robclark/src/freedreno/envytools/rnndb/adreno/ocmem.xml         (   1773 bytes, from 2015-09-24 17:30:00)
 
 Copyright (C) 2013-2015 by the following authors:
 - Rob Clark <[email protected]> (robclark)
@@ -85,6 +86,10 @@ enum adreno_rb_blend_factor {
 	FACTOR_CONSTANT_ALPHA = 14,
 	FACTOR_ONE_MINUS_CONSTANT_ALPHA = 15,
 	FACTOR_SRC_ALPHA_SATURATE = 16,
+	FACTOR_SRC1_COLOR = 20,
+	FACTOR_ONE_MINUS_SRC1_COLOR = 21,
+	FACTOR_SRC1_ALPHA = 22,
+	FACTOR_ONE_MINUS_SRC1_ALPHA = 23,
 };
 
 enum adreno_rb_surface_endian {
drivers/gpu/drm/msm/adreno/adreno_pm4.xml.h +5 -4
index 41904fe..a22fef5 100644
@@ -8,13 +8,14 @@ http://github.com/freedreno/envytools/
 git clone https://github.com/freedreno/envytools.git
 
 The rules-ng-ng source files this header was generated from are:
-- /home/robclark/src/freedreno/envytools/rnndb/adreno.xml               (    364 bytes, from 2015-05-20 20:03:07)
+- /home/robclark/src/freedreno/envytools/rnndb/adreno.xml               (    398 bytes, from 2015-09-24 17:25:31)
 - /home/robclark/src/freedreno/envytools/rnndb/freedreno_copyright.xml  (   1453 bytes, from 2015-05-20 20:03:07)
 - /home/robclark/src/freedreno/envytools/rnndb/adreno/a2xx.xml          (  32901 bytes, from 2015-05-20 20:03:14)
-- /home/robclark/src/freedreno/envytools/rnndb/adreno/adreno_common.xml (  10551 bytes, from 2015-05-20 20:03:14)
+- /home/robclark/src/freedreno/envytools/rnndb/adreno/adreno_common.xml (  10755 bytes, from 2015-09-14 20:46:55)
 - /home/robclark/src/freedreno/envytools/rnndb/adreno/adreno_pm4.xml    (  14968 bytes, from 2015-05-20 20:12:27)
-- /home/robclark/src/freedreno/envytools/rnndb/adreno/a3xx.xml          (  67120 bytes, from 2015-08-14 23:22:03)
-- /home/robclark/src/freedreno/envytools/rnndb/adreno/a4xx.xml          (  63785 bytes, from 2015-08-14 18:27:06)
+- /home/robclark/src/freedreno/envytools/rnndb/adreno/a3xx.xml          (  67771 bytes, from 2015-09-14 20:46:55)
+- /home/robclark/src/freedreno/envytools/rnndb/adreno/a4xx.xml          (  63970 bytes, from 2015-09-14 20:50:12)
+- /home/robclark/src/freedreno/envytools/rnndb/adreno/ocmem.xml         (   1773 bytes, from 2015-09-24 17:30:00)
 
 Copyright (C) 2013-2015 by the following authors:
 - Rob Clark <[email protected]> (robclark)
drivers/gpu/drm/msm/dsi/dsi.xml.h +2 -2
index 1d2e32f..c208547 100644
@@ -11,8 +11,8 @@ The rules-ng-ng source files this header was generated from are:
 - /home/robclark/src/freedreno/envytools/rnndb/msm.xml                 (    676 bytes, from 2015-05-20 20:03:14)
 - /home/robclark/src/freedreno/envytools/rnndb/freedreno_copyright.xml (   1453 bytes, from 2015-05-20 20:03:07)
 - /home/robclark/src/freedreno/envytools/rnndb/mdp/mdp4.xml            (  20915 bytes, from 2015-05-20 20:03:14)
-- /home/robclark/src/freedreno/envytools/rnndb/mdp/mdp_common.xml      (   2576 bytes, from 2015-07-09 22:10:24)
-- /home/robclark/src/freedreno/envytools/rnndb/mdp/mdp5.xml            (  36021 bytes, from 2015-07-09 22:10:24)
+- /home/robclark/src/freedreno/envytools/rnndb/mdp/mdp_common.xml      (   2849 bytes, from 2015-09-18 12:07:28)
+- /home/robclark/src/freedreno/envytools/rnndb/mdp/mdp5.xml            (  37194 bytes, from 2015-09-18 12:07:28)
 - /home/robclark/src/freedreno/envytools/rnndb/dsi/dsi.xml             (  26057 bytes, from 2015-08-14 21:47:57)
 - /home/robclark/src/freedreno/envytools/rnndb/dsi/sfpb.xml            (    344 bytes, from 2015-05-20 20:03:07)
 - /home/robclark/src/freedreno/envytools/rnndb/dsi/mmss_cc.xml         (   1686 bytes, from 2015-05-20 20:03:14)
drivers/gpu/drm/msm/dsi/mmss_cc.xml.h +2 -2
index 5de505e..cb830a3 100644
@@ -11,8 +11,8 @@ The rules-ng-ng source files this header was generated from are:
 - /home/robclark/src/freedreno/envytools/rnndb/msm.xml                 (    676 bytes, from 2015-05-20 20:03:14)
 - /home/robclark/src/freedreno/envytools/rnndb/freedreno_copyright.xml (   1453 bytes, from 2015-05-20 20:03:07)
 - /home/robclark/src/freedreno/envytools/rnndb/mdp/mdp4.xml            (  20915 bytes, from 2015-05-20 20:03:14)
-- /home/robclark/src/freedreno/envytools/rnndb/mdp/mdp_common.xml      (   2576 bytes, from 2015-07-09 22:10:24)
-- /home/robclark/src/freedreno/envytools/rnndb/mdp/mdp5.xml            (  36021 bytes, from 2015-07-09 22:10:24)
+- /home/robclark/src/freedreno/envytools/rnndb/mdp/mdp_common.xml      (   2849 bytes, from 2015-09-18 12:07:28)
+- /home/robclark/src/freedreno/envytools/rnndb/mdp/mdp5.xml            (  37194 bytes, from 2015-09-18 12:07:28)
 - /home/robclark/src/freedreno/envytools/rnndb/dsi/dsi.xml             (  26057 bytes, from 2015-08-14 21:47:57)
 - /home/robclark/src/freedreno/envytools/rnndb/dsi/sfpb.xml            (    344 bytes, from 2015-05-20 20:03:07)
 - /home/robclark/src/freedreno/envytools/rnndb/dsi/mmss_cc.xml         (   1686 bytes, from 2015-05-20 20:03:14)
drivers/gpu/drm/msm/dsi/sfpb.xml.h +2 -2
index 06cbddf..96f7ecb 100644
@@ -11,8 +11,8 @@ The rules-ng-ng source files this header was generated from are:
 - /home/robclark/src/freedreno/envytools/rnndb/msm.xml                 (    676 bytes, from 2015-05-20 20:03:14)
 - /home/robclark/src/freedreno/envytools/rnndb/freedreno_copyright.xml (   1453 bytes, from 2015-05-20 20:03:07)
 - /home/robclark/src/freedreno/envytools/rnndb/mdp/mdp4.xml            (  20915 bytes, from 2015-05-20 20:03:14)
-- /home/robclark/src/freedreno/envytools/rnndb/mdp/mdp_common.xml      (   2576 bytes, from 2015-07-09 22:10:24)
-- /home/robclark/src/freedreno/envytools/rnndb/mdp/mdp5.xml            (  36021 bytes, from 2015-07-09 22:10:24)
+- /home/robclark/src/freedreno/envytools/rnndb/mdp/mdp_common.xml      (   2849 bytes, from 2015-09-18 12:07:28)
+- /home/robclark/src/freedreno/envytools/rnndb/mdp/mdp5.xml            (  37194 bytes, from 2015-09-18 12:07:28)
 - /home/robclark/src/freedreno/envytools/rnndb/dsi/dsi.xml             (  26057 bytes, from 2015-08-14 21:47:57)
 - /home/robclark/src/freedreno/envytools/rnndb/dsi/sfpb.xml            (    344 bytes, from 2015-05-20 20:03:07)
 - /home/robclark/src/freedreno/envytools/rnndb/dsi/mmss_cc.xml         (   1686 bytes, from 2015-05-20 20:03:14)
drivers/gpu/drm/msm/edp/edp.xml.h +2 -2
index bef1d65..fbef985 100644
@@ -11,8 +11,8 @@ The rules-ng-ng source files this header was generated from are:
 - /home/robclark/src/freedreno/envytools/rnndb/msm.xml                 (    676 bytes, from 2015-05-20 20:03:14)
 - /home/robclark/src/freedreno/envytools/rnndb/freedreno_copyright.xml (   1453 bytes, from 2015-05-20 20:03:07)
 - /home/robclark/src/freedreno/envytools/rnndb/mdp/mdp4.xml            (  20915 bytes, from 2015-05-20 20:03:14)
-- /home/robclark/src/freedreno/envytools/rnndb/mdp/mdp_common.xml      (   2576 bytes, from 2015-07-09 22:10:24)
-- /home/robclark/src/freedreno/envytools/rnndb/mdp/mdp5.xml            (  36021 bytes, from 2015-07-09 22:10:24)
+- /home/robclark/src/freedreno/envytools/rnndb/mdp/mdp_common.xml      (   2849 bytes, from 2015-09-18 12:07:28)
+- /home/robclark/src/freedreno/envytools/rnndb/mdp/mdp5.xml            (  37194 bytes, from 2015-09-18 12:07:28)
 - /home/robclark/src/freedreno/envytools/rnndb/dsi/dsi.xml             (  26057 bytes, from 2015-08-14 21:47:57)
 - /home/robclark/src/freedreno/envytools/rnndb/dsi/sfpb.xml            (    344 bytes, from 2015-05-20 20:03:07)
 - /home/robclark/src/freedreno/envytools/rnndb/dsi/mmss_cc.xml         (   1686 bytes, from 2015-05-20 20:03:14)
drivers/gpu/drm/msm/hdmi/hdmi.xml.h +2 -2
index 0b1b558..84846c4 100644
@@ -11,8 +11,8 @@ The rules-ng-ng source files this header was generated from are:
 - /home/robclark/src/freedreno/envytools/rnndb/msm.xml                 (    676 bytes, from 2015-05-20 20:03:14)
 - /home/robclark/src/freedreno/envytools/rnndb/freedreno_copyright.xml (   1453 bytes, from 2015-05-20 20:03:07)
 - /home/robclark/src/freedreno/envytools/rnndb/mdp/mdp4.xml            (  20915 bytes, from 2015-05-20 20:03:14)
-- /home/robclark/src/freedreno/envytools/rnndb/mdp/mdp_common.xml      (   2576 bytes, from 2015-07-09 22:10:24)
-- /home/robclark/src/freedreno/envytools/rnndb/mdp/mdp5.xml            (  36021 bytes, from 2015-07-09 22:10:24)
+- /home/robclark/src/freedreno/envytools/rnndb/mdp/mdp_common.xml      (   2849 bytes, from 2015-09-18 12:07:28)
+- /home/robclark/src/freedreno/envytools/rnndb/mdp/mdp5.xml            (  37194 bytes, from 2015-09-18 12:07:28)
 - /home/robclark/src/freedreno/envytools/rnndb/dsi/dsi.xml             (  26057 bytes, from 2015-08-14 21:47:57)
 - /home/robclark/src/freedreno/envytools/rnndb/dsi/sfpb.xml            (    344 bytes, from 2015-05-20 20:03:07)
 - /home/robclark/src/freedreno/envytools/rnndb/dsi/mmss_cc.xml         (   1686 bytes, from 2015-05-20 20:03:14)
drivers/gpu/drm/msm/hdmi/qfprom.xml.h +2 -2
index 2aa23b9..0ae573c 100644
@@ -11,8 +11,8 @@ The rules-ng-ng source files this header was generated from are:
 - /home/robclark/src/freedreno/envytools/rnndb/msm.xml                 (    676 bytes, from 2015-05-20 20:03:14)
 - /home/robclark/src/freedreno/envytools/rnndb/freedreno_copyright.xml (   1453 bytes, from 2015-05-20 20:03:07)
 - /home/robclark/src/freedreno/envytools/rnndb/mdp/mdp4.xml            (  20915 bytes, from 2015-05-20 20:03:14)
-- /home/robclark/src/freedreno/envytools/rnndb/mdp/mdp_common.xml      (   2576 bytes, from 2015-07-09 22:10:24)
-- /home/robclark/src/freedreno/envytools/rnndb/mdp/mdp5.xml            (  36021 bytes, from 2015-07-09 22:10:24)
+- /home/robclark/src/freedreno/envytools/rnndb/mdp/mdp_common.xml      (   2849 bytes, from 2015-09-18 12:07:28)
+- /home/robclark/src/freedreno/envytools/rnndb/mdp/mdp5.xml            (  37194 bytes, from 2015-09-18 12:07:28)
 - /home/robclark/src/freedreno/envytools/rnndb/dsi/dsi.xml             (  26057 bytes, from 2015-08-14 21:47:57)
 - /home/robclark/src/freedreno/envytools/rnndb/dsi/sfpb.xml            (    344 bytes, from 2015-05-20 20:03:07)
 - /home/robclark/src/freedreno/envytools/rnndb/dsi/mmss_cc.xml         (   1686 bytes, from 2015-05-20 20:03:14)
drivers/gpu/drm/msm/mdp/mdp4/mdp4.xml.h +2 -2
index 74b8673..df7e765 100644
@@ -11,8 +11,8 @@ The rules-ng-ng source files this header was generated from are:
 - /home/robclark/src/freedreno/envytools/rnndb/msm.xml                 (    676 bytes, from 2015-05-20 20:03:14)
 - /home/robclark/src/freedreno/envytools/rnndb/freedreno_copyright.xml (   1453 bytes, from 2015-05-20 20:03:07)
 - /home/robclark/src/freedreno/envytools/rnndb/mdp/mdp4.xml            (  20915 bytes, from 2015-05-20 20:03:14)
-- /home/robclark/src/freedreno/envytools/rnndb/mdp/mdp_common.xml      (   2576 bytes, from 2015-07-09 22:10:24)
-- /home/robclark/src/freedreno/envytools/rnndb/mdp/mdp5.xml            (  36021 bytes, from 2015-07-09 22:10:24)
+- /home/robclark/src/freedreno/envytools/rnndb/mdp/mdp_common.xml      (   2849 bytes, from 2015-09-18 12:07:28)
+- /home/robclark/src/freedreno/envytools/rnndb/mdp/mdp5.xml            (  37194 bytes, from 2015-09-18 12:07:28)
 - /home/robclark/src/freedreno/envytools/rnndb/dsi/dsi.xml             (  26057 bytes, from 2015-08-14 21:47:57)
 - /home/robclark/src/freedreno/envytools/rnndb/dsi/sfpb.xml            (    344 bytes, from 2015-05-20 20:03:07)
 - /home/robclark/src/freedreno/envytools/rnndb/dsi/mmss_cc.xml         (   1686 bytes, from 2015-05-20 20:03:14)
drivers/gpu/drm/msm/mdp/mdp5/mdp5.xml.h +80 -2

100 lines not on this page · raw message

drivers/gpu/drm/msm/mdp/mdp_common.xml.h +9 -2
index 4f792c4..2916c4d 100644
@@ -11,8 +11,8 @@ The rules-ng-ng source files this header was generated from are:
 - /home/robclark/src/freedreno/envytools/rnndb/msm.xml                 (    676 bytes, from 2015-05-20 20:03:14)
 - /home/robclark/src/freedreno/envytools/rnndb/freedreno_copyright.xml (   1453 bytes, from 2015-05-20 20:03:07)
 - /home/robclark/src/freedreno/envytools/rnndb/mdp/mdp4.xml            (  20915 bytes, from 2015-05-20 20:03:14)
-- /home/robclark/src/freedreno/envytools/rnndb/mdp/mdp_common.xml      (   2576 bytes, from 2015-07-09 22:10:24)
-- /home/robclark/src/freedreno/envytools/rnndb/mdp/mdp5.xml            (  36021 bytes, from 2015-07-09 22:10:24)
+- /home/robclark/src/freedreno/envytools/rnndb/mdp/mdp_common.xml      (   2849 bytes, from 2015-09-18 12:07:28)
+- /home/robclark/src/freedreno/envytools/rnndb/mdp/mdp5.xml            (  37194 bytes, from 2015-09-18 12:07:28)
 - /home/robclark/src/freedreno/envytools/rnndb/dsi/dsi.xml             (  26057 bytes, from 2015-08-14 21:47:57)
 - /home/robclark/src/freedreno/envytools/rnndb/dsi/sfpb.xml            (    344 bytes, from 2015-05-20 20:03:07)
 - /home/robclark/src/freedreno/envytools/rnndb/dsi/mmss_cc.xml         (   1686 bytes, from 2015-05-20 20:03:14)
@@ -78,6 +78,13 @@ enum mdp_alpha_type {
 	BG_PIXEL = 3,
 };
 
+enum mdp_component_type {
+	COMP_0 = 0,
+	COMP_1_2 = 1,
+	COMP_3 = 2,
+	COMP_MAX = 3,
+};
+
 enum mdp_bpc {
 	BPC1 = 0,
 	BPC5 = 1,
drivers/gpu/drm/msm/ocmem/ocmem.xml.h new file +113 -0

113 lines not on this page · raw message

Signature · 1 line
2.4.3
author
#13 lore raw

PATCH 6/6 drm/msm: add OCMEM driver

In reply to Rob Clark

For now, since the GPU is the only upstream consumer, just stuff this into drm/msm. Eventually if we have other consumers, we'll have to split this out and make the allocation less hard coded. But I'll punt on that until I better understand the non-gpu uses-cases (and whether the allocation *really* needs to be as complicated as it is in the downstream driver).

---
 drivers/gpu/drm/msm/Makefile          |   3 +-
 drivers/gpu/drm/msm/adreno/a3xx_gpu.c |  19 +-
 drivers/gpu/drm/msm/adreno/a4xx_gpu.c |  19 +-
 drivers/gpu/drm/msm/msm_drv.c         |   2 +
 drivers/gpu/drm/msm/msm_gpu.h         |   3 +
 drivers/gpu/drm/msm/ocmem/ocmem.c     | 399 ++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/msm/ocmem/ocmem.h     |  46 ++++
 7 files changed, 463 insertions(+), 28 deletions(-)
 create mode 100644 drivers/gpu/drm/msm/ocmem/ocmem.c
 create mode 100644 drivers/gpu/drm/msm/ocmem/ocmem.h
drivers/gpu/drm/msm/Makefile +2 -1
index 0a543eb..8ddf6fa 100644
@@ -48,7 +48,8 @@ msm-y := \
 	msm_iommu.o \
 	msm_perf.o \
 	msm_rd.o \
-	msm_ringbuffer.o
+	msm_ringbuffer.o \
+	ocmem/ocmem.o
 
 msm-$(CONFIG_DRM_MSM_FBDEV) += msm_fbdev.o
 msm-$(CONFIG_COMMON_CLK) += mdp/mdp4/mdp4_lvds_pll.o
drivers/gpu/drm/msm/adreno/a3xx_gpu.c +5 -14
index ca29688..2a8bf4c 100644
@@ -17,10 +17,7 @@
  * this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifdef CONFIG_MSM_OCMEM
-#  include <mach/ocmem.h>
-#endif
-
+#include "ocmem/ocmem.h"
 #include "a3xx_gpu.h"
 
 #define A3XX_INT0_MASK \
@@ -322,10 +319,8 @@ static void a3xx_destroy(struct msm_gpu *gpu)
 
 	adreno_gpu_cleanup(adreno_gpu);
 
-#ifdef CONFIG_MSM_OCMEM
-	if (a3xx_gpu->ocmem_base)
+	if (a3xx_gpu->ocmem_hdl)
 		ocmem_free(OCMEM_GRAPHICS, a3xx_gpu->ocmem_hdl);
-#endif
 
 	kfree(a3xx_gpu);
 }
@@ -539,6 +534,7 @@ struct msm_gpu *a3xx_gpu_init(struct drm_device *dev)
 	struct msm_gpu *gpu;
 	struct msm_drm_private *priv = dev->dev_private;
 	struct platform_device *pdev = priv->gpu_pdev;
+	struct ocmem_buf *ocmem_hdl;
 	int ret;
 
 	if (!pdev) {
@@ -569,18 +565,13 @@ struct msm_gpu *a3xx_gpu_init(struct drm_device *dev)
 		goto fail;
 
 	/* if needed, allocate gmem: */
-	if (adreno_is_a330(adreno_gpu)) {
-#ifdef CONFIG_MSM_OCMEM
-		/* TODO this is different/missing upstream: */
-		struct ocmem_buf *ocmem_hdl =
-				ocmem_allocate(OCMEM_GRAPHICS, adreno_gpu->gmem);
-
+	ocmem_hdl = ocmem_allocate(OCMEM_GRAPHICS, adreno_gpu->gmem);
+	if (!IS_ERR(ocmem_hdl)) {
 		a3xx_gpu->ocmem_hdl = ocmem_hdl;
 		a3xx_gpu->ocmem_base = ocmem_hdl->addr;
 		adreno_gpu->gmem = ocmem_hdl->len;
 		DBG("using %dK of OCMEM at 0x%08x", adreno_gpu->gmem / 1024,
 				a3xx_gpu->ocmem_base);
-#endif
 	}
 
 	if (!gpu->mmu) {
drivers/gpu/drm/msm/adreno/a4xx_gpu.c +6 -13
index a53f1be..17f084d 100644
@@ -10,10 +10,9 @@
  * GNU General Public License for more details.
  *
  */
+
+#include "ocmem/ocmem.h"
 #include "a4xx_gpu.h"
-#ifdef CONFIG_MSM_OCMEM
-#  include <soc/qcom/ocmem.h>
-#endif
 
 #define A4XX_INT0_MASK \
 	(A4XX_INT0_RBBM_AHB_ERROR |        \
@@ -289,10 +288,8 @@ static void a4xx_destroy(struct msm_gpu *gpu)
 
 	adreno_gpu_cleanup(adreno_gpu);
 
-#ifdef CONFIG_MSM_OCMEM
-	if (a4xx_gpu->ocmem_base)
+	if (a4xx_gpu->ocmem_hdl)
 		ocmem_free(OCMEM_GRAPHICS, a4xx_gpu->ocmem_hdl);
-#endif
 
 	kfree(a4xx_gpu);
 }
@@ -538,6 +535,7 @@ struct msm_gpu *a4xx_gpu_init(struct drm_device *dev)
 	struct msm_gpu *gpu;
 	struct msm_drm_private *priv = dev->dev_private;
 	struct platform_device *pdev = priv->gpu_pdev;
+	struct ocmem_buf *ocmem_hdl;
 	int ret;
 
 	if (!pdev) {
@@ -568,18 +566,13 @@ struct msm_gpu *a4xx_gpu_init(struct drm_device *dev)
 		goto fail;
 
 	/* if needed, allocate gmem: */
-	if (adreno_is_a4xx(adreno_gpu)) {
-#ifdef CONFIG_MSM_OCMEM
-		/* TODO this is different/missing upstream: */
-		struct ocmem_buf *ocmem_hdl =
-				ocmem_allocate(OCMEM_GRAPHICS, adreno_gpu->gmem);
-
+	ocmem_hdl = ocmem_allocate(OCMEM_GRAPHICS, adreno_gpu->gmem);
+	if (!IS_ERR(ocmem_hdl)) {
 		a4xx_gpu->ocmem_hdl = ocmem_hdl;
 		a4xx_gpu->ocmem_base = ocmem_hdl->addr;
 		adreno_gpu->gmem = ocmem_hdl->len;
 		DBG("using %dK of OCMEM at 0x%08x", adreno_gpu->gmem / 1024,
 				a4xx_gpu->ocmem_base);
-#endif
 	}
 
 	if (!gpu->mmu) {
drivers/gpu/drm/msm/msm_drv.c +2 -0
index 28c9a2a..1b02c2d 100644
@@ -1165,6 +1165,7 @@ static int __init msm_drm_register(void)
 	msm_dsi_register();
 	msm_edp_register();
 	hdmi_register();
+	ocmem_register();
 	adreno_register();
 	return platform_driver_register(&msm_platform_driver);
 }
@@ -1175,6 +1176,7 @@ static void __exit msm_drm_unregister(void)
 	platform_driver_unregister(&msm_platform_driver);
 	hdmi_unregister();
 	adreno_unregister();
+	ocmem_unregister();
 	msm_edp_unregister();
 	msm_dsi_unregister();
 }
drivers/gpu/drm/msm/msm_gpu.h +3 -0
index 2bbe85a..f042ba8 100644
@@ -172,4 +172,7 @@ struct msm_gpu *adreno_load_gpu(struct drm_device *dev);
 void __init adreno_register(void);
 void __exit adreno_unregister(void);
 
+void __init ocmem_register(void);
+void __exit ocmem_unregister(void);
+
 #endif /* __MSM_GPU_H__ */
drivers/gpu/drm/msm/ocmem/ocmem.c new file +399 -0

399 lines not on this page · raw message

drivers/gpu/drm/msm/ocmem/ocmem.h new file +46 -0

46 lines not on this page · raw message

Signature · 1 line
2.4.3
Reviewed-by on v1 1/6
#2 lore raw

Re: [PATCH 1/6] qcom-scm: fix endianess issue in __qcom_scm_is_call_available

In reply to Rob Clark
Quoted 2 lines · Rob Clark

---

Signature · 6 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#4 lore raw

Re: [PATCH 2/6] qcom-scm: fix header compile errors

In reply to Rob Clark
Quoted 5 lines · Rob Clark

Add missing #include for types.h to have u32, etc. And fwd declare 'struct cpumask'.

---

We should change the arguments for the implementation too.

Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
#7 lore raw

Re: [PATCH 4/6] qcom-scm: add ocmem support

In reply to Rob Clark

drivers/firmware/qcom_scm-32.c int __qcom_scm_hdcp_req(struct qcom_scm_hdcp_req *req, u32 req_cnt, u32 *resp) · line 506

Quoted 12 lines · Rob Clark
drivers/firmware/qcom_scm-32.c +4 -0
index c1e4325..e1ac97f 100644
@@ -500,6 +500,59 @@ int __qcom_scm_hdcp_req(struct qcom_scm_hdcp_req *req, u32 req_cnt, u32 *resp)
 		req, req_cnt * sizeof(*req), resp, sizeof(*resp));
 }
 
+int __qcom_scm_ocmem_secure_cfg(unsigned sec_id)
+{
+	int ret, scm_ret = 0;
+	struct msm_scm_sec_cfg {

We've left these as anonymous structs for things like qcom_scm_set_boot_addr(), maybe we should do the same here.

drivers/firmware/qcom_scm-32.c int __qcom_scm_hdcp_req(struct qcom_scm_hdcp_req *req, u32 req_cnt, u32 *resp) · line 508

Quoted 2 lines
drivers/firmware/qcom_scm-32.c +2 -0
+		__le32 id;
+		__le32 spare;

Also, the iommu driver would use this API and it uses this "spare" element, so perhaps this whole function should be renamed to be more generic and take two values. Downstream the function is called scm_restore_sec_cfg, so maybe something similar. And the service id is MP for "memory protection", so QCOM_SCM_OCMEM_SECURE_SVC could be QCOM_SCM_MEMORY_PROTECTION?

Otherwise this patch looks good.

Quoted 8 lines
drivers/firmware/qcom_scm-32.c +8 -0
+	} cfg;
+
+	cfg.id = cpu_to_le32(sec_id);
+
+	ret = qcom_scm_call(QCOM_SCM_OCMEM_SECURE_SVC, QCOM_SCM_OCMEM_SECURE_CFG,
+			&cfg, sizeof(cfg), &scm_ret, sizeof(scm_ret));
+
+	if (ret || scm_ret)
Signature · 6 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
author
#8 lore raw

Re: [PATCH 4/6] qcom-scm: add ocmem support

Quoted 20 lines · Stephen Boyd

drivers/firmware/qcom_scm-32.c int __qcom_scm_hdcp_req(struct qcom_scm_hdcp_req *req, u32 req_cnt, u32 *resp) · line 506

Quoted 12 lines · Rob Clark
drivers/firmware/qcom_scm-32.c +4 -0
index c1e4325..e1ac97f 100644
@@ -500,6 +500,59 @@ int __qcom_scm_hdcp_req(struct qcom_scm_hdcp_req *req, u32 req_cnt, u32 *resp)
              req, req_cnt * sizeof(*req), resp, sizeof(*resp));
 }
 
+int __qcom_scm_ocmem_secure_cfg(unsigned sec_id)
+{
+     int ret, scm_ret = 0;
+     struct msm_scm_sec_cfg {

We've left these as anonymous structs for things like qcom_scm_set_boot_addr(), maybe we should do the same here.

drivers/firmware/qcom_scm-32.c int __qcom_scm_hdcp_req(struct qcom_scm_hdcp_req *req, u32 req_cnt, u32 *resp) · line 508

Quoted 2 lines
drivers/firmware/qcom_scm-32.c +2 -0
+             __le32 id;
+             __le32 spare;
Quoted 6 lines

Also, the iommu driver would use this API and it uses this "spare" element, so perhaps this whole function should be renamed to be more generic and take two values. Downstream the function is called scm_restore_sec_cfg, so maybe something similar. And the service id is MP for "memory protection", so QCOM_SCM_OCMEM_SECURE_SVC could be QCOM_SCM_MEMORY_PROTECTION?

heh,

    #define SCM_SVC_MP            0xC
    #define IOMMU_SECURE_CFG    2

vs.

    #define OCMEM_SECURE_SVC_ID 12
    #define OCMEM_SECURE_CFG_ID 0x2

that wasn't obscure at all!

Maybe then there is a better name than spare? Looks like downstream iommu calls it cb_num?

BR,
-R

Quoted 14 lines

Otherwise this patch looks good.

drivers/firmware/qcom_scm-32.c int __qcom_scm_hdcp_req(struct qcom_scm_hdcp_req *req, u32 req_cnt, u32 *resp) · line 516

Quoted 8 lines
drivers/firmware/qcom_scm-32.c +8 -0
+     } cfg;
+
+     cfg.id = cpu_to_le32(sec_id);
+
+     ret = qcom_scm_call(QCOM_SCM_OCMEM_SECURE_SVC, QCOM_SCM_OCMEM_SECURE_CFG,
+                     &cfg, sizeof(cfg), &scm_ret, sizeof(scm_ret));
+
+     if (ret || scm_ret)

--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#9 lore raw

Re: [PATCH 4/6] qcom-scm: add ocmem support

Quoted 33 lines · Rob Clark
Quoted 20 lines · Stephen Boyd

drivers/firmware/qcom_scm-32.c int __qcom_scm_hdcp_req(struct qcom_scm_hdcp_req *req, u32 req_cnt, u32 *resp) · line 506

Quoted 12 lines · Rob Clark
drivers/firmware/qcom_scm-32.c +4 -0
index c1e4325..e1ac97f 100644
@@ -500,6 +500,59 @@ int __qcom_scm_hdcp_req(struct qcom_scm_hdcp_req *req, u32 req_cnt, u32 *resp)
              req, req_cnt * sizeof(*req), resp, sizeof(*resp));
 }
 
+int __qcom_scm_ocmem_secure_cfg(unsigned sec_id)
+{
+     int ret, scm_ret = 0;
+     struct msm_scm_sec_cfg {

We've left these as anonymous structs for things like qcom_scm_set_boot_addr(), maybe we should do the same here.

drivers/firmware/qcom_scm-32.c int __qcom_scm_hdcp_req(struct qcom_scm_hdcp_req *req, u32 req_cnt, u32 *resp) · line 508

Quoted 2 lines
drivers/firmware/qcom_scm-32.c +2 -0
+             __le32 id;
+             __le32 spare;
Quoted 6 lines

Also, the iommu driver would use this API and it uses this "spare" element, so perhaps this whole function should be renamed to be more generic and take two values. Downstream the function is called scm_restore_sec_cfg, so maybe something similar. And the service id is MP for "memory protection", so QCOM_SCM_OCMEM_SECURE_SVC could be QCOM_SCM_MEMORY_PROTECTION?

heh,

    #define SCM_SVC_MP            0xC
    #define IOMMU_SECURE_CFG    2
Quoted 6 lines

vs.

    #define OCMEM_SECURE_SVC_ID 12
    #define OCMEM_SECURE_CFG_ID 0x2

that wasn't obscure at all!

:)

Quoted 3 lines

Maybe then there is a better name than spare? Looks like downstream iommu calls it cb_num?

Yeah I think that's the only use to indicate which context bank it is. Maybe we can have a single id configure API and a special iommu context bank API that both funnel into the same private two number API. Otherwise we have a bunch of callers passing 0 for the second argument because they don't care.

Signature · 6 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#14 lore raw

Re: [PATCH 6/6] drm/msm: add OCMEM driver

In reply to Rob Clark

Hi Rob,

Thanks for your work.

Quoted 2 lines · Rob Clark

For now, since the GPU is the only upstream consumer, just stuff this into drm/msm. Eventually if we have other consumers, we'll have to

As the video encoder/decoder driver (vidc) for apq8084 && msm8974 also use the ocmem for scratch buffers, it might be better to relocate the ocmem driver in drivers/soc/qcom from the beginning?

I'm working on vidc driver upstream version so it will be nice to test ocmem driver from it, too.

Quoted 18 lines

split this out and make the allocation less hard coded. But I'll punt on that until I better understand the non-gpu uses-cases (and whether the allocation *really* needs to be as complicated as it is in the downstream driver).

---
 drivers/gpu/drm/msm/Makefile          |   3 +-
 drivers/gpu/drm/msm/adreno/a3xx_gpu.c |  19 +-
 drivers/gpu/drm/msm/adreno/a4xx_gpu.c |  19 +-
 drivers/gpu/drm/msm/msm_drv.c         |   2 +
 drivers/gpu/drm/msm/msm_gpu.h         |   3 +
 drivers/gpu/drm/msm/ocmem/ocmem.c     | 399 ++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/msm/ocmem/ocmem.h     |  46 ++++
 7 files changed, 463 insertions(+), 28 deletions(-)
 create mode 100644 drivers/gpu/drm/msm/ocmem/ocmem.c
 create mode 100644 drivers/gpu/drm/msm/ocmem/ocmem.h

<snip>

Signature · 2 lines
regards,
Stan
author
#15 lore raw

Re: [PATCH 6/6] drm/msm: add OCMEM driver

Quoted 11 lines · Stanimir Varbanov

Hi Rob,

Thanks for your work.

Quoted 2 lines · Rob Clark

For now, since the GPU is the only upstream consumer, just stuff this into drm/msm. Eventually if we have other consumers, we'll have to

As the video encoder/decoder driver (vidc) for apq8084 && msm8974 also use the ocmem for scratch buffers, it might be better to relocate the ocmem driver in drivers/soc/qcom from the beginning?

I wasn't really sure how soon vidc would support 8084/8974 (I assume first target is 8916 which fortunately doesn't have ocmem), or if it was mandatory or just power optimization.. but yes, the plan was to move it somewhere else (not sure quite where, drivers/doc/qcom?) sometime.. Preferably when someone who understands all the other ocmem use-cases better could figure out what we really need to add to the driver.

In downstream driver there is a lot of complexity that appears to be in order to allow two clients to each allocate a portion of a macro within a region (ie. aggregate_macro_state(), apply_macro_vote(), etc), and I wanted to figure out if that is even a valid use-case before trying to make ocmem something that could actually support multiple clients.

There is also some complexity about ensuring that if clients aren't split up on region boundaries, that you don't have one client in region asking for wide-mode and other for narrow-mode.. (switch_region_mode()) but maybe we could handle that by just allocating wide from bottom and narrow from top. Also seems to be some craziness for allowing one client to pre-empt/evict another.. a dm engine, etc, etc..

All I know is gpu just statically allocates one big region aligned chunk of ocmem, so I ignored the rest of the crazy (maybe or maybe not hypothetical) use-cases for now...

BR,
-R

Quoted 22 lines

I'm working on vidc driver upstream version so it will be nice to test ocmem driver from it, too.

Quoted 6 lines

split this out and make the allocation less hard coded. But I'll punt on that until I better understand the non-gpu uses-cases (and whether the allocation *really* needs to be as complicated as it is in the downstream driver).

Quoted 12 lines
---
 drivers/gpu/drm/msm/Makefile          |   3 +-
 drivers/gpu/drm/msm/adreno/a3xx_gpu.c |  19 +-
 drivers/gpu/drm/msm/adreno/a4xx_gpu.c |  19 +-
 drivers/gpu/drm/msm/msm_drv.c         |   2 +
 drivers/gpu/drm/msm/msm_gpu.h         |   3 +
 drivers/gpu/drm/msm/ocmem/ocmem.c     | 399 ++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/msm/ocmem/ocmem.h     |  46 ++++
 7 files changed, 463 insertions(+), 28 deletions(-)
 create mode 100644 drivers/gpu/drm/msm/ocmem/ocmem.c
 create mode 100644 drivers/gpu/drm/msm/ocmem/ocmem.h
Quoted 5 lines

<snip>

--
regards,
Stan

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

author
#16 lore raw

Re: [PATCH 6/6] drm/msm: add OCMEM driver

Quoted 37 lines · Rob Clark
Quoted 11 lines · Stanimir Varbanov

Hi Rob,

Thanks for your work.

Quoted 2 lines · Rob Clark

For now, since the GPU is the only upstream consumer, just stuff this into drm/msm. Eventually if we have other consumers, we'll have to

As the video encoder/decoder driver (vidc) for apq8084 && msm8974 also use the ocmem for scratch buffers, it might be better to relocate the ocmem driver in drivers/soc/qcom from the beginning?

I wasn't really sure how soon vidc would support 8084/8974 (I assume first target is 8916 which fortunately doesn't have ocmem), or if it was mandatory or just power optimization.. but yes, the plan was to move it somewhere else (not sure quite where, drivers/doc/qcom?) sometime.. Preferably when someone who understands all the other ocmem use-cases better could figure out what we really need to add to the driver.

In downstream driver there is a lot of complexity that appears to be in order to allow two clients to each allocate a portion of a macro within a region (ie. aggregate_macro_state(), apply_macro_vote(), etc), and I wanted to figure out if that is even a valid use-case before trying to make ocmem something that could actually support multiple clients.

There is also some complexity about ensuring that if clients aren't split up on region boundaries, that you don't have one client in region asking for wide-mode and other for narrow-mode.. (switch_region_mode()) but maybe we could handle that by just allocating wide from bottom and narrow from top. Also seems to be some craziness for allowing one client to pre-empt/evict another.. a dm engine, etc, etc..

Quoted 3 lines

All I know is gpu just statically allocates one big region aligned chunk of ocmem, so I ignored the rest of the crazy (maybe or maybe not hypothetical) use-cases for now...

btw, I should add that I don't mind adding it in drivers/soc/qcom (or somewhere else?) to start with if others prefer, I just didn't want to give the wrong impression that it is ready yet for multiple clients.

All I know is the gpu uses it statically and is pretty much useless without ocmem, so for lack of understanding of the other use cases I just tried to add simply what the gpu needs..

BR,
-R

Quoted 28 lines
Quoted 28 lines

I'm working on vidc driver upstream version so it will be nice to test ocmem driver from it, too.

Quoted 6 lines

split this out and make the allocation less hard coded. But I'll punt on that until I better understand the non-gpu uses-cases (and whether the allocation *really* needs to be as complicated as it is in the downstream driver).

Quoted 12 lines
---
 drivers/gpu/drm/msm/Makefile          |   3 +-
 drivers/gpu/drm/msm/adreno/a3xx_gpu.c |  19 +-
 drivers/gpu/drm/msm/adreno/a4xx_gpu.c |  19 +-
 drivers/gpu/drm/msm/msm_drv.c         |   2 +
 drivers/gpu/drm/msm/msm_gpu.h         |   3 +
 drivers/gpu/drm/msm/ocmem/ocmem.c     | 399 ++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/msm/ocmem/ocmem.h     |  46 ++++
 7 files changed, 463 insertions(+), 28 deletions(-)
 create mode 100644 drivers/gpu/drm/msm/ocmem/ocmem.c
 create mode 100644 drivers/gpu/drm/msm/ocmem/ocmem.h

<snip>

--
regards,
Stan

#17 lore raw

Re: [PATCH 6/6] drm/msm: add OCMEM driver

Quoted 11 lines · Rob Clark
Quoted 10 lines · Rob Clark
Quoted 8 lines · Stanimir Varbanov

Hi Rob,

Thanks for your work.

Quoted 2 lines · Rob Clark

For now, since the GPU is the only upstream consumer, just stuff this into drm/msm. Eventually if we have other consumers, we'll have to

Quoted 6 lines
Quoted 6 lines
Quoted 3 lines

As the video encoder/decoder driver (vidc) for apq8084 && msm8974 also use the ocmem for scratch buffers, it might be better to relocate the ocmem driver in drivers/soc/qcom from the beginning?

I wasn't really sure how soon vidc would support 8084/8974 (I assume first target is 8916 which fortunately doesn't have ocmem), or if it

My expectations are that the same driver will work on apq8084, as well.

Quoted 21 lines
Quoted 21 lines

was mandatory or just power optimization.. but yes, the plan was to move it somewhere else (not sure quite where, drivers/doc/qcom?) sometime.. Preferably when someone who understands all the other ocmem use-cases better could figure out what we really need to add to the driver.

In downstream driver there is a lot of complexity that appears to be in order to allow two clients to each allocate a portion of a macro within a region (ie. aggregate_macro_state(), apply_macro_vote(), etc), and I wanted to figure out if that is even a valid use-case before trying to make ocmem something that could actually support multiple clients.

There is also some complexity about ensuring that if clients aren't split up on region boundaries, that you don't have one client in region asking for wide-mode and other for narrow-mode.. (switch_region_mode()) but maybe we could handle that by just allocating wide from bottom and narrow from top. Also seems to be some craziness for allowing one client to pre-empt/evict another.. a dm engine, etc, etc..

Quoted 3 lines
Quoted 3 lines

All I know is gpu just statically allocates one big region aligned chunk of ocmem, so I ignored the rest of the crazy (maybe or maybe not hypothetical) use-cases for now...

OK, I will try to sort out ocmem use cases for vidc driver.

Quoted 4 lines

btw, I should add that I don't mind adding it in drivers/soc/qcom (or somewhere else?) to start with if others prefer, I just didn't want to give the wrong impression that it is ready yet for multiple clients.

I see. Then to avoid confusions you could remove all clients and keep only graphics from ocmem_client enum.

Quoted 4 lines

All I know is the gpu uses it statically and is pretty much useless without ocmem, so for lack of understanding of the other use cases I just tried to add simply what the gpu needs..

Got it now, thanks.

Signature · 2 lines
regards,
Stan
#18 lore raw

Re: [PATCH 6/6] drm/msm: add OCMEM driver

Quoted 26 lines · Stanimir Varbanov
Quoted 25 lines · Rob Clark
Quoted 24 lines · Rob Clark
Quoted 1 line · Stanimir Varbanov

On 09/29/2015 10:48 PM, Rob Clark wrote:

was mandatory or just power optimization.. but yes, the plan was to move it somewhere else (not sure quite where, drivers/doc/qcom?) sometime.. Preferably when someone who understands all the other ocmem use-cases better could figure out what we really need to add to the driver.

In downstream driver there is a lot of complexity that appears to be in order to allow two clients to each allocate a portion of a macro within a region (ie. aggregate_macro_state(), apply_macro_vote(), etc), and I wanted to figure out if that is even a valid use-case before trying to make ocmem something that could actually support multiple clients.

There is also some complexity about ensuring that if clients aren't split up on region boundaries, that you don't have one client in region asking for wide-mode and other for narrow-mode.. (switch_region_mode()) but maybe we could handle that by just allocating wide from bottom and narrow from top. Also seems to be some craziness for allowing one client to pre-empt/evict another.. a dm engine, etc, etc..

Quoted 6 lines
Quoted 3 lines
Quoted 3 lines

All I know is gpu just statically allocates one big region aligned chunk of ocmem, so I ignored the rest of the crazy (maybe or maybe not hypothetical) use-cases for now...

OK, I will try to sort out ocmem use cases for vidc driver.

The simplest thing to do is to split the memory between GPU and vidc statically. The other use cases with preemption and eviction and DMA add a lot of complexity that we can explore at a later time if need be.

Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
author
#19 lore raw

Re: [PATCH 6/6] drm/msm: add OCMEM driver

Quoted 31 lines · Stephen Boyd
Quoted 30 lines · Stanimir Varbanov
Quoted 28 lines · Rob Clark
Quoted 27 lines · Rob Clark
Quoted 1 line · Stanimir Varbanov

On 09/29/2015 10:48 PM, Rob Clark wrote:

was mandatory or just power optimization.. but yes, the plan was to move it somewhere else (not sure quite where, drivers/doc/qcom?) sometime.. Preferably when someone who understands all the other ocmem use-cases better could figure out what we really need to add to the driver.

In downstream driver there is a lot of complexity that appears to be in order to allow two clients to each allocate a portion of a macro within a region (ie. aggregate_macro_state(), apply_macro_vote(), etc), and I wanted to figure out if that is even a valid use-case before trying to make ocmem something that could actually support multiple clients.

There is also some complexity about ensuring that if clients aren't split up on region boundaries, that you don't have one client in region asking for wide-mode and other for narrow-mode.. (switch_region_mode()) but maybe we could handle that by just allocating wide from bottom and narrow from top. Also seems to be some craziness for allowing one client to pre-empt/evict another.. a dm engine, etc, etc..

All I know is gpu just statically allocates one big region aligned chunk of ocmem, so I ignored the rest of the crazy (maybe or maybe not hypothetical) use-cases for now...

Quoted 7 lines
Quoted 2 lines

OK, I will try to sort out ocmem use cases for vidc driver.

The simplest thing to do is to split the memory between GPU and vidc statically. The other use cases with preemption and eviction and DMA add a lot of complexity that we can explore at a later time if need be.

true, as long as one of the clients is the static gpu client, I guess we could reasonably easily support up to two clients reasonably easily...

BR,
-R

Quoted 3 lines

--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

author
#10 lore raw

Re: [PATCH 4/6] qcom-scm: add ocmem support

In reply to Stephen Boyd
Quoted 44 lines · Stephen Boyd
Quoted 33 lines · Rob Clark
Quoted 20 lines · Stephen Boyd

drivers/firmware/qcom_scm-32.c int __qcom_scm_hdcp_req(struct qcom_scm_hdcp_req *req, u32 req_cnt, u32 *resp) · line 506

Quoted 12 lines · Rob Clark
drivers/firmware/qcom_scm-32.c +4 -0
index c1e4325..e1ac97f 100644
@@ -500,6 +500,59 @@ int __qcom_scm_hdcp_req(struct qcom_scm_hdcp_req *req, u32 req_cnt, u32 *resp)
              req, req_cnt * sizeof(*req), resp, sizeof(*resp));
 }
 
+int __qcom_scm_ocmem_secure_cfg(unsigned sec_id)
+{
+     int ret, scm_ret = 0;
+     struct msm_scm_sec_cfg {

We've left these as anonymous structs for things like qcom_scm_set_boot_addr(), maybe we should do the same here.

drivers/firmware/qcom_scm-32.c int __qcom_scm_hdcp_req(struct qcom_scm_hdcp_req *req, u32 req_cnt, u32 *resp) · line 508

Quoted 2 lines
drivers/firmware/qcom_scm-32.c +2 -0
+             __le32 id;
+             __le32 spare;
Quoted 6 lines

Also, the iommu driver would use this API and it uses this "spare" element, so perhaps this whole function should be renamed to be more generic and take two values. Downstream the function is called scm_restore_sec_cfg, so maybe something similar. And the service id is MP for "memory protection", so QCOM_SCM_OCMEM_SECURE_SVC could be QCOM_SCM_MEMORY_PROTECTION?

heh,

    #define SCM_SVC_MP            0xC
    #define IOMMU_SECURE_CFG    2
Quoted 6 lines

vs.

    #define OCMEM_SECURE_SVC_ID 12
    #define OCMEM_SECURE_CFG_ID 0x2

that wasn't obscure at all!

:)

Quoted 1 line
Quoted 8 lines
Quoted 2 lines

Maybe then there is a better name than spare? Looks like downstream iommu calls it cb_num?

Yeah I think that's the only use to indicate which context bank it is. Maybe we can have a single id configure API and a special iommu context bank API that both funnel into the same private two number API. Otherwise we have a bunch of callers passing 0 for the second argument because they don't care.

so fwiw, I went thru all the downstream scm_call() callers.. there are a lot of callers to SCM_SVC_MP service (through a couple different #defines), but most of them are different cmd-id's. The ones using SECURE_CFG (0x2) are:

* dwc3_msm_restore_sec_config()
* ocmem_restore_sec_program()
* msm_iommu_sec_program_iommu()

so we have two points passing in zero for ctx-bank, one that does not. I don't think it is worth having two API's to save hard-coding zero in two places ;-)

BR,
-R

Quoted 3 lines

--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#11 lore raw

Re: [PATCH 4/6] qcom-scm: add ocmem support

Quoted 15 lines · Rob Clark
Quoted 8 lines · Stephen Boyd
Quoted 1 line · Rob Clark

On Tue, Sep 29, 2015 at 5:38 PM, Stephen Boyd <[email protected]> wrote:

Yeah I think that's the only use to indicate which context bank it is. Maybe we can have a single id configure API and a special iommu context bank API that both funnel into the same private two number API. Otherwise we have a bunch of callers passing 0 for the second argument because they don't care.

so fwiw, I went thru all the downstream scm_call() callers.. there are a lot of callers to SCM_SVC_MP service (through a couple different #defines), but most of them are different cmd-id's. The ones using SECURE_CFG (0x2) are:

Quoted 8 lines

* dwc3_msm_restore_sec_config()
* ocmem_restore_sec_program()
* msm_iommu_sec_program_iommu()

so we have two points passing in zero for ctx-bank, one that does not. I don't think it is worth having two API's to save hard-coding zero in two places ;-)

What sources are you looking at? It seems like whatever you have is over a year old. About a year ago, we consolidated all calls to this specific SCM call into a single API called scm_restore_sec_cfg (see commit 9933a272db9a5612bcc2ee0ef9149f70c8166eb3 "qcom: scm: Provide an API that restores security configuration" on msm-3.10).

Looking at our latest msm-3.10 branch I see

drivers/crypto/msm/ice.c: ret = scm_restore_sec_cfg(cbuf.device_id, cbuf.spare, &scm_ret);

cbuf.spare is 0 here.

drivers/iommu/msm_iommu_sec.c: ret = scm_restore_sec_cfg(drvdata->sec_id, ctx_drvdata->num, &scm_ret);

This is the only real user of spare

drivers/pci/host/pci-msm.c:  ret = scm_restore_sec_cfg(dev->scm_dev_id, 0, &scm_ret);
drivers/scsi/ufs/ufs-qcom.c: ret = scm_restore_sec_cfg(cbuf.device_id, cbuf.spare, &scm_ret);

cbuf.spare is 0 here.

drivers/soc/qcom/ocmem_core.c: rc = scm_restore_sec_cfg(sec_id, 0, &scm_ret);
drivers/video/msm/mdss/mdss_mdp.c: ret = scm_restore_sec_cfg(SEC_DEVICE_MDSS, 0, &scm_ret);

So that's 6 callers and 1 uses the second argument.

Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
author
#20 lore raw

Re: [PATCH 6/6] drm/msm: add OCMEM driver

In reply to Rob Clark
Quoted 35 lines · Rob Clark
Quoted 34 lines · Stephen Boyd
Quoted 32 lines · Stanimir Varbanov
Quoted 25 lines · Rob Clark
Quoted 24 lines · Rob Clark
Quoted 1 line · Stanimir Varbanov

On 09/29/2015 10:48 PM, Rob Clark wrote:

was mandatory or just power optimization.. but yes, the plan was to move it somewhere else (not sure quite where, drivers/doc/qcom?) sometime.. Preferably when someone who understands all the other ocmem use-cases better could figure out what we really need to add to the driver.

In downstream driver there is a lot of complexity that appears to be in order to allow two clients to each allocate a portion of a macro within a region (ie. aggregate_macro_state(), apply_macro_vote(), etc), and I wanted to figure out if that is even a valid use-case before trying to make ocmem something that could actually support multiple clients.

There is also some complexity about ensuring that if clients aren't split up on region boundaries, that you don't have one client in region asking for wide-mode and other for narrow-mode.. (switch_region_mode()) but maybe we could handle that by just allocating wide from bottom and narrow from top. Also seems to be some craziness for allowing one client to pre-empt/evict another.. a dm engine, etc, etc..

Quoted 3 lines
Quoted 3 lines

All I know is gpu just statically allocates one big region aligned chunk of ocmem, so I ignored the rest of the crazy (maybe or maybe not hypothetical) use-cases for now...

OK, I will try to sort out ocmem use cases for vidc driver.

Quoted 8 lines
Quoted 4 lines

The simplest thing to do is to split the memory between GPU and vidc statically. The other use cases with preemption and eviction and DMA add a lot of complexity that we can explore at a later time if need be.

true, as long as one of the clients is the static gpu client, I guess we could reasonably easily support up to two clients reasonably easily...

btw, random thought.. drm_mm is a utility in drm that serves a similar function to genalloc for graphics drivers to manage their address space(s) (used for everything from mmap virtual address space of buffers allocated against device to managing vram and gart allocations, etc... when vram carveout is used w/ drm/msm (due to no iommu) I use it to manage allocations from the carveout). It has some potentially convenient twists, like supporting allocation from top of the "address space" instead of bottom. I'm thinking in particular of allocating "narrow mode" allocations from top and "wide mode" from bottom since wide vs narrow can only be set per region and not per macro within the region. (It can also search by first-fit or best-fit.. although not sure if that is useful to us, since OCMEM size is relatively constrained.)

Not that I really want to keep ocmem allocator in drm.. I'd really rather it be someone else's headache once it gets to implementing the crazy stuff for all the random use-cases of other OCMEM users, since gpu's use of OCMEM is rather simple/static..

The way downstream driver does this is with a bunch of extra bookkeeping on top of genalloc so it can do a dummy allocation to force "from the top" allocation (and then immediately freeing the dummy allocation).. Maybe it just makes sense to teach genalloc how to do from-top vs from-bottom allocations? Not really sure..

BR,
-R
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#21 lore raw

Re: [PATCH 6/6] drm/msm: add OCMEM driver

Quoted 31 lines · Rob Clark
Quoted 10 lines · Rob Clark
Quoted 5 lines · Stephen Boyd

The simplest thing to do is to split the memory between GPU and vidc statically. The other use cases with preemption and eviction and DMA add a lot of complexity that we can explore at a later time if need be.

true, as long as one of the clients is the static gpu client, I guess we could reasonably easily support up to two clients reasonably easily...

btw, random thought.. drm_mm is a utility in drm that serves a similar function to genalloc for graphics drivers to manage their address space(s) (used for everything from mmap virtual address space of buffers allocated against device to managing vram and gart allocations, etc... when vram carveout is used w/ drm/msm (due to no iommu) I use it to manage allocations from the carveout). It has some potentially convenient twists, like supporting allocation from top of the "address space" instead of bottom. I'm thinking in particular of allocating "narrow mode" allocations from top and "wide mode" from bottom since wide vs narrow can only be set per region and not per macro within the region. (It can also search by first-fit or best-fit.. although not sure if that is useful to us, since OCMEM size is relatively constrained.)

Not that I really want to keep ocmem allocator in drm.. I'd really rather it be someone else's headache once it gets to implementing the crazy stuff for all the random use-cases of other OCMEM users, since gpu's use of OCMEM is rather simple/static..

Quoted 6 lines

The way downstream driver does this is with a bunch of extra bookkeeping on top of genalloc so it can do a dummy allocation to force "from the top" allocation (and then immediately freeing the dummy allocation).. Maybe it just makes sense to teach genalloc how to do from-top vs from-bottom allocations? Not really sure..

It looks like video and GPU both use wide mode, if I'm reading the code correctly. So it seems that we don't need to do anything special for allocations, just hand the GPU and vidc a chunk of the memory in wide mode and then let the GPU and vidc drivers manage buffers within their chunk however they see fit.

One pitfall is going to be power management. ocmem is closely tied to the GPU power domains, so when video is using its chunk of memory we're going to need to keep ocmem powered up even if the GPU is off. I suppose for now we can just leave it always powered on once the driver probes, but if we ever want to turn it off we're going to need some tracking mechanism to make sure we don't turn it off when buffers are in use.

Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
author
#22 lore raw

Re: [PATCH 6/6] drm/msm: add OCMEM driver

Quoted 39 lines · Stephen Boyd
Quoted 31 lines · Rob Clark
Quoted 10 lines · Rob Clark
Quoted 5 lines · Stephen Boyd

The simplest thing to do is to split the memory between GPU and vidc statically. The other use cases with preemption and eviction and DMA add a lot of complexity that we can explore at a later time if need be.

true, as long as one of the clients is the static gpu client, I guess we could reasonably easily support up to two clients reasonably easily...

btw, random thought.. drm_mm is a utility in drm that serves a similar function to genalloc for graphics drivers to manage their address space(s) (used for everything from mmap virtual address space of buffers allocated against device to managing vram and gart allocations, etc... when vram carveout is used w/ drm/msm (due to no iommu) I use it to manage allocations from the carveout). It has some potentially convenient twists, like supporting allocation from top of the "address space" instead of bottom. I'm thinking in particular of allocating "narrow mode" allocations from top and "wide mode" from bottom since wide vs narrow can only be set per region and not per macro within the region. (It can also search by first-fit or best-fit.. although not sure if that is useful to us, since OCMEM size is relatively constrained.)

Not that I really want to keep ocmem allocator in drm.. I'd really rather it be someone else's headache once it gets to implementing the crazy stuff for all the random use-cases of other OCMEM users, since gpu's use of OCMEM is rather simple/static..

Quoted 6 lines

The way downstream driver does this is with a bunch of extra bookkeeping on top of genalloc so it can do a dummy allocation to force "from the top" allocation (and then immediately freeing the dummy allocation).. Maybe it just makes sense to teach genalloc how to do from-top vs from-bottom allocations? Not really sure..

Quoted 5 lines

It looks like video and GPU both use wide mode, if I'm reading the code correctly. So it seems that we don't need to do anything special for allocations, just hand the GPU and vidc a chunk of the memory in wide mode and then let the GPU and vidc drivers manage buffers within their chunk however they see fit.

right, I think it is just audio that uses narrow-mode.. and at that point I think we need to use rpm for configuring things, since I guess audio wants to do some of that from dsp for low-power audio playback type use-cases?? Maybe we can ignore this for a while.. although when we get to the point of fixing it, spiffing out genalloc sounds more interesting than layering a bunch of bookkeeping on top of genalloc..

Quoted 7 lines

One pitfall is going to be power management. ocmem is closely tied to the GPU power domains, so when video is using its chunk of memory we're going to need to keep ocmem powered up even if the GPU is off. I suppose for now we can just leave it always powered on once the driver probes, but if we ever want to turn it off we're going to need some tracking mechanism to make sure we don't turn it off when buffers are in use.

part of the problem that right now drm/msm is going to hold onto it's allocation even when it clks down gpu. I suppose not terribly difficult to fix (although one reason why I didn't bother making things terribly dynamic w/ clk mgmt or macro mode state in current ocmem patch).. at this point I'm still more at the 'just try to make it work in the first place' stage, rather than worrying too much about optimizing for power..

BR,
-R