Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp356747pxk; Wed, 23 Sep 2020 05:16:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwZoJoxoQ3ZJNTOnIjW3rz7t07E65SuLxUfj3aFcpqXaHshOz0hblmClVyhew+EXpJu0fIc X-Received: by 2002:a17:906:7013:: with SMTP id n19mr9891497ejj.388.1600863375605; Wed, 23 Sep 2020 05:16:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600863375; cv=none; d=google.com; s=arc-20160816; b=hjPjuXvMXe3FEWWYZVQgbrBqZ2iRNBEP8oTLPU4U4GWJ9wM3CLAxb7+rQ7RgOy8zmn 3pB5/1NBnUuIWQuiyFL4+WsQgh8cvwZ+gNrHHRVu/VwcTDWctrbXAbD/LSS0z4uFbyiU uEH7+39DL52irRmPeCd//IYhMPoQRyoZusxevPN7RS9PDCpodP9ALWqZ4yy6Wlgv5STS 559UHDIjEsxLiY2gXrPLw5Q/DPMcQ0bT6jSyCFSiliVYpvVwUz7ROktKbPqIDcvN7o9c 1XUtiDiDwNzVxWy+OYX9nwnJhc3h/K2drZcLscdH2mPbzQhGohNQDhJ4s1VKbh+sq3YZ zh8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=gu4sashNSj+VH6cRzrQqHqohCiePOYZ2b0ZQyk6s8S8=; b=rFtseNxOrnhppc4mmaGjIidRRA9fRN06C4brJl6kVoAeR/O4FmZOBGl6C2XZjQdNva MQ2ifkkBvT8Ob6LidTZwgCx+zscSi8YewVqjDNw699GMq+cdYcJ+RDt4Y8OgS8YTS1Lb /yNZIb1OMNcnznBElwm5nRpctWe/tyGpPJ9I8Wb5lj1rZJKLt8qmLfk4Mtvxtx1VlAu8 z8lpKE9A3pUbVezHWZT/VbUGgpfP2PEkCuImKuhwcIQPhQIpN88Ur7/SVB4bTOkp2f3e p4R6RzEOJjKNxOqmZI4TzePamPjYcr3fnW3zlJotZvGVEPuA23hwkwhkUZuAazPqePE1 h1yQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=efBEwPlC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lu12si12478359ejb.359.2020.09.23.05.15.51; Wed, 23 Sep 2020 05:16:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=efBEwPlC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726514AbgIWMOC (ORCPT + 99 others); Wed, 23 Sep 2020 08:14:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40832 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726476AbgIWMOB (ORCPT ); Wed, 23 Sep 2020 08:14:01 -0400 Received: from mail-lf1-x143.google.com (mail-lf1-x143.google.com [IPv6:2a00:1450:4864:20::143]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6CF81C0613CE for ; Wed, 23 Sep 2020 05:14:01 -0700 (PDT) Received: by mail-lf1-x143.google.com with SMTP id y11so21819028lfl.5 for ; Wed, 23 Sep 2020 05:14:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=gu4sashNSj+VH6cRzrQqHqohCiePOYZ2b0ZQyk6s8S8=; b=efBEwPlCOEckuBHmgMtHsoL/fnc89D+RwIxdTXkNsIWcKYxF4MHDRa/XbiNq8w8roF RLPyKGNAnickTWWDrsiDm3Xsq/te01jOqjie7RowPoLes3REaHJ+v3trKHKIgkW5sFQF QGFWs1eFaehk+bu5r1FtlgQmeDf63cT2acVsTat7GVNM7eoHZTdfr9LgS8sVuL0dZILm Azba0pHV5L9CD///TbiMU1n780XsJxWcIA8MmzbOl2BSUYX62sYHXw8u1tO71tV26M8X 9SjzEzcxQ1IlXz0HyjS4Bn1MnD41irUv4QhC9AoDRblTXLlYhV9LWWMniJJNVQ8wgZxc YgkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=gu4sashNSj+VH6cRzrQqHqohCiePOYZ2b0ZQyk6s8S8=; b=etaB+IP3NS0wd8RjtoD8gDGWxBTbjyejKnX9d0sstiapSUF2S14JPVyqYZVS9umCU9 dQAf8vSIcA9QZh0gw6LEHLA35t5O3mqrlBXb4qUaFtg1huvc69T9+iAkTyoiT9HeL3n3 e6BDojoaUeEwhN+QB6oYSc2UTyQw5ER1wmYNdHcfU9zClW7/WfxP7naF/WC+1G47xrjH dwqhXgngJaarWneJDde94+kh6YAwnBCu6M43eSzATixswyhKi6YyLEn+VTAOA0HSI7q9 pM6sY1Yp/qGVYaVTUXz5wG8gbqcDH8ztq78BhNcHl+V0G3gSn72+QKZoeh7w6FtzHcns wWyg== X-Gm-Message-State: AOAM533ZW1uN9s/5uJQtSq4Nj7B9iNM+iwvf0ohtLunXe6SgpdM85V62 WCV27jBUz5BhLbegFYqarsT4DchXQSuIzg== X-Received: by 2002:a19:404e:: with SMTP id n75mr3133593lfa.172.1600863239608; Wed, 23 Sep 2020 05:13:59 -0700 (PDT) Received: from jade (h-249-223.A175.priv.bahnhof.se. [98.128.249.223]) by smtp.gmail.com with ESMTPSA id t2sm4723809lff.150.2020.09.23.05.13.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Sep 2020 05:13:58 -0700 (PDT) Date: Wed, 23 Sep 2020 14:13:56 +0200 From: Jens Wiklander To: "Jorge Ramirez-Ortiz, Foundries" Cc: sumit.garg@linaro.org, ricardo@foundries.io, mike@foundries.io, tee-dev@lists.linaro.org, linux-kernel@vger.kernel.org, op-tee@lists.trustedfirmware.org Subject: Re: [PATCH] drivers: optee: i2c: add bus retry configuration Message-ID: <20200923121356.GA1659958@jade> References: <20200916152732.23604-1-jorge@foundries.io> <20200922163859.GA1518183@jade> <20200923111813.GA30271@trex> <20200923112631.GB30271@trex> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20200923112631.GB30271@trex> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 23, 2020 at 01:26:31PM +0200, Jorge Ramirez-Ortiz, Foundries wrote: > On 23/09/20, Jorge Ramirez-Ortiz, Foundries wrote: > > On 22/09/20, Jens Wiklander wrote: > > > 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 > > > > --- > > > > 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? > > > > no I dont think so: there is no need for bus locks when requesting a > > transfer via i2c_master_recv/send; the lock for the bus segment gets > > taken later on, when the actual transfer hppens ( __i2c_transfer()) > > > > the functionality implemented in this function pretty much mimicks > > what is done in the normal world via /dev/i2c-X > > (drivers/i2c/i2c_dev.c) > > > > correction (of course) > - i2cdev_read --> i2c_master_recv > - i2cdev->write -->i2c_master_send > > > > and now the retry count setup on the adaptor with this commit. > > > > - i2cdev_ioctl I2C_RETRIES I don't understand. Do you mean that client.adapter->retries doesn't need to be protected from concurrent updates? Or is it already protected by some other mechanism? Cheers, Jens