Linux v3.4-7644-g07acfc2

This commit is contained in:
Josh Boyer 2012-05-25 09:03:50 -04:00
parent 2a6c66eb95
commit e3ad20d482
8 changed files with 41 additions and 877 deletions

View File

@ -1860,6 +1860,7 @@ CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
CONFIG_INPUT_JOYDEV=m
CONFIG_INPUT_EVDEV=y
# CONFIG_INPUT_EVBUG is not set
# CONFIG_INPUT_MATRIXKMAP is not set
CONFIG_INPUT_TABLET=y
CONFIG_TABLET_USB_ACECAD=m
@ -1910,6 +1911,7 @@ CONFIG_KEYBOARD_ATKBD=y
# CONFIG_KEYBOARD_STOWAWAY is not set
# CONFIG_KEYBOARD_LKKBD is not set
# CONFIG_KEYBOARD_LM8323 is not set
# CONFIG_KEYBOARD_LM8333 is not set
# CONFIG_KEYBOARD_ADP5588 is not set
# CONFIG_KEYBOARD_MAX7359 is not set
# CONFIG_KEYBOARD_ADP5589 is not set
@ -1992,6 +1994,7 @@ CONFIG_TOUCHSCREEN_TOUCHWIN=m
CONFIG_TOUCHSCREEN_PIXCIR=m
CONFIG_TOUCHSCREEN_UCB1400=m
CONFIG_TOUCHSCREEN_WACOM_W8001=m
CONFIG_TOUCHSCREEN_WACOM_I2C=m
CONFIG_TOUCHSCREEN_USB_E2I=y
CONFIG_TOUCHSCREEN_USB_COMPOSITE=m
# CONFIG_TOUCHSCREEN_WM97XX is not set
@ -2426,12 +2429,15 @@ CONFIG_VGA_ARB_MAX_GPUS=16
CONFIG_DRM=m
# CONFIG_DRM_LOAD_EDID_FIRMWARE is not set
CONFIG_DRM_AST=m # do not enable on f17 or older
CONFIG_DRM_CIRRUS_QEMU=m # do not enable on f17 or older
# CONFIG_DRM_TDFX is not set
# CONFIG_DRM_R128 is not set
CONFIG_DRM_RADEON=m
CONFIG_DRM_RADEON_KMS=y
# CONFIG_DRM_I810 is not set
# CONFIG_DRM_MGA is not set
CONFIG_DRM_MGAG200=m # do not enable on f17 or older
# CONFIG_DRM_SIS is not set
# CONFIG_DRM_SAVAGE is not set
CONFIG_DRM_I915=m
@ -2643,6 +2649,7 @@ CONFIG_DVB_USB_AZ6027=m
CONFIG_DVB_USB_AZ6007=m
CONFIG_DVB_USB_LME2510=m
CONFIG_DVB_USB_RTL28XXU=m
CONFIG_DVB_USB_AF9035=m
CONFIG_DVB_PT1=m
@ -2763,7 +2770,7 @@ CONFIG_FB_EFI=y
# CONFIG_FB_PRE_INIT_FB is not set
# CONFIG_FB_TMIO is not set
# CONFIG_FB_BROADSHEET is not set
CONFIG_FB_UDL=m
# CONFIG_FB_UDL is not set
# CONFIG_FIRMWARE_EDID is not set
@ -4044,7 +4051,7 @@ CONFIG_ASYNC_TX_DMA=y
CONFIG_UNUSED_SYMBOLS=y
CONFIG_UTRACE=y
CONFIG_UPROBE_EVENT=y
CONFIG_FTRACE=y
CONFIG_DYNAMIC_FTRACE=y

View File

@ -1,21 +1,8 @@
From 04a43e2598db35b3d0ec25925bb8475b5c0a3809 Mon Sep 17 00:00:00 2001
From: Adam Jackson <ajax@redhat.com>
Date: Fri, 16 Mar 2012 16:39:11 -0400
Subject: [PATCH] drm/i915/dp: Use DRM_ERROR not WARN for sanity checks
These are noisy as shit and creating a ton of abrt reports. I don't
need more, thanks. Proper fix upstream eventually.
Signed-off-by: Adam Jackson <ajax@redhat.com>
---
drivers/gpu/drm/i915/intel_dp.c | 14 ++++++++------
1 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 94f860c..6bf27c9 100644
index 71c7096..5defdd5 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -331,7 +331,7 @@ intel_dp_check_edp(struct intel_dp *intel_dp)
@@ -347,7 +347,7 @@ intel_dp_check_edp(struct intel_dp *intel_dp)
if (!is_edp(intel_dp))
return;
if (!ironlake_edp_have_panel_power(intel_dp) && !ironlake_edp_have_panel_vdd(intel_dp)) {
@ -24,7 +11,7 @@ index 94f860c..6bf27c9 100644
DRM_DEBUG_KMS("Status 0x%08x Control 0x%08x\n",
I915_READ(PCH_PP_STATUS),
I915_READ(PCH_PP_CONTROL));
@@ -386,7 +386,7 @@ intel_dp_aux_ch(struct intel_dp *intel_dp,
@@ -397,7 +397,7 @@ intel_dp_aux_ch(struct intel_dp *intel_dp,
}
if (try == 3) {
@ -33,7 +20,7 @@ index 94f860c..6bf27c9 100644
I915_READ(ch_ctl));
return -EBUSY;
}
@@ -992,8 +992,8 @@ static void ironlake_edp_panel_vdd_on(struct intel_dp *intel_dp)
@@ -1018,8 +1018,8 @@ static void ironlake_edp_panel_vdd_on(struct intel_dp *intel_dp)
return;
DRM_DEBUG_KMS("Turn eDP VDD on\n");
@ -44,7 +31,7 @@ index 94f860c..6bf27c9 100644
intel_dp->want_panel_vdd = true;
@@ -1058,7 +1058,8 @@ static void ironlake_edp_panel_vdd_off(struct intel_dp *intel_dp, bool sync)
@@ -1084,7 +1084,8 @@ static void ironlake_edp_panel_vdd_off(struct intel_dp *intel_dp, bool sync)
return;
DRM_DEBUG_KMS("Turn eDP VDD off %d\n", intel_dp->want_panel_vdd);
@ -54,16 +41,14 @@ index 94f860c..6bf27c9 100644
intel_dp->want_panel_vdd = false;
@@ -1128,7 +1129,8 @@ static void ironlake_edp_panel_off(struct intel_dp *intel_dp)
@@ -1154,7 +1155,9 @@ static void ironlake_edp_panel_off(struct intel_dp *intel_dp)
DRM_DEBUG_KMS("Turn eDP power off\n");
- WARN(intel_dp->want_panel_vdd, "Cannot turn power off while VDD is on\n");
+ if (intel_dp->want_panel_vdd)
+ DRM_ERROR("Cannot turn power off while VDD is on\n");
+
ironlake_panel_vdd_off_sync(intel_dp); /* finish any pending work */
pp = ironlake_get_pp_control(dev_priv);
pp &= ~(POWER_TARGET_ON | EDP_FORCE_VDD | PANEL_POWER_RESET | EDP_BLC_ENABLE);
--
1.7.7.6

View File

@ -1,161 +0,0 @@
From b03543857fd75876b96e10d4320b775e95041bb7 Mon Sep 17 00:00:00 2001
From: Takashi Iwai <tiwai@suse.de>
Date: Tue, 20 Mar 2012 12:07:05 +0000
Subject: drm/i915: Check VBIOS value for determining LVDS dual channel mode, too
Currently i915 driver checks [PCH_]LVDS register bits to decide
whether to set up the dual-link or the single-link mode. This relies
implicitly on that BIOS initializes the register properly at boot.
However, BIOS doesn't initialize it always. When the machine is
booted with the closed lid, BIOS skips the LVDS reg initialization.
This ends up in blank output on a machine with a dual-link LVDS when
you open the lid after the boot.
This patch adds a workaround for that problem by checking the initial
LVDS register value in VBT.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=37742
Tested-By: Paulo Zanoni <paulo.r.zanoni@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@gmail.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index b6098b0..4cbed7f 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -406,6 +406,8 @@ typedef struct drm_i915_private {
unsigned int lvds_use_ssc:1;
unsigned int display_clock_mode:1;
int lvds_ssc_freq;
+ unsigned int bios_lvds_val; /* initial [PCH_]LVDS reg val in VBIOS */
+ unsigned int lvds_val; /* used for checking LVDS channel mode */
struct {
int rate;
int lanes;
diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c
index 0ae76d6..e4317da 100644
--- a/drivers/gpu/drm/i915/intel_bios.c
+++ b/drivers/gpu/drm/i915/intel_bios.c
@@ -173,6 +173,28 @@ get_lvds_dvo_timing(const struct bdb_lvds_lfp_data *lvds_lfp_data,
return (struct lvds_dvo_timing *)(entry + dvo_timing_offset);
}
+/* get lvds_fp_timing entry
+ * this function may return NULL if the corresponding entry is invalid
+ */
+static const struct lvds_fp_timing *
+get_lvds_fp_timing(const struct bdb_header *bdb,
+ const struct bdb_lvds_lfp_data *data,
+ const struct bdb_lvds_lfp_data_ptrs *ptrs,
+ int index)
+{
+ size_t data_ofs = (const u8 *)data - (const u8 *)bdb;
+ u16 data_size = ((const u16 *)data)[-1]; /* stored in header */
+ size_t ofs;
+
+ if (index >= ARRAY_SIZE(ptrs->ptr))
+ return NULL;
+ ofs = ptrs->ptr[index].fp_timing_offset;
+ if (ofs < data_ofs ||
+ ofs + sizeof(struct lvds_fp_timing) > data_ofs + data_size)
+ return NULL;
+ return (const struct lvds_fp_timing *)((const u8 *)bdb + ofs);
+}
+
/* Try to find integrated panel data */
static void
parse_lfp_panel_data(struct drm_i915_private *dev_priv,
@@ -182,6 +204,7 @@ parse_lfp_panel_data(struct drm_i915_private *dev_priv,
const struct bdb_lvds_lfp_data *lvds_lfp_data;
const struct bdb_lvds_lfp_data_ptrs *lvds_lfp_data_ptrs;
const struct lvds_dvo_timing *panel_dvo_timing;
+ const struct lvds_fp_timing *fp_timing;
struct drm_display_mode *panel_fixed_mode;
int i, downclock;
@@ -243,6 +266,19 @@ parse_lfp_panel_data(struct drm_i915_private *dev_priv,
"Normal Clock %dKHz, downclock %dKHz\n",
panel_fixed_mode->clock, 10*downclock);
}
+
+ fp_timing = get_lvds_fp_timing(bdb, lvds_lfp_data,
+ lvds_lfp_data_ptrs,
+ lvds_options->panel_type);
+ if (fp_timing) {
+ /* check the resolution, just to be sure */
+ if (fp_timing->x_res == panel_fixed_mode->hdisplay &&
+ fp_timing->y_res == panel_fixed_mode->vdisplay) {
+ dev_priv->bios_lvds_val = fp_timing->lvds_reg_val;
+ DRM_DEBUG_KMS("VBT initial LVDS value %x\n",
+ dev_priv->bios_lvds_val);
+ }
+ }
}
/* Try to find sdvo panel data */
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 683002fb..a76ac2e 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -360,6 +360,27 @@ static const intel_limit_t intel_limits_ironlake_display_port = {
.find_pll = intel_find_pll_ironlake_dp,
};
+static bool is_dual_link_lvds(struct drm_i915_private *dev_priv,
+ unsigned int reg)
+{
+ unsigned int val;
+
+ if (dev_priv->lvds_val)
+ val = dev_priv->lvds_val;
+ else {
+ /* BIOS should set the proper LVDS register value at boot, but
+ * in reality, it doesn't set the value when the lid is closed;
+ * we need to check "the value to be set" in VBT when LVDS
+ * register is uninitialized.
+ */
+ val = I915_READ(reg);
+ if (!(val & ~LVDS_DETECTED))
+ val = dev_priv->bios_lvds_val;
+ dev_priv->lvds_val = val;
+ }
+ return (val & LVDS_CLKB_POWER_MASK) == LVDS_CLKB_POWER_UP;
+}
+
static const intel_limit_t *intel_ironlake_limit(struct drm_crtc *crtc,
int refclk)
{
@@ -368,8 +389,7 @@ static const intel_limit_t *intel_ironlake_limit(struct drm_crtc *crtc,
const intel_limit_t *limit;
if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS)) {
- if ((I915_READ(PCH_LVDS) & LVDS_CLKB_POWER_MASK) ==
- LVDS_CLKB_POWER_UP) {
+ if (is_dual_link_lvds(dev_priv, PCH_LVDS)) {
/* LVDS dual channel */
if (refclk == 100000)
limit = &intel_limits_ironlake_dual_lvds_100m;
@@ -397,8 +417,7 @@ static const intel_limit_t *intel_g4x_limit(struct drm_crtc *crtc)
const intel_limit_t *limit;
if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS)) {
- if ((I915_READ(LVDS) & LVDS_CLKB_POWER_MASK) ==
- LVDS_CLKB_POWER_UP)
+ if (is_dual_link_lvds(dev_priv, LVDS))
/* LVDS with dual channel */
limit = &intel_limits_g4x_dual_channel_lvds;
else
@@ -536,8 +555,7 @@ intel_find_best_PLL(const intel_limit_t *limit, struct drm_crtc *crtc,
* reliably set up different single/dual channel state, if we
* even can.
*/
- if ((I915_READ(LVDS) & LVDS_CLKB_POWER_MASK) ==
- LVDS_CLKB_POWER_UP)
+ if (is_dual_link_lvds(dev_priv, LVDS))
clock.p2 = limit->p2.p2_fast;
else
clock.p2 = limit->p2.p2_slow;
--
cgit v0.9.0.2-2-gbebe

View File

@ -95,7 +95,7 @@ Summary: The Linux kernel
# The rc snapshot level
%define rcrev 0
# The git snapshot level
%define gitrev 6
%define gitrev 7
# Set rpm version accordingly
%define rpmversion 3.%{upstream_sublevel}.0
%endif
@ -688,7 +688,6 @@ Patch1800: drm-vgem.patch
# intel drm is all merged upstream
Patch1824: drm-intel-next.patch
Patch1825: drm-i915-dp-stfu.patch
Patch1826: drm-i915-lvds-dual-channel.patch
Patch1900: linux-2.6-intel-iommu-igfx.patch
@ -746,8 +745,6 @@ Patch21306: shlib_base_randomize.patch
Patch21400: unhandled-irqs-switch-to-polling.patch
Patch21620: vgaarb-vga_default_device.patch
Patch22000: weird-root-dentry-name-debug.patch
#selinux ptrace child permissions
@ -1402,7 +1399,6 @@ ApplyPatch drm-vgem.patch
# Intel DRM
ApplyOptionalPatch drm-intel-next.patch
ApplyPatch drm-i915-dp-stfu.patch
ApplyPatch drm-i915-lvds-dual-channel.patch
ApplyPatch linux-2.6-intel-iommu-igfx.patch
@ -1451,9 +1447,6 @@ ApplyPatch selinux-apply-different-permission-to-ptrace-child.patch
#Highbank clock functions
ApplyPatch highbank-export-clock-functions.patch
#vgaarb patches. blame mjg59
ApplyPatch vgaarb-vga_default_device.patch
#rhbz 822825 822821 CVE-2012-2372
ApplyPatch mm-pmd_read_atomic-fix-32bit-PAE-pmd-walk-vs-pmd_populate-SMP-race-condition.patch
@ -2307,6 +2300,9 @@ fi
# ||----w |
# || ||
%changelog
* Fri May 25 2012 Josh Boyer <jwboyer@redhat.com> - 3.5.0-0.rc0.git7.1
- Linux v3.4-7644-g07acfc2
* Fri May 25 2012 Mauro Carvalho Chehab <mchehab@redhat.com>
- Don't manually customise tuners/frontends (rhbz 825203)

View File

@ -1,17 +1,8 @@
Before:
Heap randomisation test (PIE) : 16 bits (guessed)
Main executable randomisation (PIE) : 8 bits (guessed)
after:
Heap randomisation test (PIE) : 19 bits (guessed)
Main executable randomisation (PIE) : 12 bits (guessed)
diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
index 1d92a5a..81fef23 100644
index 735279e..0f9f005 100644
--- a/arch/x86/kernel/process.c
+++ b/arch/x86/kernel/process.c
@@ -753,6 +753,16 @@ unsigned long arch_align_stack(unsigned long sp)
@@ -756,6 +756,16 @@ unsigned long arch_align_stack(unsigned long sp)
unsigned long arch_randomize_brk(struct mm_struct *mm)
{
unsigned long range_end = mm->brk + 0x02000000;
@ -60,10 +51,10 @@ index 66e6d93..b80cde7 100644
ret = addr;
goto up_fail;
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 74aa71b..d9971db 100644
index 7d5c37f..92cb90d 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -1391,7 +1391,13 @@ extern int install_special_mapping(struct mm_struct *mm,
@@ -1389,7 +1389,13 @@ extern int install_special_mapping(struct mm_struct *mm,
unsigned long addr, unsigned long len,
unsigned long flags, struct page **pages);
@ -79,10 +70,10 @@ index 74aa71b..d9971db 100644
extern unsigned long mmap_region(struct file *file, unsigned long addr,
unsigned long len, unsigned long flags,
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index 3cc3062..b42f00b 100644
index 26574c7..54a063d 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -293,6 +293,9 @@ struct mm_struct {
@@ -294,6 +294,9 @@ struct mm_struct {
unsigned long (*get_unmapped_area) (struct file *filp,
unsigned long addr, unsigned long len,
unsigned long pgoff, unsigned long flags);
@ -93,10 +84,10 @@ index 3cc3062..b42f00b 100644
#endif
unsigned long mmap_base; /* base of mmap area */
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 81a173c..3f9f5c4 100644
index f45c0b2..7234f1d 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -390,6 +390,10 @@ extern void arch_pick_mmap_layout(struct mm_struct *mm);
@@ -391,6 +391,10 @@ extern void arch_pick_mmap_layout(struct mm_struct *mm);
extern unsigned long
arch_get_unmapped_area(struct file *, unsigned long, unsigned long,
unsigned long, unsigned long);
@ -108,18 +99,18 @@ index 81a173c..3f9f5c4 100644
arch_get_unmapped_area_topdown(struct file *filp, unsigned long addr,
unsigned long len, unsigned long pgoff,
diff --git a/mm/mmap.c b/mm/mmap.c
index 848ef52..65650a5 100644
index e8dcfc7..4bb6ac9 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -30,6 +30,7 @@
#include <linux/perf_event.h>
@@ -31,6 +31,7 @@
#include <linux/audit.h>
#include <linux/khugepaged.h>
#include <linux/uprobes.h>
+#include <linux/random.h>
#include <asm/uaccess.h>
#include <asm/cacheflush.h>
@@ -995,7 +996,8 @@ static unsigned long do_mmap_pgoff(struct file *file, unsigned long addr,
@@ -1013,7 +1014,8 @@ static unsigned long do_mmap_pgoff(struct file *file, unsigned long addr,
/* Obtain the address to map to. we verify (or select) it and ensure
* that it represents a valid section of the address space.
*/
@ -129,7 +120,7 @@ index 848ef52..65650a5 100644
if (addr & ~PAGE_MASK)
return addr;
@@ -1580,8 +1582,8 @@ void arch_unmap_area_topdown(struct mm_struct *mm, unsigned long addr)
@@ -1603,8 +1605,8 @@ void arch_unmap_area_topdown(struct mm_struct *mm, unsigned long addr)
}
unsigned long
@ -140,7 +131,7 @@ index 848ef52..65650a5 100644
{
unsigned long (*get_area)(struct file *, unsigned long,
unsigned long, unsigned long, unsigned long);
@@ -1594,7 +1596,11 @@ get_unmapped_area(struct file *file, unsigned long addr, unsigned long len,
@@ -1617,7 +1619,11 @@ get_unmapped_area(struct file *file, unsigned long addr, unsigned long len,
if (len > TASK_SIZE)
return -ENOMEM;
@ -153,7 +144,7 @@ index 848ef52..65650a5 100644
if (file && file->f_op && file->f_op->get_unmapped_area)
get_area = file->f_op->get_unmapped_area;
addr = get_area(file, addr, len, pgoff, flags);
@@ -1608,8 +1614,83 @@ get_unmapped_area(struct file *file, unsigned long addr, unsigned long len,
@@ -1631,8 +1637,83 @@ get_unmapped_area(struct file *file, unsigned long addr, unsigned long len,
return arch_rebalance_pgtables(addr, len);
}

View File

@ -1,32 +1,20 @@
From b2c6d55b2351152696aafb8c9bf3ec8968acf77c Mon Sep 17 00:00:00 2001
From: Kyle McMartin <kyle@phobos.i.jkkm.org>
Date: Mon, 29 Mar 2010 23:59:58 -0400
Subject: linux-2.6-input-kill-stupid-messages
---
drivers/input/keyboard/atkbd.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c
index d358ef8..38db098 100644
index add5ffd..5eb2f03 100644
--- a/drivers/input/keyboard/atkbd.c
+++ b/drivers/input/keyboard/atkbd.c
@@ -425,11 +426,15 @@ static irqreturn_t atkbd_interrupt(struct serio *serio, unsigned char data,
@@ -430,11 +430,15 @@ static irqreturn_t atkbd_interrupt(struct serio *serio, unsigned char data,
goto out;
case ATKBD_RET_ACK:
case ATKBD_RET_NAK:
+#if 0
+# if 0
+ /* Quite a few key switchers and other tools trigger this
+ * and it confuses people who can do nothing about it */
if (printk_ratelimit())
dev_warn(&serio->dev,
"Spurious %s on %s. "
"Some program might be trying access hardware directly.\n",
"Some program might be trying to access hardware directly.\n",
data == ATKBD_RET_ACK ? "ACK" : "NAK", serio->phys);
+#endif
goto out;
case ATKBD_RET_ERR:
atkbd->err_count++;
--
1.7.0.1

View File

@ -1,2 +1,2 @@
967f72983655e2479f951195953e8480 linux-3.4.tar.xz
657853733d14a957379f1bf15f454b75 patch-3.4-git6.xz
09761e8f1f690e9a906d5f9f988c99d5 patch-3.4-git7.xz

View File

@ -1,642 +0,0 @@
Delivered-To: jwboyer@gmail.com
Received: by 10.229.187.201 with SMTP id cx9csp141480qcb;
Mon, 16 Apr 2012 13:27:50 -0700 (PDT)
Received: by 10.60.0.201 with SMTP id 9mr17463209oeg.59.1334608065659;
Mon, 16 Apr 2012 13:27:45 -0700 (PDT)
Return-Path: <linux-kernel-owner@vger.kernel.org>
Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67])
by mx.google.com with ESMTP id 4si12245496oei.14.2012.04.16.13.27.44;
Mon, 16 Apr 2012 13:27:45 -0700 (PDT)
Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67;
Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mail=linux-kernel-owner@vger.kernel.org
Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
id S1755065Ab2DPU02 (ORCPT <rfc822;padmanabhlinux@gmail.com>
+ 99 others); Mon, 16 Apr 2012 16:26:28 -0400
Received: from mx1.redhat.com ([209.132.183.28]:1184 "EHLO mx1.redhat.com"
rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP
id S1754698Ab2DPU01 (ORCPT <rfc822;linux-kernel@vger.kernel.org>);
Mon, 16 Apr 2012 16:26:27 -0400
Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11])
by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q3GKQPYb007336
(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK);
Mon, 16 Apr 2012 16:26:25 -0400
Received: from cavan.codon.org.uk (ovpn-113-122.phx2.redhat.com [10.3.113.122])
by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q3GKQNG5011412
(version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO);
Mon, 16 Apr 2012 16:26:24 -0400
Received: from nat-pool-rdu.redhat.com ([66.187.233.202] helo=x220.boston.devel.redhat.com)
by cavan.codon.org.uk with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
(Exim 4.72)
(envelope-from <mjg@redhat.com>)
id 1SJsVA-0003T4-U8; Mon, 16 Apr 2012 21:26:21 +0100
From: Matthew Garrett <mjg@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: Matthew Garrett <mjg@redhat.com>, benh@kernel.crashing.org,
airlied@redhat.com
Subject: [PATCH V2 1/4] vgaarb: Add support for setting the default video device
Date: Mon, 16 Apr 2012 16:26:02 -0400
Message-Id: <1334607965-9582-1-git-send-email-mjg@redhat.com>
X-SA-Do-Not-Run: Yes
X-SA-Exim-Connect-IP: 66.187.233.202
X-SA-Exim-Mail-From: mjg@redhat.com
X-SA-Exim-Scanned: No (on cavan.codon.org.uk); SAEximRunCond expanded to false
X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11
Sender: linux-kernel-owner@vger.kernel.org
Precedence: bulk
List-ID: <linux-kernel.vger.kernel.org>
X-Mailing-List: linux-kernel@vger.kernel.org
The default VGA device is a somewhat fluid concept on platforms with
multiple GPUs. Add support for setting it so switching code can update
things appropriately, and make sure that the sysfs code returns the right
device if it's changed.
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Cc: benh@kernel.crashing.org
Cc: airlied@redhat.com
---
Updated to fix builds when __ARCH_HAS_VGA_DEFAULT_DEVICE is false.
drivers/gpu/vga/vgaarb.c | 7 +++++++
drivers/pci/pci-sysfs.c | 5 +++++
include/linux/vgaarb.h | 2 ++
3 files changed, 14 insertions(+)
diff --git a/drivers/gpu/vga/vgaarb.c b/drivers/gpu/vga/vgaarb.c
index 111d956..e223b96 100644
--- a/drivers/gpu/vga/vgaarb.c
+++ b/drivers/gpu/vga/vgaarb.c
@@ -136,6 +136,11 @@ struct pci_dev *vga_default_device(void)
{
return vga_default;
}
+
+void vga_set_default_device(struct pci_dev *pdev)
+{
+ vga_default = pdev;
+}
#endif
static inline void vga_irq_set_state(struct vga_device *vgadev, bool state)
@@ -605,10 +610,12 @@ static bool vga_arbiter_del_pci_device(struct pci_dev *pdev)
goto bail;
}
+#ifndef __ARCH_HAS_VGA_DEFAULT_DEVICE
if (vga_default == pdev) {
pci_dev_put(vga_default);
vga_default = NULL;
}
+#endif
if (vgadev->decodes & (VGA_RSRC_LEGACY_IO | VGA_RSRC_LEGACY_MEM))
vga_decode_count--;
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
index a3cd8ca..7dd9f2b 100644
--- a/drivers/pci/pci-sysfs.c
+++ b/drivers/pci/pci-sysfs.c
@@ -27,6 +27,7 @@
#include <linux/security.h>
#include <linux/pci-aspm.h>
#include <linux/slab.h>
+#include <linux/vgaarb.h>
#include "pci.h"
static int sysfs_initialized; /* = 0 */
@@ -414,6 +415,10 @@ static ssize_t
boot_vga_show(struct device *dev, struct device_attribute *attr, char *buf)
{
struct pci_dev *pdev = to_pci_dev(dev);
+ struct pci_dev *vga_dev = vga_default_device();
+
+ if (vga_dev)
+ return sprintf(buf, "%u\n", (pdev == vga_dev));
return sprintf(buf, "%u\n",
!!(pdev->resource[PCI_ROM_RESOURCE].flags &
diff --git a/include/linux/vgaarb.h b/include/linux/vgaarb.h
index 9c3120d..759a25b 100644
--- a/include/linux/vgaarb.h
+++ b/include/linux/vgaarb.h
@@ -31,6 +31,7 @@
#ifndef LINUX_VGA_H
#define LINUX_VGA_H
+#include <video/vga.h>
/* Legacy VGA regions */
#define VGA_RSRC_NONE 0x00
@@ -181,6 +182,7 @@ extern void vga_put(struct pci_dev *pdev, unsigned int rsrc);
#ifndef __ARCH_HAS_VGA_DEFAULT_DEVICE
extern struct pci_dev *vga_default_device(void);
+extern void vga_set_default_device(struct pci_dev *pdev);
#endif
/**
--
1.7.10
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Delivered-To: jwboyer@gmail.com
Received: by 10.229.187.201 with SMTP id cx9csp141468qcb;
Mon, 16 Apr 2012 13:27:10 -0700 (PDT)
Received: by 10.182.202.69 with SMTP id kg5mr18039202obc.35.1334608025784;
Mon, 16 Apr 2012 13:27:05 -0700 (PDT)
Return-Path: <linux-kernel-owner@vger.kernel.org>
Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67])
by mx.google.com with ESMTP id p9si5895556obv.34.2012.04.16.13.27.01;
Mon, 16 Apr 2012 13:27:05 -0700 (PDT)
Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67;
Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mail=linux-kernel-owner@vger.kernel.org
Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
id S1755523Ab2DPU0b (ORCPT <rfc822;padmanabhlinux@gmail.com>
+ 99 others); Mon, 16 Apr 2012 16:26:31 -0400
Received: from mx1.redhat.com ([209.132.183.28]:15578 "EHLO mx1.redhat.com"
rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP
id S1752993Ab2DPU00 (ORCPT <rfc822;linux-kernel@vger.kernel.org>);
Mon, 16 Apr 2012 16:26:26 -0400
Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25])
by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q3GKQPu2015452
(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK)
for <linux-kernel@vger.kernel.org>; Mon, 16 Apr 2012 16:26:25 -0400
Received: from cavan.codon.org.uk (ovpn-113-122.phx2.redhat.com [10.3.113.122])
by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q3GKQOk2005441
(version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO);
Mon, 16 Apr 2012 16:26:25 -0400
Received: from nat-pool-rdu.redhat.com ([66.187.233.202] helo=x220.boston.devel.redhat.com)
by cavan.codon.org.uk with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
(Exim 4.72)
(envelope-from <mjg@redhat.com>)
id 1SJsVC-0003T4-AS; Mon, 16 Apr 2012 21:26:22 +0100
From: Matthew Garrett <mjg@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: Matthew Garrett <mjg@redhat.com>, airlied@redhat.com
Subject: [PATCH V2 2/4] vga-switcheroo: Use vga_default_device()
Date: Mon, 16 Apr 2012 16:26:03 -0400
Message-Id: <1334607965-9582-2-git-send-email-mjg@redhat.com>
In-Reply-To: <1334607965-9582-1-git-send-email-mjg@redhat.com>
References: <1334607965-9582-1-git-send-email-mjg@redhat.com>
X-SA-Do-Not-Run: Yes
X-SA-Exim-Connect-IP: 66.187.233.202
X-SA-Exim-Mail-From: mjg@redhat.com
X-SA-Exim-Scanned: No (on cavan.codon.org.uk); SAEximRunCond expanded to false
X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25
Sender: linux-kernel-owner@vger.kernel.org
Precedence: bulk
List-ID: <linux-kernel.vger.kernel.org>
X-Mailing-List: linux-kernel@vger.kernel.org
vga-switcheroo currently changes the default VGA device by fiddling with
the IORESOURCE_ROM_SHADOW flag on the device. This isn't strictly accurate,
since there's no guarantee that switching also changes the ROM decoding.
Switch over to using the vgaarb functions for this.
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Cc: airlied@redhat.com
---
drivers/gpu/vga/vga_switcheroo.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/vga/vga_switcheroo.c b/drivers/gpu/vga/vga_switcheroo.c
index 9a2c805..44c664e 100644
--- a/drivers/gpu/vga/vga_switcheroo.c
+++ b/drivers/gpu/vga/vga_switcheroo.c
@@ -28,6 +28,8 @@
#include <linux/pci.h>
#include <linux/vga_switcheroo.h>
+#include <linux/vgaarb.h>
+
struct vga_switcheroo_client {
struct pci_dev *pdev;
struct fb_info *fb_info;
@@ -140,7 +142,7 @@ int vga_switcheroo_register_client(struct pci_dev *pdev,
vgasr_priv.clients[index].reprobe = reprobe;
vgasr_priv.clients[index].can_switch = can_switch;
vgasr_priv.clients[index].id = -1;
- if (pdev->resource[PCI_ROM_RESOURCE].flags & IORESOURCE_ROM_SHADOW)
+ if (pdev == vga_default_device())
vgasr_priv.clients[index].active = true;
vgasr_priv.registered_clients |= (1 << index);
@@ -248,9 +250,8 @@ static int vga_switchto_stage1(struct vga_switcheroo_client *new_client)
if (new_client->pwr_state == VGA_SWITCHEROO_OFF)
vga_switchon(new_client);
- /* swap shadow resource to denote boot VGA device has changed so X starts on new device */
- active->pdev->resource[PCI_ROM_RESOURCE].flags &= ~IORESOURCE_ROM_SHADOW;
- new_client->pdev->resource[PCI_ROM_RESOURCE].flags |= IORESOURCE_ROM_SHADOW;
+ vga_set_default_device(new_client->pdev);
+
return 0;
}
--
1.7.10
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Delivered-To: jwboyer@gmail.com
Received: by 10.229.187.201 with SMTP id cx9csp141463qcb;
Mon, 16 Apr 2012 13:27:04 -0700 (PDT)
Received: by 10.60.10.137 with SMTP id i9mr18822682oeb.23.1334608019708;
Mon, 16 Apr 2012 13:26:59 -0700 (PDT)
Return-Path: <linux-kernel-owner@vger.kernel.org>
Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67])
by mx.google.com with ESMTP id h6si5711741obv.22.2012.04.16.13.26.58;
Mon, 16 Apr 2012 13:26:59 -0700 (PDT)
Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67;
Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mail=linux-kernel-owner@vger.kernel.org
Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
id S1755396Ab2DPU0a (ORCPT <rfc822;padmanabhlinux@gmail.com>
+ 99 others); Mon, 16 Apr 2012 16:26:30 -0400
Received: from mx1.redhat.com ([209.132.183.28]:4863 "EHLO mx1.redhat.com"
rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP
id S1754084Ab2DPU01 (ORCPT <rfc822;linux-kernel@vger.kernel.org>);
Mon, 16 Apr 2012 16:26:27 -0400
Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23])
by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q3GKQQrr007340
(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK);
Mon, 16 Apr 2012 16:26:26 -0400
Received: from cavan.codon.org.uk (ovpn-113-122.phx2.redhat.com [10.3.113.122])
by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q3GKQPuK005698
(version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO);
Mon, 16 Apr 2012 16:26:26 -0400
Received: from nat-pool-rdu.redhat.com ([66.187.233.202] helo=x220.boston.devel.redhat.com)
by cavan.codon.org.uk with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
(Exim 4.72)
(envelope-from <mjg@redhat.com>)
id 1SJsVD-0003T4-F3; Mon, 16 Apr 2012 21:26:23 +0100
From: Matthew Garrett <mjg@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: Matthew Garrett <mjg@redhat.com>, mingo@redhat.com, hpa@zytor.com
Subject: [PATCH V2 3/4] x86: Use vga_default_device() when determining whether an fb is primary
Date: Mon, 16 Apr 2012 16:26:04 -0400
Message-Id: <1334607965-9582-3-git-send-email-mjg@redhat.com>
In-Reply-To: <1334607965-9582-1-git-send-email-mjg@redhat.com>
References: <1334607965-9582-1-git-send-email-mjg@redhat.com>
X-SA-Do-Not-Run: Yes
X-SA-Exim-Connect-IP: 66.187.233.202
X-SA-Exim-Mail-From: mjg@redhat.com
X-SA-Exim-Scanned: No (on cavan.codon.org.uk); SAEximRunCond expanded to false
X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23
Sender: linux-kernel-owner@vger.kernel.org
Precedence: bulk
List-ID: <linux-kernel.vger.kernel.org>
X-Mailing-List: linux-kernel@vger.kernel.org
IORESOURCE_ROM_SHADOW is not necessarily an indication that the hardware
is the primary device. Add support for using the vgaarb functions and
fall back if nothing's set them.
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Cc: mingo@redhat.com
Cc: hpa@zytor.com
---
arch/x86/video/fbdev.c | 20 +++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)
diff --git a/arch/x86/video/fbdev.c b/arch/x86/video/fbdev.c
index c5ffb6a..d5644bb 100644
--- a/arch/x86/video/fbdev.c
+++ b/arch/x86/video/fbdev.c
@@ -9,24 +9,34 @@
#include <linux/fb.h>
#include <linux/pci.h>
#include <linux/module.h>
+#include <linux/vgaarb.h>
int fb_is_primary_device(struct fb_info *info)
{
struct device *device = info->device;
struct pci_dev *pci_dev = NULL;
+ struct pci_dev *default_device = vga_default_device();
struct resource *res = NULL;
- int retval = 0;
if (device)
pci_dev = to_pci_dev(device);
- if (pci_dev)
- res = &pci_dev->resource[PCI_ROM_RESOURCE];
+ if (!pci_dev)
+ return 0;
+
+ if (default_device) {
+ if (pci_dev == default_device)
+ return 1;
+ else
+ return 0;
+ }
+
+ res = &pci_dev->resource[PCI_ROM_RESOURCE];
if (res && res->flags & IORESOURCE_ROM_SHADOW)
- retval = 1;
+ return 1;
- return retval;
+ return 0;
}
EXPORT_SYMBOL(fb_is_primary_device);
MODULE_LICENSE("GPL");
--
1.7.10
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Delivered-To: jwboyer@gmail.com
Received: by 10.229.187.201 with SMTP id cx9csp141467qcb;
Mon, 16 Apr 2012 13:27:10 -0700 (PDT)
Received: by 10.182.183.73 with SMTP id ek9mr17996942obc.15.1334608026429;
Mon, 16 Apr 2012 13:27:06 -0700 (PDT)
Return-Path: <linux-kernel-owner@vger.kernel.org>
Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67])
by mx.google.com with ESMTP id ry6si1466151obc.95.2012.04.16.13.27.02;
Mon, 16 Apr 2012 13:27:06 -0700 (PDT)
Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67;
Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mail=linux-kernel-owner@vger.kernel.org
Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
id S1755405Ab2DPU0z (ORCPT <rfc822;padmanabhlinux@gmail.com>
+ 99 others); Mon, 16 Apr 2012 16:26:55 -0400
Received: from mx1.redhat.com ([209.132.183.28]:27749 "EHLO mx1.redhat.com"
rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP
id S1755265Ab2DPU03 (ORCPT <rfc822;linux-kernel@vger.kernel.org>);
Mon, 16 Apr 2012 16:26:29 -0400
Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25])
by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q3GKQShl015458
(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK);
Mon, 16 Apr 2012 16:26:28 -0400
Received: from cavan.codon.org.uk (ovpn-113-122.phx2.redhat.com [10.3.113.122])
by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q3GKQQwW005450
(version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO);
Mon, 16 Apr 2012 16:26:27 -0400
Received: from nat-pool-rdu.redhat.com ([66.187.233.202] helo=x220.boston.devel.redhat.com)
by cavan.codon.org.uk with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
(Exim 4.72)
(envelope-from <mjg@redhat.com>)
id 1SJsVE-0003T4-Uv; Mon, 16 Apr 2012 21:26:25 +0100
From: Matthew Garrett <mjg@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: Matthew Garrett <mjg@redhat.com>, hpa@zytor.com,
matt.fleming@intel.com
Subject: [PATCH V2 4/4] efifb: Implement vga_default_device()
Date: Mon, 16 Apr 2012 16:26:05 -0400
Message-Id: <1334607965-9582-4-git-send-email-mjg@redhat.com>
In-Reply-To: <1334607965-9582-1-git-send-email-mjg@redhat.com>
References: <1334607965-9582-1-git-send-email-mjg@redhat.com>
X-SA-Do-Not-Run: Yes
X-SA-Exim-Connect-IP: 66.187.233.202
X-SA-Exim-Mail-From: mjg@redhat.com
X-SA-Exim-Scanned: No (on cavan.codon.org.uk); SAEximRunCond expanded to false
X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25
Sender: linux-kernel-owner@vger.kernel.org
Precedence: bulk
List-ID: <linux-kernel.vger.kernel.org>
X-Mailing-List: linux-kernel@vger.kernel.org
EFI doesn't typically make use of the legacy VGA ROM, but it may still be
configured to pass that through to a given video device. This may lead to
an inaccurate choice of default video device. Add support to efifb to pick
out the correct active video device.
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Cc: hpa@zytor.com
Cc: matt.fleming@intel.com
---
arch/x86/include/asm/vga.h | 6 ++++
drivers/video/efifb.c | 77 ++++++++++++++++++++++++++++++++------------
2 files changed, 63 insertions(+), 20 deletions(-)
diff --git a/arch/x86/include/asm/vga.h b/arch/x86/include/asm/vga.h
index c4b9dc2..2723c07 100644
--- a/arch/x86/include/asm/vga.h
+++ b/arch/x86/include/asm/vga.h
@@ -17,4 +17,10 @@
#define vga_readb(x) (*(x))
#define vga_writeb(x, y) (*(y) = (x))
+#ifdef CONFIG_FB_EFI
+#define __ARCH_HAS_VGA_DEFAULT_DEVICE
+extern struct pci_dev *vga_default_device(void);
+extern void vga_set_default_device(struct pci_dev *pdev);
+#endif
+
#endif /* _ASM_X86_VGA_H */
diff --git a/drivers/video/efifb.c b/drivers/video/efifb.c
index 784139a..66ed991 100644
--- a/drivers/video/efifb.c
+++ b/drivers/video/efifb.c
@@ -18,6 +18,8 @@
static bool request_mem_succeeded = false;
+static struct pci_dev *default_vga;
+
static struct fb_var_screeninfo efifb_defined __devinitdata = {
.activate = FB_ACTIVATE_NOW,
.height = -1,
@@ -298,35 +300,70 @@ static struct fb_ops efifb_ops = {
.fb_imageblit = cfb_imageblit,
};
+struct pci_dev *vga_default_device(void)
+{
+ return default_vga;
+}
+
+void vga_set_default_device(struct pci_dev *pdev)
+{
+ default_vga = pdev;
+}
+
static int __init efifb_setup(char *options)
{
char *this_opt;
int i;
+ struct pci_dev *dev = NULL;
+
+ if (options && *options) {
+ while ((this_opt = strsep(&options, ",")) != NULL) {
+ if (!*this_opt) continue;
+
+ for (i = 0; i < M_UNKNOWN; i++) {
+ if (!strcmp(this_opt, dmi_list[i].optname) &&
+ dmi_list[i].base != 0) {
+ screen_info.lfb_base = dmi_list[i].base;
+ screen_info.lfb_linelength = dmi_list[i].stride;
+ screen_info.lfb_width = dmi_list[i].width;
+ screen_info.lfb_height = dmi_list[i].height;
+ }
+ }
+ if (!strncmp(this_opt, "base:", 5))
+ screen_info.lfb_base = simple_strtoul(this_opt+5, NULL, 0);
+ else if (!strncmp(this_opt, "stride:", 7))
+ screen_info.lfb_linelength = simple_strtoul(this_opt+7, NULL, 0) * 4;
+ else if (!strncmp(this_opt, "height:", 7))
+ screen_info.lfb_height = simple_strtoul(this_opt+7, NULL, 0);
+ else if (!strncmp(this_opt, "width:", 6))
+ screen_info.lfb_width = simple_strtoul(this_opt+6, NULL, 0);
+ }
+ }
- if (!options || !*options)
- return 0;
+ for_each_pci_dev(dev) {
+ int i;
- while ((this_opt = strsep(&options, ",")) != NULL) {
- if (!*this_opt) continue;
+ if ((dev->class >> 8) != PCI_CLASS_DISPLAY_VGA)
+ continue;
- for (i = 0; i < M_UNKNOWN; i++) {
- if (!strcmp(this_opt, dmi_list[i].optname) &&
- dmi_list[i].base != 0) {
- screen_info.lfb_base = dmi_list[i].base;
- screen_info.lfb_linelength = dmi_list[i].stride;
- screen_info.lfb_width = dmi_list[i].width;
- screen_info.lfb_height = dmi_list[i].height;
- }
+ for (i=0; i < DEVICE_COUNT_RESOURCE; i++) {
+ resource_size_t start, end;
+
+ if (!(pci_resource_flags(dev, i) & IORESOURCE_MEM))
+ continue;
+
+ start = pci_resource_start(dev, i);
+ end = pci_resource_end(dev, i);
+
+ if (!start || !end)
+ continue;
+
+ if (screen_info.lfb_base >= start &&
+ (screen_info.lfb_base + screen_info.lfb_size) < end)
+ default_vga = dev;
}
- if (!strncmp(this_opt, "base:", 5))
- screen_info.lfb_base = simple_strtoul(this_opt+5, NULL, 0);
- else if (!strncmp(this_opt, "stride:", 7))
- screen_info.lfb_linelength = simple_strtoul(this_opt+7, NULL, 0) * 4;
- else if (!strncmp(this_opt, "height:", 7))
- screen_info.lfb_height = simple_strtoul(this_opt+7, NULL, 0);
- else if (!strncmp(this_opt, "width:", 6))
- screen_info.lfb_width = simple_strtoul(this_opt+6, NULL, 0);
}
+
return 0;
}
--
1.7.10
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Path: news.gmane.org!not-for-mail
From: Dave Airlie <airlied@gmail.com>
Newsgroups: gmane.linux.kernel
Subject: [PATCH] x86/vga: set the default device from the fixup.
Date: Mon, 14 May 2012 17:01:20 +0100
Lines: 42
Approved: news@gmane.org
Message-ID: <1337011280-7166-1-git-send-email-airlied@gmail.com>
NNTP-Posting-Host: plane.gmane.org
X-Trace: dough.gmane.org 1337011751 27684 80.91.229.3 (14 May 2012 16:09:11 GMT)
X-Complaints-To: usenet@dough.gmane.org
NNTP-Posting-Date: Mon, 14 May 2012 16:09:11 +0000 (UTC)
Cc: Dave Airlie <airlied@redhat.com>, Matthew Garrett <mjg@redhat.com>,
"H. Peter Anvin" <hpa@zytor.com>
To: linux-kernel@vger.kernel.org
Original-X-From: linux-kernel-owner@vger.kernel.org Mon May 14 18:09:10 2012
Return-path: <linux-kernel-owner@vger.kernel.org>
Envelope-to: glk-linux-kernel-3@plane.gmane.org
Original-Received: from vger.kernel.org ([209.132.180.67])
by plane.gmane.org with esmtp (Exim 4.69)
(envelope-from <linux-kernel-owner@vger.kernel.org>)
id 1STxpW-0007oo-4X
for glk-linux-kernel-3@plane.gmane.org; Mon, 14 May 2012 18:09:02 +0200
Original-Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
id S1756889Ab2ENQIs (ORCPT <rfc822;glk-linux-kernel-3@m.gmane.org>);
Mon, 14 May 2012 12:08:48 -0400
Original-Received: from mx1.redhat.com ([209.132.183.28]:34445 "EHLO mx1.redhat.com"
rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP
id S1756736Ab2ENQIm (ORCPT <rfc822;linux-kernel@vger.kernel.org>);
Mon, 14 May 2012 12:08:42 -0400
Original-Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24])
by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q4EG8ftT012092
(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK);
Mon, 14 May 2012 12:08:42 -0400
Original-Received: from optimus.redhat.com (vpn1-5-164.ams2.redhat.com [10.36.5.164])
by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q4EG5Ch0001452;
Mon, 14 May 2012 12:05:12 -0400
X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24
Original-Sender: linux-kernel-owner@vger.kernel.org
Precedence: bulk
List-ID: <linux-kernel.vger.kernel.org>
X-Mailing-List: linux-kernel@vger.kernel.org
Xref: news.gmane.org gmane.linux.kernel:1296685
Archived-At: <http://permalink.gmane.org/gmane.linux.kernel/1296685>
From: Dave Airlie <airlied@redhat.com>
Since Matthew's efi/vga changes on non-EFI machines we were failing
to tell the vgaarb/switcheroo what the default device was, this
sets the default device in the quirk if none has been set before.
This fixes the switcheroo on my T410s.
[hpa: please ack to put this on top of the other patches in my -next tree].
Signed-off-by: Dave Airlie <airlied@redhat.com>
Cc: Matthew Garrett <mjg@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
---
arch/x86/pci/fixup.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/arch/x86/pci/fixup.c b/arch/x86/pci/fixup.c
index d0e6e40..cf81c02 100644
--- a/arch/x86/pci/fixup.c
+++ b/arch/x86/pci/fixup.c
@@ -7,6 +7,7 @@
#include <linux/pci.h>
#include <linux/init.h>
#include <asm/pci_x86.h>
+#include <asm/vga.h>
static void __devinit pci_fixup_i450nx(struct pci_dev *d)
{
@@ -348,6 +349,8 @@ static void __devinit pci_fixup_video(struct pci_dev *pdev)
if (config & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) {
pdev->resource[PCI_ROM_RESOURCE].flags |= IORESOURCE_ROM_SHADOW;
dev_printk(KERN_DEBUG, &pdev->dev, "Boot video device\n");
+ if (vga_default_device() == NULL)
+ vga_set_default_device(pdev);
}
}
DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_ANY_ID, PCI_ANY_ID,
--
1.7.6