[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d2be49af-71e4-978b-fe00-8b8fca6f80b5@linux.intel.com>
Date: Tue, 9 Aug 2022 15:05:01 +0300
From: Jarkko Nikula <jarkko.nikula@...ux.intel.com>
To: Jan Dabros <jsd@...ihalf.com>, linux-kernel@...r.kernel.org,
linux-i2c@...r.kernel.org, andriy.shevchenko@...ux.intel.com
Cc: mika.westerberg@...ux.intel.com, wsa@...nel.org,
rrangel@...omium.org, mw@...ihalf.com, upstream@...ihalf.com
Subject: Re: [PATCH] i2c: designware: Introduce cooldown timer to AMDPSP
driver
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@...ihalf.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.
Powered by blists - more mailing lists