All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Banman <abanman@hpe.com>
To: mingo@redhat.com
Cc: akpm@linux-foundation.org, tglx@linutronix.de, hpa@zytor.com,
	mike.travis@hpe.com, rja@hpe.com, sivanich@hpe.com,
	x86@kernel.org, linux-kernel@vger.kernel.org, abanman@hpe.com
Subject: [PATCH 4/6] x86/platform/uv/BAU: Implement uv4_wait_completion with read_status
Date: Tue, 14 Feb 2017 19:58:49 -0600	[thread overview]
Message-ID: <1487123931-56809-5-git-send-email-abanman@hpe.com> (raw)
In-Reply-To: <1487123931-56809-1-git-send-email-abanman@hpe.com>

UV4 does not employ a software-timeout as in previous generations so a new
wait_completion routine without this logic is required. Certain completion
statuses require the AUX status bit in addition to ERROR and BUSY.

Add the read_status routine to construct the full completion status. Use
read_status in the uv4_wait_completion routine to handle all possible
completion statuses.

Signed-off-by: Andrew Banman <abanman@hpe.com>
Acked-by: Mike Travis <mike.travis@hpe.com>
---
 arch/x86/platform/uv/tlb_uv.c | 65 ++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 64 insertions(+), 1 deletion(-)

Index: community/arch/x86/platform/uv/tlb_uv.c
===================================================================
--- community.orig/arch/x86/platform/uv/tlb_uv.c
+++ community/arch/x86/platform/uv/tlb_uv.c
@@ -27,6 +27,8 @@ static int uv1_wait_completion(struct ba
 				struct bau_control *bcp, long try);
 static int uv2_3_wait_completion(struct bau_desc *bau_desc,
 				struct bau_control *bcp, long try);
+static int uv4_wait_completion(struct bau_desc *bau_desc,
+				struct bau_control *bcp, long try);
 
 static struct bau_operations ops;
 
@@ -60,7 +62,7 @@ static struct bau_operations uv4_bau_ops
 	.write_g_sw_ack          = write_gmmr_proc_sw_ack,
 	.write_payload_first     = write_mmr_proc_payload_first,
 	.write_payload_last      = write_mmr_proc_payload_last,
-	.wait_completion         = uv2_3_wait_completion,
+	.wait_completion         = uv4_wait_completion,
 };
 
 
@@ -742,6 +744,67 @@ static int uv2_3_wait_completion(struct
 	}
 	bcp->conseccompletes++;
 	return FLUSH_COMPLETE;
+}
+
+/*
+ * Returns the status of current BAU message for cpu desc as a bit field
+ * [Error][Busy][Aux]
+ */
+static unsigned long read_status(unsigned long status_mmr, int index, int desc)
+{
+	unsigned long descriptor_status;
+
+	descriptor_status =
+		((read_lmmr(status_mmr) >> index) & UV_ACT_STATUS_MASK) << 1;
+
+	descriptor_status |=
+		(read_lmmr(UVH_LB_BAU_SB_ACTIVATION_STATUS_2) >> desc) & 0x1;
+
+	return descriptor_status;
+}
+
+static int uv4_wait_completion(struct bau_desc *bau_desc,
+				struct bau_control *bcp, long try)
+{
+	unsigned long descriptor_stat;
+	unsigned long err_busy_mmr;
+	int err_busy_index;
+	int desc = bcp->uvhub_cpu;
+	struct ptc_stats *stat = bcp->statp;
+
+	status_mmr_loc(&err_busy_mmr, &err_busy_index, desc);
+	descriptor_stat = read_status(err_busy_mmr, err_busy_index, desc);
+
+	/* spin on the status MMR, waiting for it to go idle */
+	while (descriptor_stat != UV2H_DESC_IDLE) {
+		switch (descriptor_stat) {
+		case UV2H_DESC_SOURCE_TIMEOUT:
+			stat->s_stimeout++;
+			return FLUSH_GIVEUP;
+
+		case UV2H_DESC_DEST_TIMEOUT:
+			stat->s_dtimeout++;
+			bcp->conseccompletes = 0;
+			return FLUSH_RETRY_TIMEOUT;
+
+		case UV2H_DESC_DEST_STRONG_NACK:
+			stat->s_plugged++;
+			bcp->conseccompletes = 0;
+			return FLUSH_RETRY_PLUGGED;
+
+		case UV2H_DESC_DEST_PUT_ERR:
+			bcp->conseccompletes = 0;
+			return FLUSH_GIVEUP;
+
+		default:
+			/* descriptor_stat is still BUSY */
+			cpu_relax();
+		}
+		descriptor_stat =
+			read_status(err_busy_mmr, err_busy_index, desc);
+	}
+	bcp->conseccompletes++;
+	return FLUSH_COMPLETE;
 }
 
 /*

  parent reply	other threads:[~2017-02-15  1:59 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-15  1:58 [PATCH 0/6] x86/platform/uv/BAU: UV4 message completion and initialization updates Andrew Banman
2017-02-15  1:58 ` [PATCH 1/6] x86/platform/uv/BAU: Declare bau_operations struct after other BAU structs Andrew Banman
2017-02-16 18:00   ` Thomas Gleixner
2017-02-15  1:58 ` [PATCH 2/6] x86/platform/uv/BAU: Add status_mmr_loc to locate message status bits Andrew Banman
2017-02-16 18:07   ` Thomas Gleixner
2017-02-16 21:53     ` Andrew Banman
2017-02-15  1:58 ` [PATCH 3/6] x86/platform/uv/BAU: Add wait_completion to bau_operations Andrew Banman
2017-02-16 18:11   ` Thomas Gleixner
2017-02-15  1:58 ` Andrew Banman [this message]
2017-02-16 18:25   ` [PATCH 4/6] x86/platform/uv/BAU: Implement uv4_wait_completion with read_status Thomas Gleixner
2017-02-15  1:58 ` [PATCH 5/6] x86/platform/uv/BAU: Remove initial write to swack register Andrew Banman
2017-02-16 18:28   ` Thomas Gleixner
2017-02-15  1:58 ` [PATCH 6/6] x86/platform/uv/BAU: Add payload descriptor qualifier Andrew Banman
2017-02-16 18:42   ` Thomas Gleixner
2017-02-16 21:12     ` Andrew Banman

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=1487123931-56809-5-git-send-email-abanman@hpe.com \
    --to=abanman@hpe.com \
    --cc=akpm@linux-foundation.org \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mike.travis@hpe.com \
    --cc=mingo@redhat.com \
    --cc=rja@hpe.com \
    --cc=sivanich@hpe.com \
    --cc=tglx@linutronix.de \
    --cc=x86@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.