tpmdd-devel Archive mirror
 help / color / mirror / Atom feed
From: Jiandi An <anjiandi-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
To: tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Cc: harba-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org,
	anjiandi-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org
Subject: [PATCH RFC] tpm_crb: excluding locality registers for ARM64
Date: Mon, 10 Jul 2017 14:52:34 -0500	[thread overview]
Message-ID: <8e465692-c445-0f59-5764-9a5ffb4f56f5@codeaurora.org> (raw)


Hi Guys,

In this patch https://patchwork.kernel.org/patch/9562247/
Are the locality registers in crb_regs_head specific to x86?

On ARM64, we don't have locality registers before control area in ACPI 
IO region.  We are hitting this check and getting the FW_BUG "Bad ACPI 
memory layout" log.

+	/* The ACPI IO region starts at the head area and continues to include
+	 * the control area, as one nice sane region except for some older
+	 * stuff that puts the control area outside the ACPI IO region.
+	 */
+	if (!(priv->flags & CRB_FL_ACPI_START)) {
+		if (buf->control_address == io_res.start +
+		    sizeof(*priv->regs_h))
+			priv->regs_h = priv->iobase;
+		else
+			dev_warn(dev, FW_BUG "Bad ACPI memory layout");
+	}

The quick fix that would make it work for ARM64 is to also exclude 
CRB_FL_CRB_SMC_START.

- if (!(priv->flags & CRB_FL_ACPI_START)) {
+ if (!(priv->flags & CRB_FL_ACPI_START ||
+       priv->flags & CRB_FL_CRB_SMC_START)) {

But would like to understand more why the check was only excluding 
CRB_FL_ACPI_START and getting opinions on this fix.  We don't see 
locality registers defined in TCG ACPI spec nor how a platform indicates 
the locality registers are present before control area.

I've done similar workaround to bypass x86 specific workaround in common 
code path.

For example, in crb_map_io(),  there is a specific PTT HW bug workaround 
for x86.

	/*
	 * PTT HW bug w/a: wake up the device to access
	 * possibly not retained registers.
	 */
	ret = crb_cmd_ready(dev, priv);
	if (ret)
		return ret;

crb_cmd_ready() does nothing for devices with ACPI-start method as it 
does not support goIdle and cmdReady bits and idle state management is 
not exposed to the host SW.  So I've done similar workaround to bypass 
by additionally excluding CRB_FL_CRB_SMC_START.

static int __maybe_unused crb_cmd_ready(struct device *dev,
					struct crb_priv *priv)
{
	if ((priv->flags & CRB_FL_ACPI_START) ||
	    (priv->flags & CRB_FL_CRB_SMC_START))
		return 0;


-- 
Jiandi An
Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm 
Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a 
Linux Foundation Collaborative Project.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

             reply	other threads:[~2017-07-10 19:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-10 19:52 Jiandi An [this message]
     [not found] ` <8e465692-c445-0f59-5764-9a5ffb4f56f5-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2017-07-10 20:29   ` [PATCH RFC] tpm_crb: excluding locality registers for ARM64 Jason Gunthorpe
     [not found]     ` <20170710202957.GA19948-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-07-16 11:16       ` Jarkko Sakkinen

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=8e465692-c445-0f59-5764-9a5ffb4f56f5@codeaurora.org \
    --to=anjiandi-sgv2jx0feol9jmxxk+q4oq@public.gmane.org \
    --cc=harba-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
    --cc=tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).