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

Commit dbdcfc45 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "Revert "t-base-301B-V001: fix driver for new platform 8994""

parents fe28908b 7ddc407e
Loading
Loading
Loading
Loading
+18 −25
Original line number Diff line number Diff line
@@ -146,12 +146,6 @@ static inline long _smc(void *data)
	if (data == NULL)
		return -EPERM;

	#ifdef MC_SMC_FASTCALL
	{
		ret = smc_fastcall(data, sizeof(union fc_generic));
	}
	#else
	{
	union fc_generic *fc_generic = data;
	/* SMC expect values in x0-x3 */
	register u64 reg0 __asm__("x0") = fc_generic->as_in.cmd;
@@ -164,13 +158,12 @@ static inline long _smc(void *data)
		: "+r"(reg0), "+r"(reg1), "+r"(reg2), "+r"(reg3)
	);


	/* set response */
	fc_generic->as_out.resp     = reg0;
	fc_generic->as_out.ret      = reg1;
	fc_generic->as_out.param[0] = reg2;
	fc_generic->as_out.param[1] = reg3;
	}
	#endif
	return ret;
}

+0 −18
Original line number Diff line number Diff line
@@ -449,20 +449,10 @@ static int map_buffer(struct task_struct *task, void *wsm_buffer,
	 * - or fails and used_mmutable->table contains the list of page
	 * pointers.
	 * Any mixed contents will make cleanup difficult.
	 */
#if defined(CONFIG_ARM64) && !defined(LPAE_SUPPORT)
	/*
	 * When NWd pointers are 64bits and SWd pte 32bits we need to fill the
	 * table from 0.
	 */
	i = 0;
#else
	/*
	 * Fill the table in reverse order as the table is used as input and
	 * output.
	 */
	i = MC_ARM_MMU_TABLE_ENTRIES-1;
#endif
	do {
		if (i < nr_of_pages) {
#ifdef LPAE_SUPPORT
@@ -472,10 +462,6 @@ static int map_buffer(struct task_struct *task, void *wsm_buffer,
#endif
			page = mmutable_as_array_of_pointers_to_page[i];

			if (!page) {
				MCDRV_DBG_ERROR(mcd, "page address is null");
				return -EFAULT;
			}
			/*
			 * create MMU table entry, see ARM MMU docu for details
			 * about flags stored in the lowest 12 bits.
@@ -521,11 +507,7 @@ static int map_buffer(struct task_struct *task, void *wsm_buffer,
			/* ensure rest of table is empty */
			mmutable->table_entries[i] = 0;
		}
#if defined(CONFIG_ARM64) && !defined(LPAE_SUPPORT)
	} while (++i < MC_ARM_MMU_TABLE_ENTRIES);
#else
	} while (i-- != 0);
#endif

	return ret;
}
+3 −44
Original line number Diff line number Diff line
@@ -20,6 +20,8 @@
 * Header file the MobiCore Driver Kernel Module,
 * its internal structures and defines.
 */


#ifndef _MC_PLATFORM_H_
#define _MC_PLATFORM_H_

@@ -36,57 +38,14 @@
#define SCM_SVC_MOBICORE		250
#define SCM_CMD_MOBICORE		1

#ifdef CONFIG_ARM64

	#include <soc/qcom/qseecomi.h>
	#include <linux/slab.h>
	#include <linux/io.h>
	#include <linux/mm.h>
	#include <asm/cacheflush.h>
	#include <linux/errno.h>

	#define SCM_MOBIOS_FNID(s, c) (((((s) & 0xFF) << 8) | ((c) & 0xFF)) | 0x33000000)

	#define TZ_EXECUTIVE_EXT_ID_PARAM_ID \
		TZ_SYSCALL_CREATE_PARAM_ID_4( \
			TZ_SYSCALL_PARAM_TYPE_BUF_RW, TZ_SYSCALL_PARAM_TYPE_VAL, \
			TZ_SYSCALL_PARAM_TYPE_BUF_RW, TZ_SYSCALL_PARAM_TYPE_VAL)

#endif

extern int scm_call(u32 svc_id, u32 cmd_id, const void *cmd_buf, size_t cmd_len,
		    void *resp_buf, size_t resp_len);

static inline int smc_fastcall(void *fc_generic, size_t size)
{
#ifdef CONFIG_ARM64
	struct scm_desc desc = {0};
	int ret;
	void* scm_buf = NULL;

	scm_buf = kzalloc(PAGE_ALIGN(size), GFP_KERNEL);
	if (!scm_buf)
		return -ENOMEM;
	memcpy(scm_buf, fc_generic, size);
	dmac_flush_range(scm_buf, scm_buf + size);

	desc.arginfo = TZ_EXECUTIVE_EXT_ID_PARAM_ID;
	desc.args[0] = virt_to_phys(scm_buf);
	desc.args[1] = (u32)size;
	desc.args[2] = virt_to_phys(scm_buf);
	desc.args[3] = (u32)size;
	ret = scm_call2(
		SCM_MOBIOS_FNID(SCM_SVC_MOBICORE, SCM_CMD_MOBICORE),
		&desc);
	
	memcpy(fc_generic, scm_buf, size);
	kfree(scm_buf);
	return ret;
#else
	return scm_call(SCM_SVC_MOBICORE, SCM_CMD_MOBICORE,
			fc_generic, size,
			fc_generic, size);
#endif
}

/* Enable mobicore mem traces */
@@ -100,7 +59,7 @@ static inline int smc_fastcall(void *fc_generic, size_t size)
/*
 *  Perform crypto clock enable/disable
 */
#if !defined(CONFIG_ARCH_MSM8960) && !defined(CONFIG_ARCH_MSM8994)
#ifndef CONFIG_ARCH_MSM8960
#define MC_CRYPTO_CLOCK_MANAGEMENT
#endif