public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
From: Jarkko Nikula <jarkko.nikula@linux.intel.com>
To: Jan Dabros <jsd@semihalf.com>,
	linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org,
	andriy.shevchenko@linux.intel.com
Cc: mika.westerberg@linux.intel.com, wsa@kernel.org,
	rrangel@chromium.org, mw@semihalf.com, upstream@semihalf.com
Subject: Re: [PATCH] i2c: designware: Introduce cooldown timer to AMDPSP driver
Date: Tue, 9 Aug 2022 15:05:01 +0300	[thread overview]
Message-ID: <d2be49af-71e4-978b-fe00-8b8fca6f80b5@linux.intel.com> (raw)
In-Reply-To: <20220725080240.106619-1-jsd@semihalf.com>

Hi

Sorry the delay, this slipped through my eyes during vacation. Couple 
minor comments below.

On 7/25/22 11:02, Jan Dabros wrote:
> In order to optimize performance, limit amount of back and forth
> transactions between x86 and PSP. This is done by introduction of
> cooldown period - that is window in which x86 isn't releasing the bus
> immediately after each I2C transaction.
> 
> In order to protect PSP from being starved while waiting for
> arbitration, after a programmed time bus is automatically released by a
> deferred function.
> 
> Signed-off-by: Jan Dabros <jsd@semihalf.com>
> ---
>   drivers/i2c/busses/i2c-designware-amdpsp.c | 68 +++++++++++++++++-----
>   1 file changed, 53 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-designware-amdpsp.c b/drivers/i2c/busses/i2c-designware-amdpsp.c
> index b624356c945f..2e1bb5ae72c3 100644
> --- a/drivers/i2c/busses/i2c-designware-amdpsp.c
> +++ b/drivers/i2c/busses/i2c-designware-amdpsp.c
> @@ -6,6 +6,7 @@
>   #include <linux/io-64-nonatomic-lo-hi.h>
>   #include <linux/psp-sev.h>
>   #include <linux/types.h>
> +#include <linux/workqueue.h>
>   
>   #include <asm/msr.h>
>   
> @@ -15,6 +16,8 @@
>   #define PSP_MBOX_OFFSET		0x10570
>   #define PSP_CMD_TIMEOUT_US	(500 * USEC_PER_MSEC)
>   
> +#define PSP_I2C_COOLDOWN_TIME_MS 100
> +

"cooldown" distract me thinking thermal management. Would semaphore 
reservation time/timer fit better?

> +static void release_bus_now(void)
> +static void psp_release_i2c_bus_deferred(struct work_struct *work)
> +static DECLARE_DELAYED_WORK(release_queue, psp_release_i2c_bus_deferred);
> +

I'd use the same namespace here. Perhaps _now can be dropped from the 
name since the release_bus and release_bus_deferred are near to each 
other and _deferred variant implies it's called after timeout.

> +	/*
> +	 * Send a release command to PSP if the cooldown timeout elapsed but x86 still
> +	 * owns the ctrlr.
> +	 */

Replace "ctrlr" -> "control" here since then it doesn't lead to think 
is't some technical object like register etc.

  parent reply	other threads:[~2022-08-09 12:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-25  8:02 [PATCH] i2c: designware: Introduce cooldown timer to AMDPSP driver Jan Dabros
2022-08-09  7:41 ` Jan Dąbroś
2022-08-09 12:05 ` Jarkko Nikula [this message]
2022-08-12  6:08   ` Jan Dąbroś

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d2be49af-71e4-978b-fe00-8b8fca6f80b5@linux.intel.com \
    --to=jarkko.nikula@linux.intel.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=jsd@semihalf.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mika.westerberg@linux.intel.com \
    --cc=mw@semihalf.com \
    --cc=rrangel@chromium.org \
    --cc=upstream@semihalf.com \
    --cc=wsa@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox