linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "David E. Box" <david.e.box@linux.intel.com>
To: Joe Perches <joe@perches.com>,
	hdegoede@redhat.com, gregkh@linuxfoundation.org,
	andriy.shevchenko@linux.intel.com, srinivas.pandruvada@intel.com,
	mgross@linux.intel.com
Cc: linux-kernel@vger.kernel.org,
	platform-driver-x86@vger.kernel.org,
	Mark Gross <markgross@kernel.org>
Subject: Re: [PATCH V6 1/3] platform/x86: Add Intel Software Defined Silicon driver
Date: Mon, 07 Feb 2022 18:54:40 -0800	[thread overview]
Message-ID: <d52b50f3b704280e476e60417323c98f45baf54a.camel@linux.intel.com> (raw)
In-Reply-To: <103681860759d72b1acf712eed334b1d4ef6b7d5.camel@perches.com>

On Mon, 2022-02-07 at 17:40 -0800, Joe Perches wrote:
> On Mon, 2022-02-07 at 16:54 -0800, David E. Box wrote:
> > Intel Software Defined Silicon (SDSi) is a post manufacturing mechanism for
> > activating additional silicon features. Features are enabled through a
> > license activation process.  The SDSi driver provides a per socket, sysfs
> > attribute interface for applications to perform 3 main provisioning
> > functions:
> []
> > ---
> > V6
> >   - Replace,
> >               return (ret < 0) ? ret : size;
> >     with,
> >               if (ret)
> >                    return ret;
> >               return size
> > 
> >     Besides the style change (suggested by GKH) this fixes a klocwork
> >     warning.
> 
> thanks.
> 
> > diff --git a/drivers/platform/x86/intel/sdsi.c
> > b/drivers/platform/x86/intel/sdsi.c
> 
> []
> 
> > +/* SDSi mailbox operations must be performed using 64bit mov instructions
> > */
> > +static __always_inline void
> > +sdsi_memcpy64_toio(u64 __iomem *to, const u64 *from, size_t count_bytes)
> > +{
> > +	size_t count = count_bytes / sizeof(*to);
> > +	int i;
> > +
> > +	for (i = 0; i < count; i++)
> > +		writeq(from[i], &to[i]);
> 
> Any chance the byte count is not a multiple of sizeof(u64) ?

No. The value passed to count_bytes is either u64 or rounded up to sizeof(u64).
But I'd like to know how I could guard against accidentally passing something
different in the future.

Andy had suggested just adding support for 64 bit memcpy io, but I hadn't time
to look at this.

> 
> > +static __always_inline void
> > +sdsi_memcpy64_fromio(u64 *to, const u64 __iomem *from, size_t count_bytes)
> > +{
> > +	size_t count = count_bytes / sizeof(*to);
> > +	int i;
> > +
> > +	for (i = 0; i < count; i++)
> > +		to[i] = readq(&from[i]);
> > +}
> 
> here too.

Same.

> 
> []
> 
> > +static int sdsi_mbox_cmd_read(struct sdsi_priv *priv, struct sdsi_mbox_info
> > *info,
> > +			      size_t *data_size)
> > +{
> > +	struct device *dev = priv->dev;
> > +	u32 total, loop, eom, status, message_size;
> []
> > +		if (packet_size > SDSI_SIZE_MAILBOX) {
> > +			dev_err(dev, "Packet size to large\n");
> 
> too

Sorry, I'm missing the question here. If it's whether packet_size could also not
be a multiple of sizeof(u64) the answer here is yes. But I don't see how that
matters. packet_size is a value read from the hardware. This is just a sanity
check.

> 
> []
> > +	/* Message size check is only valid for multi-packet transfers */
> > +	if (loop && total != message_size)
> > +		dev_warn(dev, "Read count %d differs from expected count %d\n",
> 
> %u
> 
> > +			 total, message_size);
> > +static int sdsi_map_mbox_registers(struct sdsi_priv *priv, struct pci_dev
> > *parent,
> > +				   struct disc_table *disc_table, struct
> > resource *disc_res)
> > +{
> > +	u32 access_type = FIELD_GET(DT_ACCESS_TYPE, disc_table->access_info);
> > +	u32 size = FIELD_GET(DT_SIZE, disc_table->access_info);
> > +	u32 tbir = FIELD_GET(DT_TBIR, disc_table->offset);
> > +	u32 offset = DT_OFFSET(disc_table->offset);
> > +	u32 features_offset;
> > +	struct resource res = {};
> > +
> > +	/* Starting location of SDSi MMIO region based on access type */
> > +	switch (access_type) {
> > +	case ACCESS_TYPE_LOCAL:
> > +		if (tbir) {
> > +			dev_err(priv->dev, "Unsupported BAR index %d for access
> > type %d\n",
> > +				tbir, access_type);
> 
> %u here too
> 
> []
> > +		dev_err(priv->dev, "Unrecognized access_type %d\n",
> > access_type);
> 
> and here

Ack on the specifier changes. Thanks.

> 
> 


  reply	other threads:[~2022-02-08  2:54 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-08  0:54 [PATCH V6 0/3] Intel Software Defined Silicon David E. Box
2022-02-08  0:54 ` [PATCH V6 1/3] platform/x86: Add Intel Software Defined Silicon driver David E. Box
2022-02-08  1:40   ` Joe Perches
2022-02-08  2:54     ` David E. Box [this message]
2022-02-08  5:34       ` Joe Perches
2022-02-08  5:55         ` David E. Box
2022-02-08  0:54 ` [PATCH V6 2/3] tools arch x86: Add Intel SDSi provisiong tool David E. Box
2022-02-08  0:54 ` [PATCH V6 3/3] selftests: sdsi: test sysfs setup David E. Box
2022-02-09 12:23 ` [PATCH V6 0/3] Intel Software Defined Silicon Hans de Goede
2022-02-09 16:46   ` David E. Box

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=d52b50f3b704280e476e60417323c98f45baf54a.camel@linux.intel.com \
    --to=david.e.box@linux.intel.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hdegoede@redhat.com \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=markgross@kernel.org \
    --cc=mgross@linux.intel.com \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=srinivas.pandruvada@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).