linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rafael@kernel.org>
To: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Amit Kucheria <amitk@kernel.org>,
	Linux PM <linux-pm@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] thermal/drivers/int340x: processor_thermal: Suppot 64 bit RFIM responses
Date: Thu, 4 Nov 2021 19:58:38 +0100	[thread overview]
Message-ID: <CAJZ5v0hRi+tFnCANDcMBkHs9nZxr8yh8afYtkvPhkBHzAaciJQ@mail.gmail.com> (raw)
In-Reply-To: <20211102105236.97469-1-srinivas.pandruvada@linux.intel.com>

On Tue, Nov 2, 2021 at 11:52 AM Srinivas Pandruvada
<srinivas.pandruvada@linux.intel.com> wrote:
>
> Some of the RFIM mail box command returns 64 bit values. So enhance
> mailbox interface to return 64 bit values and use them for RFIM
> commands.
>
> Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
> Fixes: 5d6fbc96bd36 ("thermal/drivers/int340x: processor_thermal: Export additional attributes")
> ---
>  .../processor_thermal_device.h                |  2 +-
>  .../int340x_thermal/processor_thermal_mbox.c  | 22 +++++++++++--------
>  .../int340x_thermal/processor_thermal_rfim.c  | 10 ++++-----
>  3 files changed, 19 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/thermal/intel/int340x_thermal/processor_thermal_device.h b/drivers/thermal/intel/int340x_thermal/processor_thermal_device.h
> index 5a1cfe4864f1..2aae91e7b13d 100644
> --- a/drivers/thermal/intel/int340x_thermal/processor_thermal_device.h
> +++ b/drivers/thermal/intel/int340x_thermal/processor_thermal_device.h
> @@ -80,7 +80,7 @@ void proc_thermal_rfim_remove(struct pci_dev *pdev);
>  int proc_thermal_mbox_add(struct pci_dev *pdev, struct proc_thermal_device *proc_priv);
>  void proc_thermal_mbox_remove(struct pci_dev *pdev);
>
> -int processor_thermal_send_mbox_cmd(struct pci_dev *pdev, u16 cmd_id, u32 cmd_data, u32 *cmd_resp);
> +int processor_thermal_send_mbox_cmd(struct pci_dev *pdev, u16 cmd_id, u32 cmd_data, u64 *cmd_resp);
>  int proc_thermal_add(struct device *dev, struct proc_thermal_device *priv);
>  void proc_thermal_remove(struct proc_thermal_device *proc_priv);
>  int proc_thermal_resume(struct device *dev);
> diff --git a/drivers/thermal/intel/int340x_thermal/processor_thermal_mbox.c b/drivers/thermal/intel/int340x_thermal/processor_thermal_mbox.c
> index 59e93b04f0a9..a86521973dad 100644
> --- a/drivers/thermal/intel/int340x_thermal/processor_thermal_mbox.c
> +++ b/drivers/thermal/intel/int340x_thermal/processor_thermal_mbox.c
> @@ -23,7 +23,7 @@
>
>  static DEFINE_MUTEX(mbox_lock);
>
> -static int send_mbox_cmd(struct pci_dev *pdev, u16 cmd_id, u32 cmd_data, u32 *cmd_resp)
> +static int send_mbox_cmd(struct pci_dev *pdev, u16 cmd_id, u32 cmd_data, u64 *cmd_resp)
>  {
>         struct proc_thermal_device *proc_priv;
>         u32 retries, data;
> @@ -68,12 +68,16 @@ static int send_mbox_cmd(struct pci_dev *pdev, u16 cmd_id, u32 cmd_data, u32 *cm
>                         goto unlock_mbox;
>                 }
>
> -               if (cmd_id == MBOX_CMD_WORKLOAD_TYPE_READ) {
> -                       data = readl((void __iomem *) (proc_priv->mmio_base + MBOX_OFFSET_DATA));
> -                       *cmd_resp = data & 0xff;
> -               }
> -
>                 ret = 0;
> +
> +               if (!cmd_resp)
> +                       break;
> +
> +               if (cmd_id == MBOX_CMD_WORKLOAD_TYPE_READ)
> +                       *cmd_resp = readl((void __iomem *) (proc_priv->mmio_base + MBOX_OFFSET_DATA));
> +               else
> +                       *cmd_resp = readq((void __iomem *) (proc_priv->mmio_base + MBOX_OFFSET_DATA));
> +
>                 break;
>         } while (--retries);
>
> @@ -82,7 +86,7 @@ static int send_mbox_cmd(struct pci_dev *pdev, u16 cmd_id, u32 cmd_data, u32 *cm
>         return ret;
>  }
>
> -int processor_thermal_send_mbox_cmd(struct pci_dev *pdev, u16 cmd_id, u32 cmd_data, u32 *cmd_resp)
> +int processor_thermal_send_mbox_cmd(struct pci_dev *pdev, u16 cmd_id, u32 cmd_data, u64 *cmd_resp)
>  {
>         return send_mbox_cmd(pdev, cmd_id, cmd_data, cmd_resp);
>  }
> @@ -153,7 +157,7 @@ static ssize_t workload_type_show(struct device *dev,
>                                    char *buf)
>  {
>         struct pci_dev *pdev = to_pci_dev(dev);
> -       u32 cmd_resp;
> +       u64 cmd_resp;
>         int ret;
>
>         ret = send_mbox_cmd(pdev, MBOX_CMD_WORKLOAD_TYPE_READ, 0, &cmd_resp);
> @@ -187,7 +191,7 @@ static bool workload_req_created;
>
>  int proc_thermal_mbox_add(struct pci_dev *pdev, struct proc_thermal_device *proc_priv)
>  {
> -       u32 cmd_resp;
> +       u64 cmd_resp;
>         int ret;
>
>         /* Check if there is a mailbox support, if fails return success */
> diff --git a/drivers/thermal/intel/int340x_thermal/processor_thermal_rfim.c b/drivers/thermal/intel/int340x_thermal/processor_thermal_rfim.c
> index 2b8a3235d518..b25b54d4bac1 100644
> --- a/drivers/thermal/intel/int340x_thermal/processor_thermal_rfim.c
> +++ b/drivers/thermal/intel/int340x_thermal/processor_thermal_rfim.c
> @@ -195,7 +195,7 @@ static ssize_t rfi_restriction_store(struct device *dev,
>                                      const char *buf, size_t count)
>  {
>         u16 cmd_id = 0x0008;
> -       u32 cmd_resp;
> +       u64 cmd_resp;
>         u32 input;
>         int ret;
>
> @@ -215,14 +215,14 @@ static ssize_t rfi_restriction_show(struct device *dev,
>                                     char *buf)
>  {
>         u16 cmd_id = 0x0007;
> -       u32 cmd_resp;
> +       u64 cmd_resp;
>         int ret;
>
>         ret = processor_thermal_send_mbox_cmd(to_pci_dev(dev), cmd_id, 0, &cmd_resp);
>         if (ret)
>                 return ret;
>
> -       return sprintf(buf, "%u\n", cmd_resp);
> +       return sprintf(buf, "%llu\n", cmd_resp);
>  }
>
>  static ssize_t ddr_data_rate_show(struct device *dev,
> @@ -230,14 +230,14 @@ static ssize_t ddr_data_rate_show(struct device *dev,
>                                   char *buf)
>  {
>         u16 cmd_id = 0x0107;
> -       u32 cmd_resp;
> +       u64 cmd_resp;
>         int ret;
>
>         ret = processor_thermal_send_mbox_cmd(to_pci_dev(dev), cmd_id, 0, &cmd_resp);
>         if (ret)
>                 return ret;
>
> -       return sprintf(buf, "%u\n", cmd_resp);
> +       return sprintf(buf, "%llu\n", cmd_resp);
>  }
>
>  static DEVICE_ATTR_RW(rfi_restriction);
> --

Applied as 5.16-rc material, thanks!

      reply	other threads:[~2021-11-04 18:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-02 10:52 [PATCH] thermal/drivers/int340x: processor_thermal: Suppot 64 bit RFIM responses Srinivas Pandruvada
2021-11-04 18:58 ` Rafael J. Wysocki [this message]

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=CAJZ5v0hRi+tFnCANDcMBkHs9nZxr8yh8afYtkvPhkBHzAaciJQ@mail.gmail.com \
    --to=rafael@kernel.org \
    --cc=amitk@kernel.org \
    --cc=daniel.lezcano@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=srinivas.pandruvada@linux.intel.com \
    /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;
as well as URLs for NNTP newsgroup(s).