lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200922163859.GA1518183@jade>
Date:   Tue, 22 Sep 2020 18:38:59 +0200
From:   Jens Wiklander <jens.wiklander@...aro.org>
To:     Jorge Ramirez-Ortiz <jorge@...ndries.io>
Cc:     sumit.garg@...aro.org, ricardo@...ndries.io, mike@...ndries.io,
        tee-dev@...ts.linaro.org, linux-kernel@...r.kernel.org,
        op-tee@...ts.trustedfirmware.org
Subject: Re: [PATCH] drivers: optee: i2c: add bus retry configuration

On Wed, Sep 16, 2020 at 05:27:32PM +0200, Jorge Ramirez-Ortiz wrote:
> Allow OP-TEE to specify the number of retries in the adaptor.
> 
> Signed-off-by: Jorge Ramirez-Ortiz <jorge@...ndries.io>
> ---
>  drivers/tee/optee/rpc.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/tee/optee/rpc.c b/drivers/tee/optee/rpc.c
> index 1e3614e4798f..2d46a9ecb1de 100644
> --- a/drivers/tee/optee/rpc.c
> +++ b/drivers/tee/optee/rpc.c
> @@ -58,6 +58,7 @@ static void handle_rpc_func_cmd_i2c_transfer(struct tee_context *ctx,
>  	struct tee_param *params;
>  	size_t i;
>  	int ret = -EOPNOTSUPP;
> +	int retries = 0;
>  	u8 attr[] = {
>  		TEE_IOCTL_PARAM_ATTR_TYPE_VALUE_INPUT,
>  		TEE_IOCTL_PARAM_ATTR_TYPE_VALUE_INPUT,
> @@ -102,12 +103,17 @@ static void handle_rpc_func_cmd_i2c_transfer(struct tee_context *ctx,
>  	client.addr = params[0].u.value.c;
>  	snprintf(client.name, I2C_NAME_SIZE, "i2c%d", client.adapter->nr);
>  
> +	/* cache the current value */
> +	retries = client.adapter->retries;
> +
>  	switch (params[0].u.value.a) {
>  	case OPTEE_MSG_RPC_CMD_I2C_TRANSFER_RD:
> +		client.adapter->retries = params[1].u.value.b;
Do we need to take any locks befor this?

Cheers,
Jens

>  		ret = i2c_master_recv(&client, params[2].u.memref.shm->kaddr,
>  				      params[2].u.memref.size);
>  		break;
>  	case OPTEE_MSG_RPC_CMD_I2C_TRANSFER_WR:
> +		client.adapter->retries = params[1].u.value.b;
>  		ret = i2c_master_send(&client, params[2].u.memref.shm->kaddr,
>  				      params[2].u.memref.size);
>  		break;
> @@ -126,6 +132,7 @@ static void handle_rpc_func_cmd_i2c_transfer(struct tee_context *ctx,
>  			arg->ret = TEEC_SUCCESS;
>  	}
>  
> +	client.adapter->retries = retries;
>  	i2c_put_adapter(client.adapter);
>  	kfree(params);
>  	return;
> -- 
> 2.17.1
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ