From: srinivas pandruvada <srinivas.pandruvada@linux.intel.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: hdegoede@redhat.com, markgross@kernel.org,
ilpo.jarvinen@linux.intel.com,
platform-driver-x86@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/3] platform/x86/intel/tpmi: Read feature control status
Date: Wed, 12 Jul 2023 16:03:57 -0700 [thread overview]
Message-ID: <9e6873e53112ea9568fd0d1c8ef50e652ca05d84.camel@linux.intel.com> (raw)
In-Reply-To: <ZK7BL0GIPgr3alVr@smile.fi.intel.com>
On Wed, 2023-07-12 at 18:05 +0300, Andy Shevchenko wrote:
> On Tue, Jul 11, 2023 at 03:09:47PM -0700, Srinivas Pandruvada wrote:
> > Some of the PM features can be locked or disabled. In that case,
> > write
> > interface can be locked.
> >
> > This status is read via a mailbox. There is one TPMI ID which
> > provides
> > base address for interface and data register for mail box
> > operation.
> > The mailbox operations is defined in the TPMI specification. Refer
> > to
> > https://github.com/intel/tpmi_power_management/ for TPMI
> > specifications.
> >
> > An API is exposed to feature drivers to read feature control
> > status.
>
> ...
>
> > +/*
> > + * TPMI PFS and per feature memory size can't exceed 4K.
> > + * Also PFS start and feature memory is 4K aligned.
> > + */
> > +#define TPMI_MAX_BUFFER_SIZE (4 * 1024)
>
> SZ_4K from sizes.h?
>
> ...
I added a macro for size and uses sizes.h define.
>
> > +#define TPMI_CONTROL_TIMEOUT_MAX_US USEC_PER_SEC
>
> > +#define TPMI_RB_TIMEOUT_MAX_US USEC_PER_SEC
>
> I think it's easier to get in a form (1 * ..._SEC)
>
OK
> ...
>
> > +static int tpmi_wait_for_owner(struct intel_tpmi_info *tpmi_info,
> > u8 owner)
> > +{
> > + u64 control;
> > +
> > + return read_poll_timeout(readq, control,
> > + owner ==
> > FIELD_GET(TPMI_CONTROL_STATUS_OWNER, control),
> > + TPMI_CONTROL_TIMEOUT_US,
> > TPMI_CONTROL_TIMEOUT_MAX_US, false,
> > + tpmi_info->tpmi_control_mem +
> > TPMI_CONTROL_STATUS_OFFSET);
>
> Since you have "false" why not use readq_poll_timeout()?
>
Changed in new version
> > +}
>
> ...
>
> > + /* Wait for Run Busy clear */
> > + ret = read_poll_timeout(readq, control, !(control &
> > TPMI_CONTROL_STATUS_RB),
> > + TPMI_RB_TIMEOUT_US,
> > TPMI_RB_TIMEOUT_MAX_US, false,
> > + tpmi_info->tpmi_control_mem +
> > TPMI_CONTROL_STATUS_OFFSET);
>
> Ditto.
Done.
>
> > + if (ret)
> > + goto done_proc;
>
> ...
>
> > + size = pfs->pfs_header.num_entries * pfs-
> > >pfs_header.entry_size * sizeof(u32);
> > + /* This size is coming from trusted hardware, but verify
> > anyway */
>
> I would move this comment before size assignment that we already know
> that it's
> from the trusted hw.
Created a macro.
Thanks,
Srinivas
>
> > + if (size > TPMI_MAX_BUFFER_SIZE)
> > + return;
>
next prev parent reply other threads:[~2023-07-12 23:06 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-11 22:09 [PATCH v2 0/3] TPMI control and debugfs support Srinivas Pandruvada
2023-07-11 22:09 ` [PATCH v2 1/3] platform/x86/intel/tpmi: Read feature control status Srinivas Pandruvada
2023-07-12 15:05 ` Andy Shevchenko
2023-07-12 23:03 ` srinivas pandruvada [this message]
2023-07-11 22:09 ` [PATCH v2 2/3] platform/x86/intel/tpmi: Add debugfs interface Srinivas Pandruvada
2023-07-12 15:13 ` Andy Shevchenko
2023-07-12 23:06 ` srinivas pandruvada
2023-07-13 16:42 ` Andy Shevchenko
2023-07-11 22:09 ` [PATCH v2 3/3] doc: TPMI: Add debugfs documentation Srinivas Pandruvada
2023-07-12 15:14 ` Andy Shevchenko
2023-07-12 23:07 ` srinivas pandruvada
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=9e6873e53112ea9568fd0d1c8ef50e652ca05d84.camel@linux.intel.com \
--to=srinivas.pandruvada@linux.intel.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=hdegoede@redhat.com \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=markgross@kernel.org \
--cc=platform-driver-x86@vger.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.