mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mike Travis <travis@sgi.com>
To: Jesse Barnes <jbarnes@virtuousgeek.org>, Ingo Molnar <mingo@elte.hu>
Cc: Russ Anderson <rja@sgi.com>, Dave Airlie <airlied@redhat.com>,
	Alex Chiang <achiang@hp.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Cyrill Gorcunov <gorcunov@openvz.org>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Robin Holt <holt@sgi.com>, "Rafael J. Wysocki" <rjw@sisk.pl>,
	Adam Jackson <ajax@nwnk.net>,
	Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Gaetan Nadon <memsize@videotron.ca>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Aaron Plattner <aplattner@nvidia.com>,
	Jack Steiner <steiner@sgi.com>,
	Tiago Vignatti <tiago.vignatti@nokia.com>,
	Cliff Wickman <cpw@sgi.com>,
	Matthew Wilcox <willy@linux.intel.com>,
	Christian Zander <chzander@nvidia.com>,
	Yu Zhao <yu.zhao@intel.com>,
	linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org,
	x86@kernel.org
Subject: [PATCH 2/4] x86_64 UV: Update UV arch to target Legacy VGA I/O correctly.
Date: Mon, 18 Jan 2010 12:34:14 -0600	[thread overview]
Message-ID: <20100118183435.948841000@alcatraz.americas.sgi.com> (raw)
In-Reply-To: <20100118183412.560438000@alcatraz.americas.sgi.com>

[-- Attachment #1: update-uv-using-bios --]
[-- Type: text/plain, Size: 4084 bytes --]

Add function to direct Legacy VGA I/O traffic to correct I/O Hub.

Signed-off-by: Mike Travis <travis@sgi.com>

Cc: Dave Airlie <airlied@redhat.com>
Cc: Alex Chiang <achiang@hp.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Robin Holt <holt@sgi.com>
Cc: Rafael J. Wysocki <rjw@sisk.pl>
Cc: Adam Jackson <ajax@nwnk.net>
Cc: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Gaetan Nadon <memsize@videotron.ca>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Aaron Plattner <aplattner@nvidia.com>
Cc: Jack Steiner <steiner@sgi.com>
Cc: Tiago Vignatti <tiago.vignatti@nokia.com>
Cc: Cliff Wickman <cpw@sgi.com>
Cc: Matthew Wilcox <willy@linux.intel.com>
Cc: Christian Zander <chzander@nvidia.com>
Cc: Yu Zhao <yu.zhao@intel.com>

Cc: linux-kernel@vger.kernel.org
Cc: linux-pci@vger.kernel.org
Cc: x86@kernel.org
---
 arch/x86/include/asm/uv/bios.h     |    4 +++-
 arch/x86/kernel/apic/x2apic_uv_x.c |   30 ++++++++++++++++++++++++++++++
 arch/x86/kernel/bios_uv.c          |   19 +++++++++++++++++++
 3 files changed, 52 insertions(+), 1 deletion(-)

--- linux.orig/arch/x86/include/asm/uv/bios.h
+++ linux/arch/x86/include/asm/uv/bios.h
@@ -36,7 +36,8 @@
 	UV_BIOS_WATCHLIST_ALLOC,
 	UV_BIOS_WATCHLIST_FREE,
 	UV_BIOS_MEMPROTECT,
-	UV_BIOS_GET_PARTITION_ADDR
+	UV_BIOS_GET_PARTITION_ADDR,
+	UV_BIOS_SET_LEGACY_VGA_TARGET
 };
 
 /*
@@ -96,6 +97,7 @@
 extern int uv_bios_mq_watchlist_free(int, int);
 extern s64 uv_bios_change_memprotect(u64, u64, enum uv_memprotect);
 extern s64 uv_bios_reserved_page_pa(u64, u64 *, u64 *, u64 *);
+extern int uv_bios_set_legacy_vga_target(bool decode, int domain, int bus);
 
 extern void uv_bios_init(void);
 
--- linux.orig/arch/x86/kernel/apic/x2apic_uv_x.c
+++ linux/arch/x86/kernel/apic/x2apic_uv_x.c
@@ -20,6 +20,7 @@
 #include <linux/cpu.h>
 #include <linux/init.h>
 #include <linux/io.h>
+#include <linux/pci.h>
 
 #include <asm/uv/uv_mmrs.h>
 #include <asm/uv/uv_hub.h>
@@ -34,6 +35,8 @@
 
 DEFINE_PER_CPU(int, x2apic_extra_bits);
 
+#define PR_DEVEL(fmt, args...)	pr_devel("%s: " fmt, __func__, args)
+
 static enum uv_system_type uv_system_type;
 static u64 gru_start_paddr, gru_end_paddr;
 int uv_min_hub_revision_id;
@@ -557,6 +560,30 @@
 
 #endif /* !CONFIG_HOTPLUG_CPU */
 
+/* Direct Legacy VGA I/O traffic to designated IOH */
+int uv_set_vga_state(struct pci_dev *pdev, bool decode,
+		      unsigned int command_bits, bool change_bridge)
+{
+	int domain, bus, rc;
+
+	PR_DEVEL("devfn %x decode %d cmd %x chg_brdg %d\n",
+			pdev->devfn, decode, command_bits, change_bridge);
+
+	if (!change_bridge)
+		return 0;
+
+	if ((command_bits & PCI_COMMAND_IO) == 0)
+		return 0;
+
+	domain = pci_domain_nr(pdev->bus);
+	bus = pdev->bus->number;
+
+	rc = uv_bios_set_legacy_vga_target(decode, domain, bus);
+	PR_DEVEL("vga decode %d %x:%x, rc: %d\n", decode, domain, bus, rc);
+
+	return rc;
+}
+
 /*
  * Called on each cpu to initialize the per_cpu UV data area.
  * FIXME: hotplug not supported yet
@@ -717,4 +744,7 @@
 	uv_cpu_init();
 	uv_scir_register_cpu_notifier();
 	proc_mkdir("sgi_uv", NULL);
+
+	/* register Legacy VGA I/O redirection handler */
+	pci_register_set_vga_state(uv_set_vga_state);
 }
--- linux.orig/arch/x86/kernel/bios_uv.c
+++ linux/arch/x86/kernel/bios_uv.c
@@ -163,6 +163,25 @@
 }
 EXPORT_SYMBOL_GPL(uv_bios_freq_base);
 
+/*
+ * uv_bios_set_legacy_vga_target - Set Legacy VGA I/O Target
+ * @decode: true to enable target, false to disable target
+ * @domain: PCI domain number
+ * @bus: PCI bus number
+ *
+ * Returns:
+ *    0: Success
+ *    -EINVAL: Invalid domain or bus number
+ *    -ENOSYS: Capability not available
+ *    -EBUSY: Legacy VGA I/O cannot be retargeted at this time
+ */
+int uv_bios_set_legacy_vga_target(bool decode, int domain, int bus)
+{
+	return uv_bios_call(UV_BIOS_SET_LEGACY_VGA_TARGET,
+				(u64)decode, (u64)domain, (u64)bus, 0, 0);
+}
+EXPORT_SYMBOL_GPL(uv_bios_set_legacy_vga_target);
+
 
 #ifdef CONFIG_EFI
 void uv_bios_init(void)

-- 

  parent reply	other threads:[~2010-01-18 18:34 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20100118183412.560438000@alcatraz.americas.sgi.com>
2010-01-18 18:34 ` [PATCH 1/4] pci: Update pci_set_vga_state to call arch functions Mike Travis
2010-01-25 23:52   ` Andrew Morton
2010-01-26  0:09     ` Mike Travis
2010-01-26  0:17       ` Andrew Morton
2010-01-18 18:34 ` Mike Travis [this message]
2010-01-25 23:54   ` [PATCH 2/4] x86_64 UV: Update UV arch to target Legacy VGA I/O correctly Andrew Morton
2010-01-26  0:05     ` Mike Travis
2010-01-26  0:22       ` H. Peter Anvin
2010-01-26 17:54         ` Mike Travis
2010-01-18 18:34 ` [PATCH 3/4] vgaarb: Fix VGA Arbiter to accept PCI Domains other than 0 Mike Travis
2010-01-18 18:34 ` [PATCH 4/4] vgaarb: Add user selectability of the number of GPUS in a system Mike Travis

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=20100118183435.948841000@alcatraz.americas.sgi.com \
    --to=travis@sgi.com \
    --cc=achiang@hp.com \
    --cc=airlied@redhat.com \
    --cc=ajax@nwnk.net \
    --cc=akpm@linux-foundation.org \
    --cc=aplattner@nvidia.com \
    --cc=benh@kernel.crashing.org \
    --cc=chzander@nvidia.com \
    --cc=cpw@sgi.com \
    --cc=gorcunov@openvz.org \
    --cc=holt@sgi.com \
    --cc=hpa@zytor.com \
    --cc=jbarnes@virtuousgeek.org \
    --cc=kaneshige.kenji@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=memsize@videotron.ca \
    --cc=mingo@elte.hu \
    --cc=rja@sgi.com \
    --cc=rjw@sisk.pl \
    --cc=steiner@sgi.com \
    --cc=tglx@linutronix.de \
    --cc=tiago.vignatti@nokia.com \
    --cc=willy@linux.intel.com \
    --cc=x86@kernel.org \
    --cc=yu.zhao@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

all inboxes | Powered by JetHome®