public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Banman <abanman@sgi.com>
To: mingo@redhat.com
Cc: akpm@linux-foundation.org, tglx@linutronix.de, hpa@zytor.com,
	travis@sgi.com, rja@sgi.com, sivanich@sgi.com, x86@kernel.org,
	linux-kernel@vger.kernel.org, abanman@sgi.com
Subject: [PATCH 05/10] arch/x86/platform/uv: BAU add generic function pointers
Date: Wed, 21 Sep 2016 11:09:16 -0500	[thread overview]
Message-ID: <1474474161-265604-6-git-send-email-abanman@sgi.com> (raw)
In-Reply-To: <1474474161-265604-1-git-send-email-abanman@sgi.com>

Many BAU functions have different implementations depending on the UV
version. Rather than switching on the uvhub_version throughout the driver,
we can define a set of operations for each version. This is especially
beneficial for UV4, which will require many new MMR read/write functions.

Currently, the set of abstracted functions are the same for UV1, UV2, and
UV3. The functions were chosen because each one will have a different
implementation for UV4. Other functions will be added as needed to handle
new implementations or to cleanup the existing differences between UV1,
UV2, and UV3, i.e. read_status and wait_completion.

Signed-off-by: Andrew Banman <abanman@sgi.com>
Acked-by: Mike Travis <travis@sgi.com>
Acked-by: Dimitri Sivanich <sivanich@sgi.com>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
---
 arch/x86/include/asm/uv/uv_bau.h | 11 +++++++++++
 arch/x86/platform/uv/tlb_uv.c    | 19 +++++++++++++++++++
 2 files changed, 30 insertions(+)

diff --git a/arch/x86/include/asm/uv/uv_bau.h b/arch/x86/include/asm/uv/uv_bau.h
index a46f270..a7a93a5 100644
--- a/arch/x86/include/asm/uv/uv_bau.h
+++ b/arch/x86/include/asm/uv/uv_bau.h
@@ -385,6 +385,17 @@ struct uv2_3_bau_msg_header {
 	/* bits 127:120 */
 };
 
+/* Abstracted BAU functions */
+struct bau_operations {
+	unsigned long (*read_l_sw_ack)(void);
+	unsigned long (*read_g_sw_ack)(int pnode);
+	unsigned long (*bau_gpa_to_offset)(unsigned long vaddr);
+	void (*write_l_sw_ack)(unsigned long mmr);
+	void (*write_g_sw_ack)(int pnode, unsigned long mmr);
+	void (*write_payload_first)(int pnode, unsigned long mmr);
+	void (*write_payload_last)(int pnode, unsigned long mmr);
+};
+
 /*
  * The activation descriptor:
  * The format of the message to send, plus all accompanying control
diff --git a/arch/x86/platform/uv/tlb_uv.c b/arch/x86/platform/uv/tlb_uv.c
index 34b2a48..a33a433 100644
--- a/arch/x86/platform/uv/tlb_uv.c
+++ b/arch/x86/platform/uv/tlb_uv.c
@@ -24,6 +24,18 @@
 #include <asm/irq_vectors.h>
 #include <asm/timer.h>
 
+static struct bau_operations ops;
+
+static struct bau_operations uv123_bau_ops = {
+	.bau_gpa_to_offset       = uv_gpa_to_offset,
+	.read_l_sw_ack           = read_mmr_sw_ack,
+	.read_g_sw_ack           = read_gmmr_sw_ack,
+	.write_l_sw_ack          = write_mmr_sw_ack,
+	.write_g_sw_ack          = write_gmmr_sw_ack,
+	.write_payload_first     = write_mmr_payload_first,
+	.write_payload_last      = write_mmr_payload_last,
+};
+
 /* timeouts in nanoseconds (indexed by UVH_AGING_PRESCALE_SEL urgency7 30:28) */
 static int timeout_base_ns[] = {
 		20,
@@ -2135,6 +2147,13 @@ static int __init uv_bau_init(void)
 	if (!is_uv_system())
 		return 0;
 
+	if (is_uv3_hub())
+		ops = uv123_bau_ops;
+	else if (is_uv2_hub())
+		ops = uv123_bau_ops;
+	else if (is_uv1_hub())
+		ops = uv123_bau_ops;
+
 	for_each_possible_cpu(cur_cpu) {
 		mask = &per_cpu(uv_flush_tlb_mask, cur_cpu);
 		zalloc_cpumask_var_node(mask, GFP_KERNEL, cpu_to_node(cur_cpu));
-- 
1.8.5.6

  parent reply	other threads:[~2016-09-21 16:10 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-20 22:31 [PATCH 0/9] arch/x86/platform/uv: add UV4 support to BAU Andrew Banman
2016-09-20 22:31 ` [PATCH 1/9] arch/x86/platform/uv: BAU cleanup: update printks Andrew Banman
2016-09-20 22:31 ` [PATCH 2/9] arch/x86/platform/uv: BAU cleanup: pq_init Andrew Banman
2016-09-20 22:31 ` [PATCH 3/9] arch/x86/platform/uv: BAU replace uv_physnodeaddr Andrew Banman
2016-09-20 22:31 ` [PATCH 4/9] arch/x86/platform/uv: BAU add generic function pointers Andrew Banman
2016-09-20 22:31 ` [PATCH 5/9] arch/x86/platform/uv: BAU use " Andrew Banman
2016-09-20 22:31 ` [PATCH 6/9] arch/x86/platform/uv: BAU UV4 populate uvhub_version Andrew Banman
2016-09-20 22:31 ` [PATCH 7/9] arch/x86/platform/uv: BAU UV4 disable software timeout Andrew Banman
2016-09-20 22:31 ` [PATCH 8/9] arch/x86/platform/uv: BAU UV4 fix payload queue setup Andrew Banman
2016-09-20 22:32 ` [PATCH 9/9] arch/x86/platform/uv: BAU UV4 add version-specific functions Andrew Banman
2016-09-21 12:55   ` Ingo Molnar
2016-09-21 15:53     ` andrew banman
2016-09-21 14:55 ` [PATCH 0/9] arch/x86/platform/uv: add UV4 support to BAU Thomas Gleixner
2016-09-21 16:09 ` [PATCHv2 0/10] " Andrew Banman
2016-09-21 16:09   ` [PATCH 01/10] arch/x86/platform/uv: BAU cleanup: vertical alignment Andrew Banman
2016-09-22 10:28     ` [tip:x86/platform] x86/platform/uv/BAU: Clean up " tip-bot for Andrew Banman
2016-09-21 16:09   ` [PATCH 02/10] arch/x86/platform/uv: BAU cleanup: update printks Andrew Banman
2016-09-22 10:29     ` [tip:x86/platform] x86/platform/uv/BAU: Clean up and " tip-bot for Andrew Banman
2016-09-21 16:09   ` [PATCH 03/10] arch/x86/platform/uv: BAU cleanup: pq_init Andrew Banman
2016-09-22 10:29     ` [tip:x86/platform] x86/platform/uv/BAU: Clean up pq_init() tip-bot for Andrew Banman
2016-09-21 16:09   ` [PATCH 04/10] arch/x86/platform/uv: BAU replace uv_physnodeaddr Andrew Banman
2016-09-22 10:30     ` [tip:x86/platform] x86/platform/uv/BAU: Convert uv_physnodeaddr() use to uv_gpa_to_offset() tip-bot for Andrew Banman
2016-09-21 16:09   ` Andrew Banman [this message]
2016-09-22 10:30     ` [tip:x86/platform] x86/platform/uv/BAU: Add generic function pointers tip-bot for Andrew Banman
2016-09-21 16:09   ` [PATCH 06/10] arch/x86/platform/uv: BAU use " Andrew Banman
2016-09-22 10:31     ` [tip:x86/platform] x86/platform/uv/BAU: Use " tip-bot for Andrew Banman
2016-09-21 16:09   ` [PATCH 07/10] arch/x86/platform/uv: BAU UV4 populate uvhub_version Andrew Banman
2016-09-22 10:31     ` [tip:x86/platform] x86/platform/uv/BAU: Populate ->uvhub_version with UV4 version information tip-bot for Andrew Banman
2016-09-21 16:09   ` [PATCH 08/10] arch/x86/platform/uv: BAU UV4 disable software timeout Andrew Banman
2016-09-22 10:32     ` [tip:x86/platform] x86/platform/uv/BAU: Disable software timeout on UV4 hardware tip-bot for Andrew Banman
2016-09-21 16:09   ` [PATCH 09/10] arch/x86/platform/uv: BAU UV4 fix payload queue setup Andrew Banman
2016-09-22 10:32     ` [tip:x86/platform] x86/platform/uv/BAU: Fix payload queue setup on UV4 hardware tip-bot for Andrew Banman
2016-09-21 16:09   ` [PATCH 10/10] arch/x86/platform/uv: BAU UV4 add version-specific functions Andrew Banman
2016-09-22 10:33     ` [tip:x86/platform] x86/platform/uv/BAU: Add UV4-specific functions tip-bot for 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=1474474161-265604-6-git-send-email-abanman@sgi.com \
    --to=abanman@sgi.com \
    --cc=akpm@linux-foundation.org \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=rja@sgi.com \
    --cc=sivanich@sgi.com \
    --cc=tglx@linutronix.de \
    --cc=travis@sgi.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox