Merge tag 'drm-intel-fixes-2014-04-04' of git://anongit.freedesktop.org/drm-intel into drm-next

Merge window -fixes pull request as usual. Well, I did sneak in Jani's
drm_i915_private_t typedef removal, need to have fun with a big sed job
too ;-)

Otherwise:
- hdmi interlaced fixes (Jesse&Ville)
- pipe error/underrun/crc tracking fixes, regression in late 3.14-rc (but
  not cc: stable since only really relevant for igt runs)
- large cursor wm fixes (Chris)
- fix gpu turbo boost/throttle again, was getting stuck due to vlv rps
  patches (Chris+Imre)
- fix runtime pm fallout (Paulo)
- bios framebuffer inherit fix (Chris)
- a few smaller things

* tag 'drm-intel-fixes-2014-04-04' of git://anongit.freedesktop.org/drm-intel: (196 commits)
  Skip intel_crt_init for Dell XPS 8700
  drm/i915: vlv: fix RPS interrupt mask setting
  Revert "drm/i915/vlv: fixup DDR freq detection per Punit spec"
  drm/i915: move power domain init earlier during system resume
  drm/i915: Fix the computation of required fb size for pipe
  drm/i915: don't get/put runtime PM at the debugfs forcewake file
  drm/i915: fix WARNs when reading DDI state while suspended
  drm/i915: don't read cursor registers on powered down pipes
  drm/i915: get runtime PM at i915_display_info
  drm/i915: don't read pp_ctrl_reg if we're suspended
  drm/i915: get runtime PM at i915_reg_read_ioctl
  drm/i915: don't schedule force_wake_timer at gen6_read
  drm/i915: vlv: reserve the GT power context only once during driver init
  drm/i915: prefer struct drm_i915_private to drm_i915_private_t
  drm/i915/overlay: prefer struct drm_i915_private to drm_i915_private_t
  drm/i915/ringbuffer: prefer struct drm_i915_private to drm_i915_private_t
  drm/i915/display: prefer struct drm_i915_private to drm_i915_private_t
  drm/i915/irq: prefer struct drm_i915_private to drm_i915_private_t
  drm/i915/gem: prefer struct drm_i915_private to drm_i915_private_t
  drm/i915/dma: prefer struct drm_i915_private to drm_i915_private_t
  ...
This commit is contained in:
Dave Airlie 2014-04-05 16:14:21 +10:00
commit 9f97ba806a
189 changed files with 2174 additions and 1507 deletions

View File

@ -7,3 +7,4 @@ Required properties:
Optional properties: Optional properties:
- local-mac-address : Ethernet mac address to use - local-mac-address : Ethernet mac address to use
- vdd-supply: supply for Ethernet mac

View File

@ -226,9 +226,9 @@ Ring setup:
void *rx_ring, *tx_ring; void *rx_ring, *tx_ring;
/* Configure ring parameters */ /* Configure ring parameters */
if (setsockopt(fd, NETLINK_RX_RING, &req, sizeof(req)) < 0) if (setsockopt(fd, SOL_NETLINK, NETLINK_RX_RING, &req, sizeof(req)) < 0)
exit(1); exit(1);
if (setsockopt(fd, NETLINK_TX_RING, &req, sizeof(req)) < 0) if (setsockopt(fd, SOL_NETLINK, NETLINK_TX_RING, &req, sizeof(req)) < 0)
exit(1) exit(1)
/* Calculate size of each individual ring */ /* Calculate size of each individual ring */

View File

@ -911,11 +911,11 @@ F: arch/arm/include/asm/hardware/dec21285.h
F: arch/arm/mach-footbridge/ F: arch/arm/mach-footbridge/
ARM/FREESCALE IMX / MXC ARM ARCHITECTURE ARM/FREESCALE IMX / MXC ARM ARCHITECTURE
M: Shawn Guo <shawn.guo@linaro.org> M: Shawn Guo <shawn.guo@freescale.com>
M: Sascha Hauer <kernel@pengutronix.de> M: Sascha Hauer <kernel@pengutronix.de>
L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
S: Maintained S: Maintained
T: git git://git.linaro.org/people/shawnguo/linux-2.6.git T: git git://git.kernel.org/pub/scm/linux/kernel/git/shawnguo/linux.git
F: arch/arm/mach-imx/ F: arch/arm/mach-imx/
F: arch/arm/boot/dts/imx* F: arch/arm/boot/dts/imx*
F: arch/arm/configs/imx*_defconfig F: arch/arm/configs/imx*_defconfig
@ -1832,8 +1832,8 @@ F: net/bluetooth/
F: include/net/bluetooth/ F: include/net/bluetooth/
BONDING DRIVER BONDING DRIVER
M: Jay Vosburgh <fubar@us.ibm.com> M: Jay Vosburgh <j.vosburgh@gmail.com>
M: Veaceslav Falico <vfalico@redhat.com> M: Veaceslav Falico <vfalico@gmail.com>
M: Andy Gospodarek <andy@greyhouse.net> M: Andy Gospodarek <andy@greyhouse.net>
L: netdev@vger.kernel.org L: netdev@vger.kernel.org
W: http://sourceforge.net/projects/bonding/ W: http://sourceforge.net/projects/bonding/
@ -2801,9 +2801,9 @@ S: Supported
F: drivers/acpi/dock.c F: drivers/acpi/dock.c
DOCUMENTATION DOCUMENTATION
M: Rob Landley <rob@landley.net> M: Randy Dunlap <rdunlap@infradead.org>
L: linux-doc@vger.kernel.org L: linux-doc@vger.kernel.org
T: TBD T: quilt http://www.infradead.org/~rdunlap/Doc/patches/
S: Maintained S: Maintained
F: Documentation/ F: Documentation/
@ -4549,6 +4549,7 @@ M: Greg Rose <gregory.v.rose@intel.com>
M: Alex Duyck <alexander.h.duyck@intel.com> M: Alex Duyck <alexander.h.duyck@intel.com>
M: John Ronciak <john.ronciak@intel.com> M: John Ronciak <john.ronciak@intel.com>
M: Mitch Williams <mitch.a.williams@intel.com> M: Mitch Williams <mitch.a.williams@intel.com>
M: Linux NICS <linux.nics@intel.com>
L: e1000-devel@lists.sourceforge.net L: e1000-devel@lists.sourceforge.net
W: http://www.intel.com/support/feedback.htm W: http://www.intel.com/support/feedback.htm
W: http://e1000.sourceforge.net/ W: http://e1000.sourceforge.net/
@ -6009,6 +6010,7 @@ F: include/uapi/linux/net.h
F: include/uapi/linux/netdevice.h F: include/uapi/linux/netdevice.h
F: tools/net/ F: tools/net/
F: tools/testing/selftests/net/ F: tools/testing/selftests/net/
F: lib/random32.c
NETWORKING [IPv4/IPv6] NETWORKING [IPv4/IPv6]
M: "David S. Miller" <davem@davemloft.net> M: "David S. Miller" <davem@davemloft.net>

View File

@ -1,7 +1,7 @@
VERSION = 3 VERSION = 3
PATCHLEVEL = 14 PATCHLEVEL = 14
SUBLEVEL = 0 SUBLEVEL = 0
EXTRAVERSION = -rc7 EXTRAVERSION =
NAME = Shuffling Zombie Juror NAME = Shuffling Zombie Juror
# *DOCUMENTATION* # *DOCUMENTATION*

View File

@ -8,8 +8,8 @@
*/ */
#include "sama5d3.dtsi" #include "sama5d3.dtsi"
#include "sama5d3_can.dtsi" #include "sama5d3_can.dtsi"
#include "sama5d3_emac.dtsi"
#include "sama5d3_gmac.dtsi" #include "sama5d3_gmac.dtsi"
#include "sama5d3_emac.dtsi"
#include "sama5d3_lcd.dtsi" #include "sama5d3_lcd.dtsi"
#include "sama5d3_mci2.dtsi" #include "sama5d3_mci2.dtsi"
#include "sama5d3_tcb1.dtsi" #include "sama5d3_tcb1.dtsi"

View File

@ -1776,12 +1776,12 @@ endchoice
config FORCE_MAX_ZONEORDER config FORCE_MAX_ZONEORDER
int "Maximum zone order" int "Maximum zone order"
range 14 64 if HUGETLB_PAGE && PAGE_SIZE_64KB range 14 64 if MIPS_HUGE_TLB_SUPPORT && PAGE_SIZE_64KB
default "14" if HUGETLB_PAGE && PAGE_SIZE_64KB default "14" if MIPS_HUGE_TLB_SUPPORT && PAGE_SIZE_64KB
range 13 64 if HUGETLB_PAGE && PAGE_SIZE_32KB range 13 64 if MIPS_HUGE_TLB_SUPPORT && PAGE_SIZE_32KB
default "13" if HUGETLB_PAGE && PAGE_SIZE_32KB default "13" if MIPS_HUGE_TLB_SUPPORT && PAGE_SIZE_32KB
range 12 64 if HUGETLB_PAGE && PAGE_SIZE_16KB range 12 64 if MIPS_HUGE_TLB_SUPPORT && PAGE_SIZE_16KB
default "12" if HUGETLB_PAGE && PAGE_SIZE_16KB default "12" if MIPS_HUGE_TLB_SUPPORT && PAGE_SIZE_16KB
range 11 64 range 11 64
default "11" default "11"
help help
@ -2353,9 +2353,8 @@ config SECCOMP
If unsure, say Y. Only embedded should say N here. If unsure, say Y. Only embedded should say N here.
config MIPS_O32_FP64_SUPPORT config MIPS_O32_FP64_SUPPORT
bool "Support for O32 binaries using 64-bit FP" bool "Support for O32 binaries using 64-bit FP (EXPERIMENTAL)"
depends on 32BIT || MIPS32_O32 depends on 32BIT || MIPS32_O32
default y
help help
When this is enabled, the kernel will support use of 64-bit floating When this is enabled, the kernel will support use of 64-bit floating
point registers with binaries using the O32 ABI along with the point registers with binaries using the O32 ABI along with the
@ -2367,7 +2366,14 @@ config MIPS_O32_FP64_SUPPORT
of your kernel & potentially improve FP emulation performance by of your kernel & potentially improve FP emulation performance by
saying N here. saying N here.
If unsure, say Y. Although binutils currently supports use of this flag the details
concerning its effect upon the O32 ABI in userland are still being
worked on. In order to avoid userland becoming dependant upon current
behaviour before the details have been finalised, this option should
be considered experimental and only enabled by those working upon
said details.
If unsure, say N.
config USE_OF config USE_OF
bool bool

View File

@ -53,10 +53,8 @@ void __init prom_init(void)
prom_init_cmdline(); prom_init_cmdline();
memsize_str = prom_getenv("memsize"); memsize_str = prom_getenv("memsize");
if (!memsize_str) if (!memsize_str || kstrtoul(memsize_str, 0, &memsize))
memsize = 0x04000000; memsize = 0x04000000;
else
strict_strtoul(memsize_str, 0, &memsize);
add_memory_region(0, memsize, BOOT_MEM_RAM); add_memory_region(0, memsize, BOOT_MEM_RAM);
} }

View File

@ -52,10 +52,8 @@ void __init prom_init(void)
prom_init_cmdline(); prom_init_cmdline();
memsize_str = prom_getenv("memsize"); memsize_str = prom_getenv("memsize");
if (!memsize_str) if (!memsize_str || kstrtoul(memsize_str, 0, &memsize))
memsize = 0x04000000; memsize = 0x04000000;
else
strict_strtoul(memsize_str, 0, &memsize);
add_memory_region(0, memsize, BOOT_MEM_RAM); add_memory_region(0, memsize, BOOT_MEM_RAM);
} }

View File

@ -1,3 +1,4 @@
#include <linux/errno.h>
#include <linux/export.h> #include <linux/export.h>
#include <linux/string.h> #include <linux/string.h>
#include <bcm47xx_board.h> #include <bcm47xx_board.h>

View File

@ -196,7 +196,7 @@ int bcm47xx_nvram_gpio_pin(const char *name)
char nvram_var[10]; char nvram_var[10];
char buf[30]; char buf[30];
for (i = 0; i < 16; i++) { for (i = 0; i < 32; i++) {
err = snprintf(nvram_var, sizeof(nvram_var), "gpio%i", i); err = snprintf(nvram_var, sizeof(nvram_var), "gpio%i", i);
if (err <= 0) if (err <= 0)
continue; continue;

View File

@ -975,10 +975,6 @@ static int octeon_irq_ciu_xlat(struct irq_domain *d,
if (ciu > 1 || bit > 63) if (ciu > 1 || bit > 63)
return -EINVAL; return -EINVAL;
/* These are the GPIO lines */
if (ciu == 0 && bit >= 16 && bit < 32)
return -EINVAL;
*out_hwirq = (ciu << 6) | bit; *out_hwirq = (ciu << 6) | bit;
*out_type = 0; *out_type = 0;
@ -1007,6 +1003,10 @@ static int octeon_irq_ciu_map(struct irq_domain *d,
if (!octeon_irq_virq_in_range(virq)) if (!octeon_irq_virq_in_range(virq))
return -EINVAL; return -EINVAL;
/* Don't map irq if it is reserved for GPIO. */
if (line == 0 && bit >= 16 && bit <32)
return 0;
if (line > 1 || octeon_irq_ciu_to_irq[line][bit] != 0) if (line > 1 || octeon_irq_ciu_to_irq[line][bit] != 0)
return -EINVAL; return -EINVAL;
@ -1525,10 +1525,6 @@ static int octeon_irq_ciu2_xlat(struct irq_domain *d,
ciu = intspec[0]; ciu = intspec[0];
bit = intspec[1]; bit = intspec[1];
/* Line 7 are the GPIO lines */
if (ciu > 6 || bit > 63)
return -EINVAL;
*out_hwirq = (ciu << 6) | bit; *out_hwirq = (ciu << 6) | bit;
*out_type = 0; *out_type = 0;
@ -1570,8 +1566,14 @@ static int octeon_irq_ciu2_map(struct irq_domain *d,
if (!octeon_irq_virq_in_range(virq)) if (!octeon_irq_virq_in_range(virq))
return -EINVAL; return -EINVAL;
/* Line 7 are the GPIO lines */ /*
if (line > 6 || octeon_irq_ciu_to_irq[line][bit] != 0) * Don't map irq if it is reserved for GPIO.
* (Line 7 are the GPIO lines.)
*/
if (line == 7)
return 0;
if (line > 7 || octeon_irq_ciu_to_irq[line][bit] != 0)
return -EINVAL; return -EINVAL;
if (octeon_irq_ciu2_is_edge(line, bit)) if (octeon_irq_ciu2_is_edge(line, bit))

View File

@ -9,6 +9,7 @@
#define _ASM_ASMMACRO_H #define _ASM_ASMMACRO_H
#include <asm/hazards.h> #include <asm/hazards.h>
#include <asm/asm-offsets.h>
#ifdef CONFIG_32BIT #ifdef CONFIG_32BIT
#include <asm/asmmacro-32.h> #include <asm/asmmacro-32.h>
@ -54,11 +55,21 @@
.endm .endm
.macro local_irq_disable reg=t0 .macro local_irq_disable reg=t0
#ifdef CONFIG_PREEMPT
lw \reg, TI_PRE_COUNT($28)
addi \reg, \reg, 1
sw \reg, TI_PRE_COUNT($28)
#endif
mfc0 \reg, CP0_STATUS mfc0 \reg, CP0_STATUS
ori \reg, \reg, 1 ori \reg, \reg, 1
xori \reg, \reg, 1 xori \reg, \reg, 1
mtc0 \reg, CP0_STATUS mtc0 \reg, CP0_STATUS
irq_disable_hazard irq_disable_hazard
#ifdef CONFIG_PREEMPT
lw \reg, TI_PRE_COUNT($28)
addi \reg, \reg, -1
sw \reg, TI_PRE_COUNT($28)
#endif
.endm .endm
#endif /* CONFIG_MIPS_MT_SMTC */ #endif /* CONFIG_MIPS_MT_SMTC */
@ -106,7 +117,7 @@
.endm .endm
.macro fpu_save_double thread status tmp .macro fpu_save_double thread status tmp
#if defined(CONFIG_MIPS64) || defined(CONFIG_CPU_MIPS32_R2) #if defined(CONFIG_64BIT) || defined(CONFIG_CPU_MIPS32_R2)
sll \tmp, \status, 5 sll \tmp, \status, 5
bgez \tmp, 10f bgez \tmp, 10f
fpu_save_16odd \thread fpu_save_16odd \thread
@ -159,7 +170,7 @@
.endm .endm
.macro fpu_restore_double thread status tmp .macro fpu_restore_double thread status tmp
#if defined(CONFIG_MIPS64) || defined(CONFIG_CPU_MIPS32_R2) #if defined(CONFIG_64BIT) || defined(CONFIG_CPU_MIPS32_R2)
sll \tmp, \status, 5 sll \tmp, \status, 5
bgez \tmp, 10f # 16 register mode? bgez \tmp, 10f # 16 register mode?

View File

@ -57,7 +57,7 @@ static inline int __enable_fpu(enum fpu_mode mode)
return 0; return 0;
case FPU_64BIT: case FPU_64BIT:
#if !(defined(CONFIG_CPU_MIPS32_R2) || defined(CONFIG_MIPS64)) #if !(defined(CONFIG_CPU_MIPS32_R2) || defined(CONFIG_64BIT))
/* we only have a 32-bit FPU */ /* we only have a 32-bit FPU */
return SIGFPE; return SIGFPE;
#endif #endif

View File

@ -22,12 +22,12 @@ extern void _mcount(void);
#define safe_load(load, src, dst, error) \ #define safe_load(load, src, dst, error) \
do { \ do { \
asm volatile ( \ asm volatile ( \
"1: " load " %[" STR(dst) "], 0(%[" STR(src) "])\n"\ "1: " load " %[tmp_dst], 0(%[tmp_src])\n" \
" li %[" STR(error) "], 0\n" \ " li %[tmp_err], 0\n" \
"2:\n" \ "2:\n" \
\ \
".section .fixup, \"ax\"\n" \ ".section .fixup, \"ax\"\n" \
"3: li %[" STR(error) "], 1\n" \ "3: li %[tmp_err], 1\n" \
" j 2b\n" \ " j 2b\n" \
".previous\n" \ ".previous\n" \
\ \
@ -35,8 +35,8 @@ do { \
STR(PTR) "\t1b, 3b\n\t" \ STR(PTR) "\t1b, 3b\n\t" \
".previous\n" \ ".previous\n" \
\ \
: [dst] "=&r" (dst), [error] "=r" (error)\ : [tmp_dst] "=&r" (dst), [tmp_err] "=r" (error)\
: [src] "r" (src) \ : [tmp_src] "r" (src) \
: "memory" \ : "memory" \
); \ ); \
} while (0) } while (0)
@ -44,12 +44,12 @@ do { \
#define safe_store(store, src, dst, error) \ #define safe_store(store, src, dst, error) \
do { \ do { \
asm volatile ( \ asm volatile ( \
"1: " store " %[" STR(src) "], 0(%[" STR(dst) "])\n"\ "1: " store " %[tmp_src], 0(%[tmp_dst])\n"\
" li %[" STR(error) "], 0\n" \ " li %[tmp_err], 0\n" \
"2:\n" \ "2:\n" \
\ \
".section .fixup, \"ax\"\n" \ ".section .fixup, \"ax\"\n" \
"3: li %[" STR(error) "], 1\n" \ "3: li %[tmp_err], 1\n" \
" j 2b\n" \ " j 2b\n" \
".previous\n" \ ".previous\n" \
\ \
@ -57,8 +57,8 @@ do { \
STR(PTR) "\t1b, 3b\n\t" \ STR(PTR) "\t1b, 3b\n\t" \
".previous\n" \ ".previous\n" \
\ \
: [error] "=r" (error) \ : [tmp_err] "=r" (error) \
: [dst] "r" (dst), [src] "r" (src)\ : [tmp_dst] "r" (dst), [tmp_src] "r" (src)\
: "memory" \ : "memory" \
); \ ); \
} while (0) } while (0)

View File

@ -13,6 +13,7 @@
#ifndef __ASM_MIPS_SYSCALL_H #ifndef __ASM_MIPS_SYSCALL_H
#define __ASM_MIPS_SYSCALL_H #define __ASM_MIPS_SYSCALL_H
#include <linux/compiler.h>
#include <linux/audit.h> #include <linux/audit.h>
#include <linux/elf-em.h> #include <linux/elf-em.h>
#include <linux/kernel.h> #include <linux/kernel.h>
@ -39,14 +40,14 @@ static inline unsigned long mips_get_syscall_arg(unsigned long *arg,
#ifdef CONFIG_32BIT #ifdef CONFIG_32BIT
case 4: case 5: case 6: case 7: case 4: case 5: case 6: case 7:
return get_user(*arg, (int *)usp + 4 * n); return get_user(*arg, (int *)usp + n);
#endif #endif
#ifdef CONFIG_64BIT #ifdef CONFIG_64BIT
case 4: case 5: case 6: case 7: case 4: case 5: case 6: case 7:
#ifdef CONFIG_MIPS32_O32 #ifdef CONFIG_MIPS32_O32
if (test_thread_flag(TIF_32BIT_REGS)) if (test_thread_flag(TIF_32BIT_REGS))
return get_user(*arg, (int *)usp + 4 * n); return get_user(*arg, (int *)usp + n);
else else
#endif #endif
*arg = regs->regs[4 + n]; *arg = regs->regs[4 + n];
@ -57,6 +58,8 @@ static inline unsigned long mips_get_syscall_arg(unsigned long *arg,
default: default:
BUG(); BUG();
} }
unreachable();
} }
static inline long syscall_get_return_value(struct task_struct *task, static inline long syscall_get_return_value(struct task_struct *task,
@ -83,11 +86,10 @@ static inline void syscall_get_arguments(struct task_struct *task,
unsigned int i, unsigned int n, unsigned int i, unsigned int n,
unsigned long *args) unsigned long *args)
{ {
unsigned long arg;
int ret; int ret;
while (n--) while (n--)
ret |= mips_get_syscall_arg(&arg, task, regs, i++); ret |= mips_get_syscall_arg(args++, task, regs, i++);
/* /*
* No way to communicate an error because this is a void function. * No way to communicate an error because this is a void function.

View File

@ -163,8 +163,8 @@ enum cop1_sdw_func {
*/ */
enum cop1x_func { enum cop1x_func {
lwxc1_op = 0x00, ldxc1_op = 0x01, lwxc1_op = 0x00, ldxc1_op = 0x01,
pfetch_op = 0x07, swxc1_op = 0x08, swxc1_op = 0x08, sdxc1_op = 0x09,
sdxc1_op = 0x09, madd_s_op = 0x20, pfetch_op = 0x0f, madd_s_op = 0x20,
madd_d_op = 0x21, madd_e_op = 0x22, madd_d_op = 0x21, madd_e_op = 0x22,
msub_s_op = 0x28, msub_d_op = 0x29, msub_s_op = 0x28, msub_d_op = 0x29,
msub_e_op = 0x2a, nmadd_s_op = 0x30, msub_e_op = 0x2a, nmadd_s_op = 0x30,

View File

@ -111,11 +111,10 @@ static int ftrace_modify_code_2(unsigned long ip, unsigned int new_code1,
safe_store_code(new_code1, ip, faulted); safe_store_code(new_code1, ip, faulted);
if (unlikely(faulted)) if (unlikely(faulted))
return -EFAULT; return -EFAULT;
ip += 4; safe_store_code(new_code2, ip + 4, faulted);
safe_store_code(new_code2, ip, faulted);
if (unlikely(faulted)) if (unlikely(faulted))
return -EFAULT; return -EFAULT;
flush_icache_range(ip, ip + 8); /* original ip + 12 */ flush_icache_range(ip, ip + 8);
return 0; return 0;
} }
#endif #endif

View File

@ -35,9 +35,9 @@
LEAF(_save_fp_context) LEAF(_save_fp_context)
cfc1 t1, fcr31 cfc1 t1, fcr31
#if defined(CONFIG_64BIT) || defined(CONFIG_MIPS32_R2) #if defined(CONFIG_64BIT) || defined(CONFIG_CPU_MIPS32_R2)
.set push .set push
#ifdef CONFIG_MIPS32_R2 #ifdef CONFIG_CPU_MIPS32_R2
.set mips64r2 .set mips64r2
mfc0 t0, CP0_STATUS mfc0 t0, CP0_STATUS
sll t0, t0, 5 sll t0, t0, 5
@ -146,11 +146,11 @@ LEAF(_save_fp_context32)
* - cp1 status/control register * - cp1 status/control register
*/ */
LEAF(_restore_fp_context) LEAF(_restore_fp_context)
EX lw t0, SC_FPC_CSR(a0) EX lw t1, SC_FPC_CSR(a0)
#if defined(CONFIG_64BIT) || defined(CONFIG_MIPS32_R2) #if defined(CONFIG_64BIT) || defined(CONFIG_CPU_MIPS32_R2)
.set push .set push
#ifdef CONFIG_MIPS32_R2 #ifdef CONFIG_CPU_MIPS32_R2
.set mips64r2 .set mips64r2
mfc0 t0, CP0_STATUS mfc0 t0, CP0_STATUS
sll t0, t0, 5 sll t0, t0, 5
@ -191,7 +191,7 @@ LEAF(_restore_fp_context)
EX ldc1 $f26, SC_FPREGS+208(a0) EX ldc1 $f26, SC_FPREGS+208(a0)
EX ldc1 $f28, SC_FPREGS+224(a0) EX ldc1 $f28, SC_FPREGS+224(a0)
EX ldc1 $f30, SC_FPREGS+240(a0) EX ldc1 $f30, SC_FPREGS+240(a0)
ctc1 t0, fcr31 ctc1 t1, fcr31
jr ra jr ra
li v0, 0 # success li v0, 0 # success
END(_restore_fp_context) END(_restore_fp_context)
@ -199,7 +199,7 @@ LEAF(_restore_fp_context)
#ifdef CONFIG_MIPS32_COMPAT #ifdef CONFIG_MIPS32_COMPAT
LEAF(_restore_fp_context32) LEAF(_restore_fp_context32)
/* Restore an o32 sigcontext. */ /* Restore an o32 sigcontext. */
EX lw t0, SC32_FPC_CSR(a0) EX lw t1, SC32_FPC_CSR(a0)
mfc0 t0, CP0_STATUS mfc0 t0, CP0_STATUS
sll t0, t0, 5 sll t0, t0, 5
@ -239,7 +239,7 @@ LEAF(_restore_fp_context32)
EX ldc1 $f26, SC32_FPREGS+208(a0) EX ldc1 $f26, SC32_FPREGS+208(a0)
EX ldc1 $f28, SC32_FPREGS+224(a0) EX ldc1 $f28, SC32_FPREGS+224(a0)
EX ldc1 $f30, SC32_FPREGS+240(a0) EX ldc1 $f30, SC32_FPREGS+240(a0)
ctc1 t0, fcr31 ctc1 t1, fcr31
jr ra jr ra
li v0, 0 # success li v0, 0 # success
END(_restore_fp_context32) END(_restore_fp_context32)

View File

@ -112,5 +112,8 @@ void __exit rtlx_module_exit(void)
for (i = 0; i < RTLX_CHANNELS; i++) for (i = 0; i < RTLX_CHANNELS; i++)
device_destroy(mt_class, MKDEV(major, i)); device_destroy(mt_class, MKDEV(major, i));
unregister_chrdev(major, RTLX_MODULE_NAME); unregister_chrdev(major, RTLX_MODULE_NAME);
aprp_hook = NULL;
} }

View File

@ -144,5 +144,8 @@ void __exit rtlx_module_exit(void)
for (i = 0; i < RTLX_CHANNELS; i++) for (i = 0; i < RTLX_CHANNELS; i++)
device_destroy(mt_class, MKDEV(major, i)); device_destroy(mt_class, MKDEV(major, i));
unregister_chrdev(major, RTLX_MODULE_NAME); unregister_chrdev(major, RTLX_MODULE_NAME);
aprp_hook = NULL;
} }

View File

@ -1538,10 +1538,10 @@ static int fpux_emu(struct pt_regs *xcp, struct mips_fpu_struct *ctx,
break; break;
} }
case 0x7: /* 7 */ case 0x3:
if (MIPSInst_FUNC(ir) != pfetch_op) { if (MIPSInst_FUNC(ir) != pfetch_op)
return SIGILL; return SIGILL;
}
/* ignore prefx operation */ /* ignore prefx operation */
break; break;

View File

@ -72,7 +72,7 @@ int amon_cpu_start(int cpu,
return 0; return 0;
} }
#ifdef CONFIG_MIPS_VPE_LOADER #ifdef CONFIG_MIPS_VPE_LOADER_CMP
int vpe_run(struct vpe *v) int vpe_run(struct vpe *v)
{ {
struct vpe_notifications *n; struct vpe_notifications *n;

View File

@ -119,7 +119,7 @@ static void malta_hw0_irqdispatch(void)
do_IRQ(MALTA_INT_BASE + irq); do_IRQ(MALTA_INT_BASE + irq);
#ifdef MIPS_VPE_APSP_API #ifdef CONFIG_MIPS_VPE_APSP_API_MT
if (aprp_hook) if (aprp_hook)
aprp_hook(); aprp_hook();
#endif #endif
@ -310,7 +310,7 @@ static void ipi_call_dispatch(void)
static irqreturn_t ipi_resched_interrupt(int irq, void *dev_id) static irqreturn_t ipi_resched_interrupt(int irq, void *dev_id)
{ {
#ifdef MIPS_VPE_APSP_API #ifdef CONFIG_MIPS_VPE_APSP_API_CMP
if (aprp_hook) if (aprp_hook)
aprp_hook(); aprp_hook();
#endif #endif

View File

@ -150,6 +150,7 @@ msi_irq_allocated:
msg.address_lo = msg.address_lo =
((128ul << 20) + CVMX_PCI_MSI_RCV) & 0xffffffff; ((128ul << 20) + CVMX_PCI_MSI_RCV) & 0xffffffff;
msg.address_hi = ((128ul << 20) + CVMX_PCI_MSI_RCV) >> 32; msg.address_hi = ((128ul << 20) + CVMX_PCI_MSI_RCV) >> 32;
break;
case OCTEON_DMA_BAR_TYPE_BIG: case OCTEON_DMA_BAR_TYPE_BIG:
/* When using big bar, Bar 0 is based at 0 */ /* When using big bar, Bar 0 is based at 0 */
msg.address_lo = (0 + CVMX_PCI_MSI_RCV) & 0xffffffff; msg.address_lo = (0 + CVMX_PCI_MSI_RCV) & 0xffffffff;

View File

@ -32,17 +32,6 @@ void copy_page_asm(void *to, void *from);
void copy_user_page(void *vto, void *vfrom, unsigned long vaddr, void copy_user_page(void *vto, void *vfrom, unsigned long vaddr,
struct page *pg); struct page *pg);
/* #define CONFIG_PARISC_TMPALIAS */
#ifdef CONFIG_PARISC_TMPALIAS
void clear_user_highpage(struct page *page, unsigned long vaddr);
#define clear_user_highpage clear_user_highpage
struct vm_area_struct;
void copy_user_highpage(struct page *to, struct page *from,
unsigned long vaddr, struct vm_area_struct *vma);
#define __HAVE_ARCH_COPY_USER_HIGHPAGE
#endif
/* /*
* These are used to make use of C type-checking.. * These are used to make use of C type-checking..
*/ */

View File

@ -191,8 +191,4 @@ static __inline__ int arch_write_can_lock(arch_rwlock_t *rw)
#define arch_read_lock_flags(lock, flags) arch_read_lock(lock) #define arch_read_lock_flags(lock, flags) arch_read_lock(lock)
#define arch_write_lock_flags(lock, flags) arch_write_lock(lock) #define arch_write_lock_flags(lock, flags) arch_write_lock(lock)
#define arch_spin_relax(lock) cpu_relax()
#define arch_read_relax(lock) cpu_relax()
#define arch_write_relax(lock) cpu_relax()
#endif /* __ASM_SPINLOCK_H */ #endif /* __ASM_SPINLOCK_H */

View File

@ -828,13 +828,13 @@
#define __NR_finit_module (__NR_Linux + 333) #define __NR_finit_module (__NR_Linux + 333)
#define __NR_sched_setattr (__NR_Linux + 334) #define __NR_sched_setattr (__NR_Linux + 334)
#define __NR_sched_getattr (__NR_Linux + 335) #define __NR_sched_getattr (__NR_Linux + 335)
#define __NR_utimes (__NR_Linux + 336)
#define __NR_Linux_syscalls (__NR_sched_getattr + 1) #define __NR_Linux_syscalls (__NR_utimes + 1)
#define __IGNORE_select /* newselect */ #define __IGNORE_select /* newselect */
#define __IGNORE_fadvise64 /* fadvise64_64 */ #define __IGNORE_fadvise64 /* fadvise64_64 */
#define __IGNORE_utimes /* utime */
#define HPUX_GATEWAY_ADDR 0xC0000004 #define HPUX_GATEWAY_ADDR 0xC0000004

View File

@ -581,67 +581,3 @@ flush_cache_page(struct vm_area_struct *vma, unsigned long vmaddr, unsigned long
__flush_cache_page(vma, vmaddr, PFN_PHYS(pfn)); __flush_cache_page(vma, vmaddr, PFN_PHYS(pfn));
} }
} }
#ifdef CONFIG_PARISC_TMPALIAS
void clear_user_highpage(struct page *page, unsigned long vaddr)
{
void *vto;
unsigned long flags;
/* Clear using TMPALIAS region. The page doesn't need to
be flushed but the kernel mapping needs to be purged. */
vto = kmap_atomic(page);
/* The PA-RISC 2.0 Architecture book states on page F-6:
"Before a write-capable translation is enabled, *all*
non-equivalently-aliased translations must be removed
from the page table and purged from the TLB. (Note
that the caches are not required to be flushed at this
time.) Before any non-equivalent aliased translation
is re-enabled, the virtual address range for the writeable
page (the entire page) must be flushed from the cache,
and the write-capable translation removed from the page
table and purged from the TLB." */
purge_kernel_dcache_page_asm((unsigned long)vto);
purge_tlb_start(flags);
pdtlb_kernel(vto);
purge_tlb_end(flags);
preempt_disable();
clear_user_page_asm(vto, vaddr);
preempt_enable();
pagefault_enable(); /* kunmap_atomic(addr, KM_USER0); */
}
void copy_user_highpage(struct page *to, struct page *from,
unsigned long vaddr, struct vm_area_struct *vma)
{
void *vfrom, *vto;
unsigned long flags;
/* Copy using TMPALIAS region. This has the advantage
that the `from' page doesn't need to be flushed. However,
the `to' page must be flushed in copy_user_page_asm since
it can be used to bring in executable code. */
vfrom = kmap_atomic(from);
vto = kmap_atomic(to);
purge_kernel_dcache_page_asm((unsigned long)vto);
purge_tlb_start(flags);
pdtlb_kernel(vto);
pdtlb_kernel(vfrom);
purge_tlb_end(flags);
preempt_disable();
copy_user_page_asm(vto, vfrom, vaddr);
flush_dcache_page_asm(__pa(vto), vaddr);
preempt_enable();
pagefault_enable(); /* kunmap_atomic(addr, KM_USER1); */
pagefault_enable(); /* kunmap_atomic(addr, KM_USER0); */
}
#endif /* CONFIG_PARISC_TMPALIAS */

View File

@ -431,6 +431,7 @@
ENTRY_SAME(finit_module) ENTRY_SAME(finit_module)
ENTRY_SAME(sched_setattr) ENTRY_SAME(sched_setattr)
ENTRY_SAME(sched_getattr) /* 335 */ ENTRY_SAME(sched_getattr) /* 335 */
ENTRY_COMP(utimes)
/* Nothing yet */ /* Nothing yet */

View File

@ -1504,73 +1504,6 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_207S)
1: addi r8,r8,16 1: addi r8,r8,16
.endr .endr
/* Save DEC */
mfspr r5,SPRN_DEC
mftb r6
extsw r5,r5
add r5,r5,r6
std r5,VCPU_DEC_EXPIRES(r9)
BEGIN_FTR_SECTION
b 8f
END_FTR_SECTION_IFCLR(CPU_FTR_ARCH_207S)
/* Turn on TM so we can access TFHAR/TFIAR/TEXASR */
mfmsr r8
li r0, 1
rldimi r8, r0, MSR_TM_LG, 63-MSR_TM_LG
mtmsrd r8
/* Save POWER8-specific registers */
mfspr r5, SPRN_IAMR
mfspr r6, SPRN_PSPB
mfspr r7, SPRN_FSCR
std r5, VCPU_IAMR(r9)
stw r6, VCPU_PSPB(r9)
std r7, VCPU_FSCR(r9)
mfspr r5, SPRN_IC
mfspr r6, SPRN_VTB
mfspr r7, SPRN_TAR
std r5, VCPU_IC(r9)
std r6, VCPU_VTB(r9)
std r7, VCPU_TAR(r9)
#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
mfspr r5, SPRN_TFHAR
mfspr r6, SPRN_TFIAR
mfspr r7, SPRN_TEXASR
std r5, VCPU_TFHAR(r9)
std r6, VCPU_TFIAR(r9)
std r7, VCPU_TEXASR(r9)
#endif
mfspr r8, SPRN_EBBHR
std r8, VCPU_EBBHR(r9)
mfspr r5, SPRN_EBBRR
mfspr r6, SPRN_BESCR
mfspr r7, SPRN_CSIGR
mfspr r8, SPRN_TACR
std r5, VCPU_EBBRR(r9)
std r6, VCPU_BESCR(r9)
std r7, VCPU_CSIGR(r9)
std r8, VCPU_TACR(r9)
mfspr r5, SPRN_TCSCR
mfspr r6, SPRN_ACOP
mfspr r7, SPRN_PID
mfspr r8, SPRN_WORT
std r5, VCPU_TCSCR(r9)
std r6, VCPU_ACOP(r9)
stw r7, VCPU_GUEST_PID(r9)
std r8, VCPU_WORT(r9)
8:
/* Save and reset AMR and UAMOR before turning on the MMU */
BEGIN_FTR_SECTION
mfspr r5,SPRN_AMR
mfspr r6,SPRN_UAMOR
std r5,VCPU_AMR(r9)
std r6,VCPU_UAMOR(r9)
li r6,0
mtspr SPRN_AMR,r6
END_FTR_SECTION_IFSET(CPU_FTR_ARCH_206)
/* Unset guest mode */ /* Unset guest mode */
li r0, KVM_GUEST_MODE_NONE li r0, KVM_GUEST_MODE_NONE
stb r0, HSTATE_IN_GUEST(r13) stb r0, HSTATE_IN_GUEST(r13)
@ -2203,7 +2136,7 @@ BEGIN_FTR_SECTION
END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC) END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
#endif #endif
mfspr r6,SPRN_VRSAVE mfspr r6,SPRN_VRSAVE
stw r6,VCPU_VRSAVE(r3) stw r6,VCPU_VRSAVE(r31)
mtlr r30 mtlr r30
mtmsrd r5 mtmsrd r5
isync isync
@ -2240,7 +2173,7 @@ BEGIN_FTR_SECTION
bl .load_vr_state bl .load_vr_state
END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC) END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
#endif #endif
lwz r7,VCPU_VRSAVE(r4) lwz r7,VCPU_VRSAVE(r31)
mtspr SPRN_VRSAVE,r7 mtspr SPRN_VRSAVE,r7
mtlr r30 mtlr r30
mr r4,r31 mr r4,r31

View File

@ -58,9 +58,12 @@ void arch_cpu_idle(void)
{ {
if (tlb_type != hypervisor) { if (tlb_type != hypervisor) {
touch_nmi_watchdog(); touch_nmi_watchdog();
local_irq_enable();
} else { } else {
unsigned long pstate; unsigned long pstate;
local_irq_enable();
/* The sun4v sleeping code requires that we have PSTATE.IE cleared over /* The sun4v sleeping code requires that we have PSTATE.IE cleared over
* the cpu sleep hypervisor call. * the cpu sleep hypervisor call.
*/ */
@ -82,7 +85,6 @@ void arch_cpu_idle(void)
: "=&r" (pstate) : "=&r" (pstate)
: "i" (PSTATE_IE)); : "i" (PSTATE_IE));
} }
local_irq_enable();
} }
#ifdef CONFIG_HOTPLUG_CPU #ifdef CONFIG_HOTPLUG_CPU

View File

@ -189,7 +189,8 @@ linux_sparc_syscall32:
mov %i0, %l5 ! IEU1 mov %i0, %l5 ! IEU1
5: call %l7 ! CTI Group brk forced 5: call %l7 ! CTI Group brk forced
srl %i5, 0, %o5 ! IEU1 srl %i5, 0, %o5 ! IEU1
ba,a,pt %xcc, 3f ba,pt %xcc, 3f
sra %o0, 0, %o0
/* Linux native system calls enter here... */ /* Linux native system calls enter here... */
.align 32 .align 32
@ -217,7 +218,6 @@ linux_sparc_syscall:
3: stx %o0, [%sp + PTREGS_OFF + PT_V9_I0] 3: stx %o0, [%sp + PTREGS_OFF + PT_V9_I0]
ret_sys_call: ret_sys_call:
ldx [%sp + PTREGS_OFF + PT_V9_TSTATE], %g3 ldx [%sp + PTREGS_OFF + PT_V9_TSTATE], %g3
sra %o0, 0, %o0
mov %ulo(TSTATE_XCARRY | TSTATE_ICARRY), %g2 mov %ulo(TSTATE_XCARRY | TSTATE_ICARRY), %g2
sllx %g2, 32, %g2 sllx %g2, 32, %g2

View File

@ -273,7 +273,7 @@ void __init pgtable_cache_init(void)
prom_halt(); prom_halt();
} }
for (i = 0; i < 8; i++) { for (i = 0; i < ARRAY_SIZE(tsb_cache_names); i++) {
unsigned long size = 8192 << i; unsigned long size = 8192 << i;
const char *name = tsb_cache_names[i]; const char *name = tsb_cache_names[i];

View File

@ -445,20 +445,10 @@ static inline int pte_same(pte_t a, pte_t b)
return a.pte == b.pte; return a.pte == b.pte;
} }
static inline int pteval_present(pteval_t pteval)
{
/*
* Yes Linus, _PAGE_PROTNONE == _PAGE_NUMA. Expressing it this
* way clearly states that the intent is that protnone and numa
* hinting ptes are considered present for the purposes of
* pagetable operations like zapping, protection changes, gup etc.
*/
return pteval & (_PAGE_PRESENT | _PAGE_PROTNONE | _PAGE_NUMA);
}
static inline int pte_present(pte_t a) static inline int pte_present(pte_t a)
{ {
return pteval_present(pte_flags(a)); return pte_flags(a) & (_PAGE_PRESENT | _PAGE_PROTNONE |
_PAGE_NUMA);
} }
#define pte_accessible pte_accessible #define pte_accessible pte_accessible

View File

@ -119,9 +119,10 @@ static inline void setup_node_to_cpumask_map(void) { }
extern const struct cpumask *cpu_coregroup_mask(int cpu); extern const struct cpumask *cpu_coregroup_mask(int cpu);
#ifdef ENABLE_TOPO_DEFINES
#define topology_physical_package_id(cpu) (cpu_data(cpu).phys_proc_id) #define topology_physical_package_id(cpu) (cpu_data(cpu).phys_proc_id)
#define topology_core_id(cpu) (cpu_data(cpu).cpu_core_id) #define topology_core_id(cpu) (cpu_data(cpu).cpu_core_id)
#ifdef ENABLE_TOPO_DEFINES
#define topology_core_cpumask(cpu) (per_cpu(cpu_core_map, cpu)) #define topology_core_cpumask(cpu) (per_cpu(cpu_core_map, cpu))
#define topology_thread_cpumask(cpu) (per_cpu(cpu_sibling_map, cpu)) #define topology_thread_cpumask(cpu) (per_cpu(cpu_sibling_map, cpu))
#endif #endif

View File

@ -18,7 +18,6 @@
#include <linux/pci_ids.h> #include <linux/pci_ids.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/bitops.h> #include <linux/bitops.h>
#include <linux/ioport.h>
#include <linux/suspend.h> #include <linux/suspend.h>
#include <asm/e820.h> #include <asm/e820.h>
#include <asm/io.h> #include <asm/io.h>
@ -54,18 +53,6 @@ int fallback_aper_force __initdata;
int fix_aperture __initdata = 1; int fix_aperture __initdata = 1;
static struct resource gart_resource = {
.name = "GART",
.flags = IORESOURCE_MEM,
};
static void __init insert_aperture_resource(u32 aper_base, u32 aper_size)
{
gart_resource.start = aper_base;
gart_resource.end = aper_base + aper_size - 1;
insert_resource(&iomem_resource, &gart_resource);
}
/* This code runs before the PCI subsystem is initialized, so just /* This code runs before the PCI subsystem is initialized, so just
access the northbridge directly. */ access the northbridge directly. */
@ -96,7 +83,6 @@ static u32 __init allocate_aperture(void)
memblock_reserve(addr, aper_size); memblock_reserve(addr, aper_size);
printk(KERN_INFO "Mapping aperture over %d KB of RAM @ %lx\n", printk(KERN_INFO "Mapping aperture over %d KB of RAM @ %lx\n",
aper_size >> 10, addr); aper_size >> 10, addr);
insert_aperture_resource((u32)addr, aper_size);
register_nosave_region(addr >> PAGE_SHIFT, register_nosave_region(addr >> PAGE_SHIFT,
(addr+aper_size) >> PAGE_SHIFT); (addr+aper_size) >> PAGE_SHIFT);
@ -444,12 +430,8 @@ int __init gart_iommu_hole_init(void)
out: out:
if (!fix && !fallback_aper_force) { if (!fix && !fallback_aper_force) {
if (last_aper_base) { if (last_aper_base)
unsigned long n = (32 * 1024 * 1024) << last_aper_order;
insert_aperture_resource((u32)last_aper_base, n);
return 1; return 1;
}
return 0; return 0;
} }

View File

@ -365,7 +365,7 @@ void xen_ptep_modify_prot_commit(struct mm_struct *mm, unsigned long addr,
/* Assume pteval_t is equivalent to all the other *val_t types. */ /* Assume pteval_t is equivalent to all the other *val_t types. */
static pteval_t pte_mfn_to_pfn(pteval_t val) static pteval_t pte_mfn_to_pfn(pteval_t val)
{ {
if (pteval_present(val)) { if (val & _PAGE_PRESENT) {
unsigned long mfn = (val & PTE_PFN_MASK) >> PAGE_SHIFT; unsigned long mfn = (val & PTE_PFN_MASK) >> PAGE_SHIFT;
unsigned long pfn = mfn_to_pfn(mfn); unsigned long pfn = mfn_to_pfn(mfn);
@ -381,7 +381,7 @@ static pteval_t pte_mfn_to_pfn(pteval_t val)
static pteval_t pte_pfn_to_mfn(pteval_t val) static pteval_t pte_pfn_to_mfn(pteval_t val)
{ {
if (pteval_present(val)) { if (val & _PAGE_PRESENT) {
unsigned long pfn = (val & PTE_PFN_MASK) >> PAGE_SHIFT; unsigned long pfn = (val & PTE_PFN_MASK) >> PAGE_SHIFT;
pteval_t flags = val & PTE_FLAGS_MASK; pteval_t flags = val & PTE_FLAGS_MASK;
unsigned long mfn; unsigned long mfn;

View File

@ -693,20 +693,11 @@ blk_init_queue_node(request_fn_proc *rfn, spinlock_t *lock, int node_id)
if (!uninit_q) if (!uninit_q)
return NULL; return NULL;
uninit_q->flush_rq = kzalloc(sizeof(struct request), GFP_KERNEL);
if (!uninit_q->flush_rq)
goto out_cleanup_queue;
q = blk_init_allocated_queue(uninit_q, rfn, lock); q = blk_init_allocated_queue(uninit_q, rfn, lock);
if (!q) if (!q)
goto out_free_flush_rq; blk_cleanup_queue(uninit_q);
return q;
out_free_flush_rq: return q;
kfree(uninit_q->flush_rq);
out_cleanup_queue:
blk_cleanup_queue(uninit_q);
return NULL;
} }
EXPORT_SYMBOL(blk_init_queue_node); EXPORT_SYMBOL(blk_init_queue_node);
@ -717,9 +708,13 @@ blk_init_allocated_queue(struct request_queue *q, request_fn_proc *rfn,
if (!q) if (!q)
return NULL; return NULL;
if (blk_init_rl(&q->root_rl, q, GFP_KERNEL)) q->flush_rq = kzalloc(sizeof(struct request), GFP_KERNEL);
if (!q->flush_rq)
return NULL; return NULL;
if (blk_init_rl(&q->root_rl, q, GFP_KERNEL))
goto fail;
q->request_fn = rfn; q->request_fn = rfn;
q->prep_rq_fn = NULL; q->prep_rq_fn = NULL;
q->unprep_rq_fn = NULL; q->unprep_rq_fn = NULL;
@ -742,12 +737,16 @@ blk_init_allocated_queue(struct request_queue *q, request_fn_proc *rfn,
/* init elevator */ /* init elevator */
if (elevator_init(q, NULL)) { if (elevator_init(q, NULL)) {
mutex_unlock(&q->sysfs_lock); mutex_unlock(&q->sysfs_lock);
return NULL; goto fail;
} }
mutex_unlock(&q->sysfs_lock); mutex_unlock(&q->sysfs_lock);
return q; return q;
fail:
kfree(q->flush_rq);
return NULL;
} }
EXPORT_SYMBOL(blk_init_allocated_queue); EXPORT_SYMBOL(blk_init_allocated_queue);

View File

@ -140,14 +140,17 @@ static void mq_flush_run(struct work_struct *work)
blk_mq_insert_request(rq, false, true, false); blk_mq_insert_request(rq, false, true, false);
} }
static bool blk_flush_queue_rq(struct request *rq) static bool blk_flush_queue_rq(struct request *rq, bool add_front)
{ {
if (rq->q->mq_ops) { if (rq->q->mq_ops) {
INIT_WORK(&rq->mq_flush_work, mq_flush_run); INIT_WORK(&rq->mq_flush_work, mq_flush_run);
kblockd_schedule_work(rq->q, &rq->mq_flush_work); kblockd_schedule_work(rq->q, &rq->mq_flush_work);
return false; return false;
} else { } else {
list_add_tail(&rq->queuelist, &rq->q->queue_head); if (add_front)
list_add(&rq->queuelist, &rq->q->queue_head);
else
list_add_tail(&rq->queuelist, &rq->q->queue_head);
return true; return true;
} }
} }
@ -193,7 +196,7 @@ static bool blk_flush_complete_seq(struct request *rq, unsigned int seq,
case REQ_FSEQ_DATA: case REQ_FSEQ_DATA:
list_move_tail(&rq->flush.list, &q->flush_data_in_flight); list_move_tail(&rq->flush.list, &q->flush_data_in_flight);
queued = blk_flush_queue_rq(rq); queued = blk_flush_queue_rq(rq, true);
break; break;
case REQ_FSEQ_DONE: case REQ_FSEQ_DONE:
@ -326,7 +329,7 @@ static bool blk_kick_flush(struct request_queue *q)
q->flush_rq->rq_disk = first_rq->rq_disk; q->flush_rq->rq_disk = first_rq->rq_disk;
q->flush_rq->end_io = flush_end_io; q->flush_rq->end_io = flush_end_io;
return blk_flush_queue_rq(q->flush_rq); return blk_flush_queue_rq(q->flush_rq, false);
} }
static void flush_data_end_io(struct request *rq, int error) static void flush_data_end_io(struct request *rq, int error)

View File

@ -4498,7 +4498,7 @@ static int mtip_pci_probe(struct pci_dev *pdev,
} }
dev_info(&pdev->dev, "NUMA node %d (closest: %d,%d, probe on %d:%d)\n", dev_info(&pdev->dev, "NUMA node %d (closest: %d,%d, probe on %d:%d)\n",
my_node, pcibus_to_node(pdev->bus), dev_to_node(&pdev->dev), my_node, pcibus_to_node(pdev->bus), dev_to_node(&pdev->dev),
cpu_to_node(smp_processor_id()), smp_processor_id()); cpu_to_node(raw_smp_processor_id()), raw_smp_processor_id());
dd = kzalloc_node(sizeof(struct driver_data), GFP_KERNEL, my_node); dd = kzalloc_node(sizeof(struct driver_data), GFP_KERNEL, my_node);
if (dd == NULL) { if (dd == NULL) {

View File

@ -2109,7 +2109,6 @@ static void rbd_img_obj_callback(struct rbd_obj_request *obj_request)
rbd_assert(img_request->obj_request_count > 0); rbd_assert(img_request->obj_request_count > 0);
rbd_assert(which != BAD_WHICH); rbd_assert(which != BAD_WHICH);
rbd_assert(which < img_request->obj_request_count); rbd_assert(which < img_request->obj_request_count);
rbd_assert(which >= img_request->next_completion);
spin_lock_irq(&img_request->completion_lock); spin_lock_irq(&img_request->completion_lock);
if (which != img_request->next_completion) if (which != img_request->next_completion)

View File

@ -54,7 +54,7 @@ static inline void pit_irq_acknowledge(void)
static u64 pit_read_sched_clock(void) static u64 pit_read_sched_clock(void)
{ {
return __raw_readl(clksrc_base + PITCVAL); return ~__raw_readl(clksrc_base + PITCVAL);
} }
static int __init pit_clocksource_init(unsigned long rate) static int __init pit_clocksource_init(unsigned long rate)

View File

@ -561,7 +561,7 @@ static int i915_gem_request_info(struct seq_file *m, void *data)
{ {
struct drm_info_node *node = (struct drm_info_node *) m->private; struct drm_info_node *node = (struct drm_info_node *) m->private;
struct drm_device *dev = node->minor->dev; struct drm_device *dev = node->minor->dev;
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct intel_ring_buffer *ring; struct intel_ring_buffer *ring;
struct drm_i915_gem_request *gem_request; struct drm_i915_gem_request *gem_request;
int ret, count, i; int ret, count, i;
@ -606,7 +606,7 @@ static int i915_gem_seqno_info(struct seq_file *m, void *data)
{ {
struct drm_info_node *node = (struct drm_info_node *) m->private; struct drm_info_node *node = (struct drm_info_node *) m->private;
struct drm_device *dev = node->minor->dev; struct drm_device *dev = node->minor->dev;
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct intel_ring_buffer *ring; struct intel_ring_buffer *ring;
int ret, i; int ret, i;
@ -629,7 +629,7 @@ static int i915_interrupt_info(struct seq_file *m, void *data)
{ {
struct drm_info_node *node = (struct drm_info_node *) m->private; struct drm_info_node *node = (struct drm_info_node *) m->private;
struct drm_device *dev = node->minor->dev; struct drm_device *dev = node->minor->dev;
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct intel_ring_buffer *ring; struct intel_ring_buffer *ring;
int ret, i, pipe; int ret, i, pipe;
@ -770,7 +770,7 @@ static int i915_gem_fence_regs_info(struct seq_file *m, void *data)
{ {
struct drm_info_node *node = (struct drm_info_node *) m->private; struct drm_info_node *node = (struct drm_info_node *) m->private;
struct drm_device *dev = node->minor->dev; struct drm_device *dev = node->minor->dev;
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
int i, ret; int i, ret;
ret = mutex_lock_interruptible(&dev->struct_mutex); ret = mutex_lock_interruptible(&dev->struct_mutex);
@ -799,7 +799,7 @@ static int i915_hws_info(struct seq_file *m, void *data)
{ {
struct drm_info_node *node = (struct drm_info_node *) m->private; struct drm_info_node *node = (struct drm_info_node *) m->private;
struct drm_device *dev = node->minor->dev; struct drm_device *dev = node->minor->dev;
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct intel_ring_buffer *ring; struct intel_ring_buffer *ring;
const u32 *hws; const u32 *hws;
int i; int i;
@ -910,7 +910,7 @@ static int
i915_next_seqno_get(void *data, u64 *val) i915_next_seqno_get(void *data, u64 *val)
{ {
struct drm_device *dev = data; struct drm_device *dev = data;
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
int ret; int ret;
ret = mutex_lock_interruptible(&dev->struct_mutex); ret = mutex_lock_interruptible(&dev->struct_mutex);
@ -947,7 +947,7 @@ static int i915_rstdby_delays(struct seq_file *m, void *unused)
{ {
struct drm_info_node *node = (struct drm_info_node *) m->private; struct drm_info_node *node = (struct drm_info_node *) m->private;
struct drm_device *dev = node->minor->dev; struct drm_device *dev = node->minor->dev;
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
u16 crstanddelay; u16 crstanddelay;
int ret; int ret;
@ -970,7 +970,7 @@ static int i915_cur_delayinfo(struct seq_file *m, void *unused)
{ {
struct drm_info_node *node = (struct drm_info_node *) m->private; struct drm_info_node *node = (struct drm_info_node *) m->private;
struct drm_device *dev = node->minor->dev; struct drm_device *dev = node->minor->dev;
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
int ret = 0; int ret = 0;
intel_runtime_pm_get(dev_priv); intel_runtime_pm_get(dev_priv);
@ -1096,7 +1096,7 @@ static int i915_delayfreq_table(struct seq_file *m, void *unused)
{ {
struct drm_info_node *node = (struct drm_info_node *) m->private; struct drm_info_node *node = (struct drm_info_node *) m->private;
struct drm_device *dev = node->minor->dev; struct drm_device *dev = node->minor->dev;
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
u32 delayfreq; u32 delayfreq;
int ret, i; int ret, i;
@ -1127,7 +1127,7 @@ static int i915_inttoext_table(struct seq_file *m, void *unused)
{ {
struct drm_info_node *node = (struct drm_info_node *) m->private; struct drm_info_node *node = (struct drm_info_node *) m->private;
struct drm_device *dev = node->minor->dev; struct drm_device *dev = node->minor->dev;
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
u32 inttoext; u32 inttoext;
int ret, i; int ret, i;
@ -1151,7 +1151,7 @@ static int ironlake_drpc_info(struct seq_file *m)
{ {
struct drm_info_node *node = (struct drm_info_node *) m->private; struct drm_info_node *node = (struct drm_info_node *) m->private;
struct drm_device *dev = node->minor->dev; struct drm_device *dev = node->minor->dev;
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
u32 rgvmodectl, rstdbyctl; u32 rgvmodectl, rstdbyctl;
u16 crstandvid; u16 crstandvid;
int ret; int ret;
@ -1377,7 +1377,7 @@ static int i915_fbc_status(struct seq_file *m, void *unused)
{ {
struct drm_info_node *node = (struct drm_info_node *) m->private; struct drm_info_node *node = (struct drm_info_node *) m->private;
struct drm_device *dev = node->minor->dev; struct drm_device *dev = node->minor->dev;
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
if (!HAS_FBC(dev)) { if (!HAS_FBC(dev)) {
seq_puts(m, "FBC unsupported on this chipset\n"); seq_puts(m, "FBC unsupported on this chipset\n");
@ -1462,7 +1462,7 @@ static int i915_sr_status(struct seq_file *m, void *unused)
{ {
struct drm_info_node *node = (struct drm_info_node *) m->private; struct drm_info_node *node = (struct drm_info_node *) m->private;
struct drm_device *dev = node->minor->dev; struct drm_device *dev = node->minor->dev;
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
bool sr_enabled = false; bool sr_enabled = false;
intel_runtime_pm_get(dev_priv); intel_runtime_pm_get(dev_priv);
@ -1488,7 +1488,7 @@ static int i915_emon_status(struct seq_file *m, void *unused)
{ {
struct drm_info_node *node = (struct drm_info_node *) m->private; struct drm_info_node *node = (struct drm_info_node *) m->private;
struct drm_device *dev = node->minor->dev; struct drm_device *dev = node->minor->dev;
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
unsigned long temp, chipset, gfx; unsigned long temp, chipset, gfx;
int ret; int ret;
@ -1516,7 +1516,7 @@ static int i915_ring_freq_table(struct seq_file *m, void *unused)
{ {
struct drm_info_node *node = (struct drm_info_node *) m->private; struct drm_info_node *node = (struct drm_info_node *) m->private;
struct drm_device *dev = node->minor->dev; struct drm_device *dev = node->minor->dev;
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
int ret = 0; int ret = 0;
int gpu_freq, ia_freq; int gpu_freq, ia_freq;
@ -1559,7 +1559,7 @@ static int i915_gfxec(struct seq_file *m, void *unused)
{ {
struct drm_info_node *node = (struct drm_info_node *) m->private; struct drm_info_node *node = (struct drm_info_node *) m->private;
struct drm_device *dev = node->minor->dev; struct drm_device *dev = node->minor->dev;
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
int ret; int ret;
ret = mutex_lock_interruptible(&dev->struct_mutex); ret = mutex_lock_interruptible(&dev->struct_mutex);
@ -1579,7 +1579,7 @@ static int i915_opregion(struct seq_file *m, void *unused)
{ {
struct drm_info_node *node = (struct drm_info_node *) m->private; struct drm_info_node *node = (struct drm_info_node *) m->private;
struct drm_device *dev = node->minor->dev; struct drm_device *dev = node->minor->dev;
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct intel_opregion *opregion = &dev_priv->opregion; struct intel_opregion *opregion = &dev_priv->opregion;
void *data = kmalloc(OPREGION_SIZE, GFP_KERNEL); void *data = kmalloc(OPREGION_SIZE, GFP_KERNEL);
int ret; int ret;
@ -1653,7 +1653,7 @@ static int i915_context_status(struct seq_file *m, void *unused)
{ {
struct drm_info_node *node = (struct drm_info_node *) m->private; struct drm_info_node *node = (struct drm_info_node *) m->private;
struct drm_device *dev = node->minor->dev; struct drm_device *dev = node->minor->dev;
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct intel_ring_buffer *ring; struct intel_ring_buffer *ring;
struct i915_hw_context *ctx; struct i915_hw_context *ctx;
int ret, i; int ret, i;
@ -2319,9 +2319,11 @@ static int i915_display_info(struct seq_file *m, void *unused)
{ {
struct drm_info_node *node = (struct drm_info_node *) m->private; struct drm_info_node *node = (struct drm_info_node *) m->private;
struct drm_device *dev = node->minor->dev; struct drm_device *dev = node->minor->dev;
struct drm_i915_private *dev_priv = dev->dev_private;
struct intel_crtc *crtc; struct intel_crtc *crtc;
struct drm_connector *connector; struct drm_connector *connector;
intel_runtime_pm_get(dev_priv);
drm_modeset_lock_all(dev); drm_modeset_lock_all(dev);
seq_printf(m, "CRTC info\n"); seq_printf(m, "CRTC info\n");
seq_printf(m, "---------\n"); seq_printf(m, "---------\n");
@ -2332,14 +2334,15 @@ static int i915_display_info(struct seq_file *m, void *unused)
seq_printf(m, "CRTC %d: pipe: %c, active: %s\n", seq_printf(m, "CRTC %d: pipe: %c, active: %s\n",
crtc->base.base.id, pipe_name(crtc->pipe), crtc->base.base.id, pipe_name(crtc->pipe),
yesno(crtc->active)); yesno(crtc->active));
if (crtc->active) if (crtc->active) {
intel_crtc_info(m, crtc); intel_crtc_info(m, crtc);
active = cursor_position(dev, crtc->pipe, &x, &y); active = cursor_position(dev, crtc->pipe, &x, &y);
seq_printf(m, "\tcursor visible? %s, position (%d, %d), addr 0x%08x, active? %s\n", seq_printf(m, "\tcursor visible? %s, position (%d, %d), addr 0x%08x, active? %s\n",
yesno(crtc->cursor_visible), yesno(crtc->cursor_visible),
x, y, crtc->cursor_addr, x, y, crtc->cursor_addr,
yesno(active)); yesno(active));
}
} }
seq_printf(m, "\n"); seq_printf(m, "\n");
@ -2349,6 +2352,7 @@ static int i915_display_info(struct seq_file *m, void *unused)
intel_connector_info(m, connector); intel_connector_info(m, connector);
} }
drm_modeset_unlock_all(dev); drm_modeset_unlock_all(dev);
intel_runtime_pm_put(dev_priv);
return 0; return 0;
} }
@ -3271,7 +3275,7 @@ static int
i915_wedged_get(void *data, u64 *val) i915_wedged_get(void *data, u64 *val)
{ {
struct drm_device *dev = data; struct drm_device *dev = data;
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
*val = atomic_read(&dev_priv->gpu_error.reset_counter); *val = atomic_read(&dev_priv->gpu_error.reset_counter);
@ -3296,7 +3300,7 @@ static int
i915_ring_stop_get(void *data, u64 *val) i915_ring_stop_get(void *data, u64 *val)
{ {
struct drm_device *dev = data; struct drm_device *dev = data;
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
*val = dev_priv->gpu_error.stop_rings; *val = dev_priv->gpu_error.stop_rings;
@ -3473,7 +3477,7 @@ static int
i915_max_freq_get(void *data, u64 *val) i915_max_freq_get(void *data, u64 *val)
{ {
struct drm_device *dev = data; struct drm_device *dev = data;
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
int ret; int ret;
if (!(IS_GEN6(dev) || IS_GEN7(dev))) if (!(IS_GEN6(dev) || IS_GEN7(dev)))
@ -3554,7 +3558,7 @@ static int
i915_min_freq_get(void *data, u64 *val) i915_min_freq_get(void *data, u64 *val)
{ {
struct drm_device *dev = data; struct drm_device *dev = data;
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
int ret; int ret;
if (!(IS_GEN6(dev) || IS_GEN7(dev))) if (!(IS_GEN6(dev) || IS_GEN7(dev)))
@ -3635,7 +3639,7 @@ static int
i915_cache_sharing_get(void *data, u64 *val) i915_cache_sharing_get(void *data, u64 *val)
{ {
struct drm_device *dev = data; struct drm_device *dev = data;
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
u32 snpcr; u32 snpcr;
int ret; int ret;
@ -3695,7 +3699,6 @@ static int i915_forcewake_open(struct inode *inode, struct file *file)
if (INTEL_INFO(dev)->gen < 6) if (INTEL_INFO(dev)->gen < 6)
return 0; return 0;
intel_runtime_pm_get(dev_priv);
gen6_gt_force_wake_get(dev_priv, FORCEWAKE_ALL); gen6_gt_force_wake_get(dev_priv, FORCEWAKE_ALL);
return 0; return 0;
@ -3710,7 +3713,6 @@ static int i915_forcewake_release(struct inode *inode, struct file *file)
return 0; return 0;
gen6_gt_force_wake_put(dev_priv, FORCEWAKE_ALL); gen6_gt_force_wake_put(dev_priv, FORCEWAKE_ALL);
intel_runtime_pm_put(dev_priv);
return 0; return 0;
} }

View File

@ -82,7 +82,7 @@ intel_read_legacy_status_page(struct drm_i915_private *dev_priv, int reg)
void i915_update_dri1_breadcrumb(struct drm_device *dev) void i915_update_dri1_breadcrumb(struct drm_device *dev)
{ {
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct drm_i915_master_private *master_priv; struct drm_i915_master_private *master_priv;
/* /*
@ -103,7 +103,7 @@ void i915_update_dri1_breadcrumb(struct drm_device *dev)
static void i915_write_hws_pga(struct drm_device *dev) static void i915_write_hws_pga(struct drm_device *dev)
{ {
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
u32 addr; u32 addr;
addr = dev_priv->status_page_dmah->busaddr; addr = dev_priv->status_page_dmah->busaddr;
@ -118,7 +118,7 @@ static void i915_write_hws_pga(struct drm_device *dev)
*/ */
static void i915_free_hws(struct drm_device *dev) static void i915_free_hws(struct drm_device *dev)
{ {
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct intel_ring_buffer *ring = LP_RING(dev_priv); struct intel_ring_buffer *ring = LP_RING(dev_priv);
if (dev_priv->status_page_dmah) { if (dev_priv->status_page_dmah) {
@ -137,7 +137,7 @@ static void i915_free_hws(struct drm_device *dev)
void i915_kernel_lost_context(struct drm_device * dev) void i915_kernel_lost_context(struct drm_device * dev)
{ {
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct drm_i915_master_private *master_priv; struct drm_i915_master_private *master_priv;
struct intel_ring_buffer *ring = LP_RING(dev_priv); struct intel_ring_buffer *ring = LP_RING(dev_priv);
@ -164,7 +164,7 @@ void i915_kernel_lost_context(struct drm_device * dev)
static int i915_dma_cleanup(struct drm_device * dev) static int i915_dma_cleanup(struct drm_device * dev)
{ {
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
int i; int i;
/* Make sure interrupts are disabled here because the uninstall ioctl /* Make sure interrupts are disabled here because the uninstall ioctl
@ -188,7 +188,7 @@ static int i915_dma_cleanup(struct drm_device * dev)
static int i915_initialize(struct drm_device * dev, drm_i915_init_t * init) static int i915_initialize(struct drm_device * dev, drm_i915_init_t * init)
{ {
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct drm_i915_master_private *master_priv = dev->primary->master->driver_priv; struct drm_i915_master_private *master_priv = dev->primary->master->driver_priv;
int ret; int ret;
@ -233,7 +233,7 @@ static int i915_initialize(struct drm_device * dev, drm_i915_init_t * init)
static int i915_dma_resume(struct drm_device * dev) static int i915_dma_resume(struct drm_device * dev)
{ {
drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct intel_ring_buffer *ring = LP_RING(dev_priv); struct intel_ring_buffer *ring = LP_RING(dev_priv);
DRM_DEBUG_DRIVER("%s\n", __func__); DRM_DEBUG_DRIVER("%s\n", __func__);
@ -357,7 +357,7 @@ static int validate_cmd(int cmd)
static int i915_emit_cmds(struct drm_device * dev, int *buffer, int dwords) static int i915_emit_cmds(struct drm_device * dev, int *buffer, int dwords)
{ {
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
int i, ret; int i, ret;
if ((dwords+1) * sizeof(int) >= LP_RING(dev_priv)->size - 8) if ((dwords+1) * sizeof(int) >= LP_RING(dev_priv)->size - 8)
@ -431,7 +431,7 @@ i915_emit_box(struct drm_device *dev,
static void i915_emit_breadcrumb(struct drm_device *dev) static void i915_emit_breadcrumb(struct drm_device *dev)
{ {
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct drm_i915_master_private *master_priv = dev->primary->master->driver_priv; struct drm_i915_master_private *master_priv = dev->primary->master->driver_priv;
dev_priv->dri1.counter++; dev_priv->dri1.counter++;
@ -547,7 +547,7 @@ static int i915_dispatch_batchbuffer(struct drm_device * dev,
static int i915_dispatch_flip(struct drm_device * dev) static int i915_dispatch_flip(struct drm_device * dev)
{ {
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct drm_i915_master_private *master_priv = struct drm_i915_master_private *master_priv =
dev->primary->master->driver_priv; dev->primary->master->driver_priv;
int ret; int ret;
@ -625,7 +625,7 @@ static int i915_flush_ioctl(struct drm_device *dev, void *data,
static int i915_batchbuffer(struct drm_device *dev, void *data, static int i915_batchbuffer(struct drm_device *dev, void *data,
struct drm_file *file_priv) struct drm_file *file_priv)
{ {
drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct drm_i915_master_private *master_priv; struct drm_i915_master_private *master_priv;
drm_i915_sarea_t *sarea_priv; drm_i915_sarea_t *sarea_priv;
drm_i915_batchbuffer_t *batch = data; drm_i915_batchbuffer_t *batch = data;
@ -683,7 +683,7 @@ fail_free:
static int i915_cmdbuffer(struct drm_device *dev, void *data, static int i915_cmdbuffer(struct drm_device *dev, void *data,
struct drm_file *file_priv) struct drm_file *file_priv)
{ {
drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct drm_i915_master_private *master_priv; struct drm_i915_master_private *master_priv;
drm_i915_sarea_t *sarea_priv; drm_i915_sarea_t *sarea_priv;
drm_i915_cmdbuffer_t *cmdbuf = data; drm_i915_cmdbuffer_t *cmdbuf = data;
@ -753,7 +753,7 @@ fail_batch_free:
static int i915_emit_irq(struct drm_device * dev) static int i915_emit_irq(struct drm_device * dev)
{ {
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct drm_i915_master_private *master_priv = dev->primary->master->driver_priv; struct drm_i915_master_private *master_priv = dev->primary->master->driver_priv;
i915_kernel_lost_context(dev); i915_kernel_lost_context(dev);
@ -779,7 +779,7 @@ static int i915_emit_irq(struct drm_device * dev)
static int i915_wait_irq(struct drm_device * dev, int irq_nr) static int i915_wait_irq(struct drm_device * dev, int irq_nr)
{ {
drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct drm_i915_master_private *master_priv = dev->primary->master->driver_priv; struct drm_i915_master_private *master_priv = dev->primary->master->driver_priv;
int ret = 0; int ret = 0;
struct intel_ring_buffer *ring = LP_RING(dev_priv); struct intel_ring_buffer *ring = LP_RING(dev_priv);
@ -816,7 +816,7 @@ static int i915_wait_irq(struct drm_device * dev, int irq_nr)
static int i915_irq_emit(struct drm_device *dev, void *data, static int i915_irq_emit(struct drm_device *dev, void *data,
struct drm_file *file_priv) struct drm_file *file_priv)
{ {
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
drm_i915_irq_emit_t *emit = data; drm_i915_irq_emit_t *emit = data;
int result; int result;
@ -847,7 +847,7 @@ static int i915_irq_emit(struct drm_device *dev, void *data,
static int i915_irq_wait(struct drm_device *dev, void *data, static int i915_irq_wait(struct drm_device *dev, void *data,
struct drm_file *file_priv) struct drm_file *file_priv)
{ {
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
drm_i915_irq_wait_t *irqwait = data; drm_i915_irq_wait_t *irqwait = data;
if (drm_core_check_feature(dev, DRIVER_MODESET)) if (drm_core_check_feature(dev, DRIVER_MODESET))
@ -864,7 +864,7 @@ static int i915_irq_wait(struct drm_device *dev, void *data,
static int i915_vblank_pipe_get(struct drm_device *dev, void *data, static int i915_vblank_pipe_get(struct drm_device *dev, void *data,
struct drm_file *file_priv) struct drm_file *file_priv)
{ {
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
drm_i915_vblank_pipe_t *pipe = data; drm_i915_vblank_pipe_t *pipe = data;
if (drm_core_check_feature(dev, DRIVER_MODESET)) if (drm_core_check_feature(dev, DRIVER_MODESET))
@ -925,7 +925,7 @@ static int i915_flip_bufs(struct drm_device *dev, void *data,
static int i915_getparam(struct drm_device *dev, void *data, static int i915_getparam(struct drm_device *dev, void *data,
struct drm_file *file_priv) struct drm_file *file_priv)
{ {
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
drm_i915_getparam_t *param = data; drm_i915_getparam_t *param = data;
int value; int value;
@ -1033,7 +1033,7 @@ static int i915_getparam(struct drm_device *dev, void *data,
static int i915_setparam(struct drm_device *dev, void *data, static int i915_setparam(struct drm_device *dev, void *data,
struct drm_file *file_priv) struct drm_file *file_priv)
{ {
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
drm_i915_setparam_t *param = data; drm_i915_setparam_t *param = data;
if (!dev_priv) { if (!dev_priv) {
@ -1068,7 +1068,7 @@ static int i915_setparam(struct drm_device *dev, void *data,
static int i915_set_status_page(struct drm_device *dev, void *data, static int i915_set_status_page(struct drm_device *dev, void *data,
struct drm_file *file_priv) struct drm_file *file_priv)
{ {
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
drm_i915_hws_addr_t *hws = data; drm_i915_hws_addr_t *hws = data;
struct intel_ring_buffer *ring; struct intel_ring_buffer *ring;
@ -1136,7 +1136,7 @@ static int i915_get_bridge_dev(struct drm_device *dev)
static int static int
intel_alloc_mchbar_resource(struct drm_device *dev) intel_alloc_mchbar_resource(struct drm_device *dev)
{ {
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
int reg = INTEL_INFO(dev)->gen >= 4 ? MCHBAR_I965 : MCHBAR_I915; int reg = INTEL_INFO(dev)->gen >= 4 ? MCHBAR_I965 : MCHBAR_I915;
u32 temp_lo, temp_hi = 0; u32 temp_lo, temp_hi = 0;
u64 mchbar_addr; u64 mchbar_addr;
@ -1182,7 +1182,7 @@ intel_alloc_mchbar_resource(struct drm_device *dev)
static void static void
intel_setup_mchbar(struct drm_device *dev) intel_setup_mchbar(struct drm_device *dev)
{ {
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
int mchbar_reg = INTEL_INFO(dev)->gen >= 4 ? MCHBAR_I965 : MCHBAR_I915; int mchbar_reg = INTEL_INFO(dev)->gen >= 4 ? MCHBAR_I965 : MCHBAR_I915;
u32 temp; u32 temp;
bool enabled; bool enabled;
@ -1222,7 +1222,7 @@ intel_setup_mchbar(struct drm_device *dev)
static void static void
intel_teardown_mchbar(struct drm_device *dev) intel_teardown_mchbar(struct drm_device *dev)
{ {
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
int mchbar_reg = INTEL_INFO(dev)->gen >= 4 ? MCHBAR_I965 : MCHBAR_I915; int mchbar_reg = INTEL_INFO(dev)->gen >= 4 ? MCHBAR_I965 : MCHBAR_I915;
u32 temp; u32 temp;
@ -1895,7 +1895,7 @@ int i915_driver_open(struct drm_device *dev, struct drm_file *file)
*/ */
void i915_driver_lastclose(struct drm_device * dev) void i915_driver_lastclose(struct drm_device * dev)
{ {
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
/* On gen6+ we refuse to init without kms enabled, but then the drm core /* On gen6+ we refuse to init without kms enabled, but then the drm core
* goes right around and calls lastclose. Check for this and don't clean * goes right around and calls lastclose. Check for this and don't clean

View File

@ -537,15 +537,22 @@ static void intel_resume_hotplug(struct drm_device *dev)
drm_helper_hpd_irq_event(dev); drm_helper_hpd_irq_event(dev);
} }
static int i915_drm_thaw_early(struct drm_device *dev)
{
struct drm_i915_private *dev_priv = dev->dev_private;
intel_uncore_early_sanitize(dev);
intel_uncore_sanitize(dev);
intel_power_domains_init_hw(dev_priv);
return 0;
}
static int __i915_drm_thaw(struct drm_device *dev, bool restore_gtt_mappings) static int __i915_drm_thaw(struct drm_device *dev, bool restore_gtt_mappings)
{ {
struct drm_i915_private *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
int error = 0; int error = 0;
intel_uncore_early_sanitize(dev);
intel_uncore_sanitize(dev);
if (drm_core_check_feature(dev, DRIVER_MODESET) && if (drm_core_check_feature(dev, DRIVER_MODESET) &&
restore_gtt_mappings) { restore_gtt_mappings) {
mutex_lock(&dev->struct_mutex); mutex_lock(&dev->struct_mutex);
@ -553,8 +560,6 @@ static int __i915_drm_thaw(struct drm_device *dev, bool restore_gtt_mappings)
mutex_unlock(&dev->struct_mutex); mutex_unlock(&dev->struct_mutex);
} }
intel_power_domains_init_hw(dev_priv);
i915_restore_state(dev); i915_restore_state(dev);
intel_opregion_setup(dev); intel_opregion_setup(dev);
@ -619,19 +624,33 @@ static int i915_drm_thaw(struct drm_device *dev)
return __i915_drm_thaw(dev, true); return __i915_drm_thaw(dev, true);
} }
int i915_resume(struct drm_device *dev) static int i915_resume_early(struct drm_device *dev)
{ {
struct drm_i915_private *dev_priv = dev->dev_private;
int ret;
if (dev->switch_power_state == DRM_SWITCH_POWER_OFF) if (dev->switch_power_state == DRM_SWITCH_POWER_OFF)
return 0; return 0;
/*
* We have a resume ordering issue with the snd-hda driver also
* requiring our device to be power up. Due to the lack of a
* parent/child relationship we currently solve this with an early
* resume hook.
*
* FIXME: This should be solved with a special hdmi sink device or
* similar so that power domains can be employed.
*/
if (pci_enable_device(dev->pdev)) if (pci_enable_device(dev->pdev))
return -EIO; return -EIO;
pci_set_master(dev->pdev); pci_set_master(dev->pdev);
return i915_drm_thaw_early(dev);
}
int i915_resume(struct drm_device *dev)
{
struct drm_i915_private *dev_priv = dev->dev_private;
int ret;
/* /*
* Platforms with opregion should have sane BIOS, older ones (gen3 and * Platforms with opregion should have sane BIOS, older ones (gen3 and
* earlier) need to restore the GTT mappings since the BIOS might clear * earlier) need to restore the GTT mappings since the BIOS might clear
@ -645,6 +664,14 @@ int i915_resume(struct drm_device *dev)
return 0; return 0;
} }
static int i915_resume_legacy(struct drm_device *dev)
{
i915_resume_early(dev);
i915_resume(dev);
return 0;
}
/** /**
* i915_reset - reset chip after a hang * i915_reset - reset chip after a hang
* @dev: drm device to reset * @dev: drm device to reset
@ -662,7 +689,7 @@ int i915_resume(struct drm_device *dev)
*/ */
int i915_reset(struct drm_device *dev) int i915_reset(struct drm_device *dev)
{ {
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
bool simulated; bool simulated;
int ret; int ret;
@ -776,7 +803,6 @@ static int i915_pm_suspend(struct device *dev)
{ {
struct pci_dev *pdev = to_pci_dev(dev); struct pci_dev *pdev = to_pci_dev(dev);
struct drm_device *drm_dev = pci_get_drvdata(pdev); struct drm_device *drm_dev = pci_get_drvdata(pdev);
int error;
if (!drm_dev || !drm_dev->dev_private) { if (!drm_dev || !drm_dev->dev_private) {
dev_err(dev, "DRM not initialized, aborting suspend.\n"); dev_err(dev, "DRM not initialized, aborting suspend.\n");
@ -786,9 +812,25 @@ static int i915_pm_suspend(struct device *dev)
if (drm_dev->switch_power_state == DRM_SWITCH_POWER_OFF) if (drm_dev->switch_power_state == DRM_SWITCH_POWER_OFF)
return 0; return 0;
error = i915_drm_freeze(drm_dev); return i915_drm_freeze(drm_dev);
if (error) }
return error;
static int i915_pm_suspend_late(struct device *dev)
{
struct pci_dev *pdev = to_pci_dev(dev);
struct drm_device *drm_dev = pci_get_drvdata(pdev);
/*
* We have a suspedn ordering issue with the snd-hda driver also
* requiring our device to be power up. Due to the lack of a
* parent/child relationship we currently solve this with an late
* suspend hook.
*
* FIXME: This should be solved with a special hdmi sink device or
* similar so that power domains can be employed.
*/
if (drm_dev->switch_power_state == DRM_SWITCH_POWER_OFF)
return 0;
pci_disable_device(pdev); pci_disable_device(pdev);
pci_set_power_state(pdev, PCI_D3hot); pci_set_power_state(pdev, PCI_D3hot);
@ -796,6 +838,14 @@ static int i915_pm_suspend(struct device *dev)
return 0; return 0;
} }
static int i915_pm_resume_early(struct device *dev)
{
struct pci_dev *pdev = to_pci_dev(dev);
struct drm_device *drm_dev = pci_get_drvdata(pdev);
return i915_resume_early(drm_dev);
}
static int i915_pm_resume(struct device *dev) static int i915_pm_resume(struct device *dev)
{ {
struct pci_dev *pdev = to_pci_dev(dev); struct pci_dev *pdev = to_pci_dev(dev);
@ -817,6 +867,14 @@ static int i915_pm_freeze(struct device *dev)
return i915_drm_freeze(drm_dev); return i915_drm_freeze(drm_dev);
} }
static int i915_pm_thaw_early(struct device *dev)
{
struct pci_dev *pdev = to_pci_dev(dev);
struct drm_device *drm_dev = pci_get_drvdata(pdev);
return i915_drm_thaw_early(drm_dev);
}
static int i915_pm_thaw(struct device *dev) static int i915_pm_thaw(struct device *dev)
{ {
struct pci_dev *pdev = to_pci_dev(dev); struct pci_dev *pdev = to_pci_dev(dev);
@ -887,10 +945,14 @@ static int i915_runtime_resume(struct device *device)
static const struct dev_pm_ops i915_pm_ops = { static const struct dev_pm_ops i915_pm_ops = {
.suspend = i915_pm_suspend, .suspend = i915_pm_suspend,
.suspend_late = i915_pm_suspend_late,
.resume_early = i915_pm_resume_early,
.resume = i915_pm_resume, .resume = i915_pm_resume,
.freeze = i915_pm_freeze, .freeze = i915_pm_freeze,
.thaw_early = i915_pm_thaw_early,
.thaw = i915_pm_thaw, .thaw = i915_pm_thaw,
.poweroff = i915_pm_poweroff, .poweroff = i915_pm_poweroff,
.restore_early = i915_pm_resume_early,
.restore = i915_pm_resume, .restore = i915_pm_resume,
.runtime_suspend = i915_runtime_suspend, .runtime_suspend = i915_runtime_suspend,
.runtime_resume = i915_runtime_resume, .runtime_resume = i915_runtime_resume,
@ -933,7 +995,7 @@ static struct drm_driver driver = {
/* Used in place of i915_pm_ops for non-DRIVER_MODESET */ /* Used in place of i915_pm_ops for non-DRIVER_MODESET */
.suspend = i915_suspend, .suspend = i915_suspend,
.resume = i915_resume, .resume = i915_resume_legacy,
.device_is_agp = i915_driver_device_is_agp, .device_is_agp = i915_driver_device_is_agp,
.master_create = i915_master_create, .master_create = i915_master_create,

View File

@ -351,12 +351,12 @@ struct drm_i915_error_state {
u32 ipeir; u32 ipeir;
u32 ipehr; u32 ipehr;
u32 instdone; u32 instdone;
u32 acthd;
u32 bbstate; u32 bbstate;
u32 instpm; u32 instpm;
u32 instps; u32 instps;
u32 seqno; u32 seqno;
u64 bbaddr; u64 bbaddr;
u64 acthd;
u32 fault_reg; u32 fault_reg;
u32 faddr; u32 faddr;
u32 rc_psmi; /* sleep state */ u32 rc_psmi; /* sleep state */
@ -1001,9 +1001,6 @@ struct intel_gen6_power_mgmt {
u8 rp1_freq; /* "less than" RP0 power/freqency */ u8 rp1_freq; /* "less than" RP0 power/freqency */
u8 rp0_freq; /* Non-overclocked max frequency. */ u8 rp0_freq; /* Non-overclocked max frequency. */
bool rp_up_masked;
bool rp_down_masked;
int last_adj; int last_adj;
enum { LOW_POWER, BETWEEN, HIGH_POWER } power; enum { LOW_POWER, BETWEEN, HIGH_POWER } power;
@ -1468,6 +1465,7 @@ typedef struct drm_i915_private {
}; };
u32 gt_irq_mask; u32 gt_irq_mask;
u32 pm_irq_mask; u32 pm_irq_mask;
u32 pm_rps_events;
u32 pipestat_irq_mask[I915_MAX_PIPES]; u32 pipestat_irq_mask[I915_MAX_PIPES];
struct work_struct hotplug_work; struct work_struct hotplug_work;
@ -2130,11 +2128,11 @@ extern void intel_uncore_check_errors(struct drm_device *dev);
extern void intel_uncore_fini(struct drm_device *dev); extern void intel_uncore_fini(struct drm_device *dev);
void void
i915_enable_pipestat(drm_i915_private_t *dev_priv, enum pipe pipe, i915_enable_pipestat(struct drm_i915_private *dev_priv, enum pipe pipe,
u32 status_mask); u32 status_mask);
void void
i915_disable_pipestat(drm_i915_private_t *dev_priv, enum pipe pipe, i915_disable_pipestat(struct drm_i915_private *dev_priv, enum pipe pipe,
u32 status_mask); u32 status_mask);
void valleyview_enable_display_irqs(struct drm_i915_private *dev_priv); void valleyview_enable_display_irqs(struct drm_i915_private *dev_priv);
@ -2504,7 +2502,7 @@ void i915_gem_object_release_stolen(struct drm_i915_gem_object *obj);
/* i915_gem_tiling.c */ /* i915_gem_tiling.c */
static inline bool i915_gem_object_needs_bit17_swizzle(struct drm_i915_gem_object *obj) static inline bool i915_gem_object_needs_bit17_swizzle(struct drm_i915_gem_object *obj)
{ {
drm_i915_private_t *dev_priv = obj->base.dev->dev_private; struct drm_i915_private *dev_priv = obj->base.dev->dev_private;
return dev_priv->mm.bit_6_swizzle_x == I915_BIT_6_SWIZZLE_9_10_17 && return dev_priv->mm.bit_6_swizzle_x == I915_BIT_6_SWIZZLE_9_10_17 &&
obj->tiling_mode != I915_TILING_NONE; obj->tiling_mode != I915_TILING_NONE;
@ -2745,6 +2743,17 @@ void vlv_force_wake_put(struct drm_i915_private *dev_priv, int fw_engine);
#define I915_WRITE64(reg, val) dev_priv->uncore.funcs.mmio_writeq(dev_priv, (reg), (val), true) #define I915_WRITE64(reg, val) dev_priv->uncore.funcs.mmio_writeq(dev_priv, (reg), (val), true)
#define I915_READ64(reg) dev_priv->uncore.funcs.mmio_readq(dev_priv, (reg), true) #define I915_READ64(reg) dev_priv->uncore.funcs.mmio_readq(dev_priv, (reg), true)
#define I915_READ64_2x32(lower_reg, upper_reg) ({ \
u32 upper = I915_READ(upper_reg); \
u32 lower = I915_READ(lower_reg); \
u32 tmp = I915_READ(upper_reg); \
if (upper != tmp) { \
upper = tmp; \
lower = I915_READ(lower_reg); \
WARN_ON(I915_READ(upper_reg) != upper); \
} \
(u64)upper << 32 | lower; })
#define POSTING_READ(reg) (void)I915_READ_NOTRACE(reg) #define POSTING_READ(reg) (void)I915_READ_NOTRACE(reg)
#define POSTING_READ16(reg) (void)I915_READ16_NOTRACE(reg) #define POSTING_READ16(reg) (void)I915_READ16_NOTRACE(reg)

View File

@ -615,7 +615,7 @@ i915_gem_gtt_pwrite_fast(struct drm_device *dev,
struct drm_i915_gem_pwrite *args, struct drm_i915_gem_pwrite *args,
struct drm_file *file) struct drm_file *file)
{ {
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
ssize_t remain; ssize_t remain;
loff_t offset, page_base; loff_t offset, page_base;
char __user *user_data; char __user *user_data;
@ -1027,7 +1027,7 @@ static int __wait_seqno(struct intel_ring_buffer *ring, u32 seqno,
struct drm_i915_file_private *file_priv) struct drm_i915_file_private *file_priv)
{ {
struct drm_device *dev = ring->dev; struct drm_device *dev = ring->dev;
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
const bool irq_test_in_progress = const bool irq_test_in_progress =
ACCESS_ONCE(dev_priv->gpu_error.test_irq_rings) & intel_ring_flag(ring); ACCESS_ONCE(dev_priv->gpu_error.test_irq_rings) & intel_ring_flag(ring);
struct timespec before, now; struct timespec before, now;
@ -1389,7 +1389,7 @@ int i915_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
{ {
struct drm_i915_gem_object *obj = to_intel_bo(vma->vm_private_data); struct drm_i915_gem_object *obj = to_intel_bo(vma->vm_private_data);
struct drm_device *dev = obj->base.dev; struct drm_device *dev = obj->base.dev;
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
pgoff_t page_offset; pgoff_t page_offset;
unsigned long pfn; unsigned long pfn;
int ret = 0; int ret = 0;
@ -2164,7 +2164,7 @@ int __i915_add_request(struct intel_ring_buffer *ring,
struct drm_i915_gem_object *obj, struct drm_i915_gem_object *obj,
u32 *out_seqno) u32 *out_seqno)
{ {
drm_i915_private_t *dev_priv = ring->dev->dev_private; struct drm_i915_private *dev_priv = ring->dev->dev_private;
struct drm_i915_gem_request *request; struct drm_i915_gem_request *request;
u32 request_ring_position, request_start; u32 request_ring_position, request_start;
int ret; int ret;
@ -2496,7 +2496,7 @@ i915_gem_retire_requests_ring(struct intel_ring_buffer *ring)
bool bool
i915_gem_retire_requests(struct drm_device *dev) i915_gem_retire_requests(struct drm_device *dev)
{ {
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct intel_ring_buffer *ring; struct intel_ring_buffer *ring;
bool idle = true; bool idle = true;
int i; int i;
@ -2588,7 +2588,7 @@ i915_gem_object_flush_active(struct drm_i915_gem_object *obj)
int int
i915_gem_wait_ioctl(struct drm_device *dev, void *data, struct drm_file *file) i915_gem_wait_ioctl(struct drm_device *dev, void *data, struct drm_file *file)
{ {
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct drm_i915_gem_wait *args = data; struct drm_i915_gem_wait *args = data;
struct drm_i915_gem_object *obj; struct drm_i915_gem_object *obj;
struct intel_ring_buffer *ring = NULL; struct intel_ring_buffer *ring = NULL;
@ -2723,7 +2723,7 @@ static void i915_gem_object_finish_gtt(struct drm_i915_gem_object *obj)
int i915_vma_unbind(struct i915_vma *vma) int i915_vma_unbind(struct i915_vma *vma)
{ {
struct drm_i915_gem_object *obj = vma->obj; struct drm_i915_gem_object *obj = vma->obj;
drm_i915_private_t *dev_priv = obj->base.dev->dev_private; struct drm_i915_private *dev_priv = obj->base.dev->dev_private;
int ret; int ret;
if (list_empty(&vma->vma_link)) if (list_empty(&vma->vma_link))
@ -2784,7 +2784,7 @@ int i915_vma_unbind(struct i915_vma *vma)
int i915_gpu_idle(struct drm_device *dev) int i915_gpu_idle(struct drm_device *dev)
{ {
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct intel_ring_buffer *ring; struct intel_ring_buffer *ring;
int ret, i; int ret, i;
@ -2805,7 +2805,7 @@ int i915_gpu_idle(struct drm_device *dev)
static void i965_write_fence_reg(struct drm_device *dev, int reg, static void i965_write_fence_reg(struct drm_device *dev, int reg,
struct drm_i915_gem_object *obj) struct drm_i915_gem_object *obj)
{ {
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
int fence_reg; int fence_reg;
int fence_pitch_shift; int fence_pitch_shift;
@ -2857,7 +2857,7 @@ static void i965_write_fence_reg(struct drm_device *dev, int reg,
static void i915_write_fence_reg(struct drm_device *dev, int reg, static void i915_write_fence_reg(struct drm_device *dev, int reg,
struct drm_i915_gem_object *obj) struct drm_i915_gem_object *obj)
{ {
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
u32 val; u32 val;
if (obj) { if (obj) {
@ -2901,7 +2901,7 @@ static void i915_write_fence_reg(struct drm_device *dev, int reg,
static void i830_write_fence_reg(struct drm_device *dev, int reg, static void i830_write_fence_reg(struct drm_device *dev, int reg,
struct drm_i915_gem_object *obj) struct drm_i915_gem_object *obj)
{ {
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
uint32_t val; uint32_t val;
if (obj) { if (obj) {
@ -3211,7 +3211,7 @@ i915_gem_object_bind_to_vm(struct drm_i915_gem_object *obj,
unsigned flags) unsigned flags)
{ {
struct drm_device *dev = obj->base.dev; struct drm_device *dev = obj->base.dev;
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
u32 size, fence_size, fence_alignment, unfenced_alignment; u32 size, fence_size, fence_alignment, unfenced_alignment;
size_t gtt_max = size_t gtt_max =
flags & PIN_MAPPABLE ? dev_priv->gtt.mappable_end : vm->total; flags & PIN_MAPPABLE ? dev_priv->gtt.mappable_end : vm->total;
@ -3410,7 +3410,7 @@ i915_gem_object_flush_cpu_write_domain(struct drm_i915_gem_object *obj,
int int
i915_gem_object_set_to_gtt_domain(struct drm_i915_gem_object *obj, bool write) i915_gem_object_set_to_gtt_domain(struct drm_i915_gem_object *obj, bool write)
{ {
drm_i915_private_t *dev_priv = obj->base.dev->dev_private; struct drm_i915_private *dev_priv = obj->base.dev->dev_private;
uint32_t old_write_domain, old_read_domains; uint32_t old_write_domain, old_read_domains;
int ret; int ret;
@ -4156,7 +4156,7 @@ void i915_gem_free_object(struct drm_gem_object *gem_obj)
{ {
struct drm_i915_gem_object *obj = to_intel_bo(gem_obj); struct drm_i915_gem_object *obj = to_intel_bo(gem_obj);
struct drm_device *dev = obj->base.dev; struct drm_device *dev = obj->base.dev;
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct i915_vma *vma, *next; struct i915_vma *vma, *next;
intel_runtime_pm_get(dev_priv); intel_runtime_pm_get(dev_priv);
@ -4235,7 +4235,7 @@ void i915_gem_vma_destroy(struct i915_vma *vma)
int int
i915_gem_suspend(struct drm_device *dev) i915_gem_suspend(struct drm_device *dev)
{ {
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
int ret = 0; int ret = 0;
mutex_lock(&dev->struct_mutex); mutex_lock(&dev->struct_mutex);
@ -4277,7 +4277,7 @@ err:
int i915_gem_l3_remap(struct intel_ring_buffer *ring, int slice) int i915_gem_l3_remap(struct intel_ring_buffer *ring, int slice)
{ {
struct drm_device *dev = ring->dev; struct drm_device *dev = ring->dev;
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
u32 reg_base = GEN7_L3LOG_BASE + (slice * 0x200); u32 reg_base = GEN7_L3LOG_BASE + (slice * 0x200);
u32 *remap_info = dev_priv->l3_parity.remap_info[slice]; u32 *remap_info = dev_priv->l3_parity.remap_info[slice];
int i, ret; int i, ret;
@ -4307,7 +4307,7 @@ int i915_gem_l3_remap(struct intel_ring_buffer *ring, int slice)
void i915_gem_init_swizzling(struct drm_device *dev) void i915_gem_init_swizzling(struct drm_device *dev)
{ {
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
if (INTEL_INFO(dev)->gen < 5 || if (INTEL_INFO(dev)->gen < 5 ||
dev_priv->mm.bit_6_swizzle_x == I915_BIT_6_SWIZZLE_NONE) dev_priv->mm.bit_6_swizzle_x == I915_BIT_6_SWIZZLE_NONE)
@ -4395,7 +4395,7 @@ cleanup_render_ring:
int int
i915_gem_init_hw(struct drm_device *dev) i915_gem_init_hw(struct drm_device *dev)
{ {
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
int ret, i; int ret, i;
if (INTEL_INFO(dev)->gen < 6 && !intel_enable_gtt()) if (INTEL_INFO(dev)->gen < 6 && !intel_enable_gtt())
@ -4489,7 +4489,7 @@ int i915_gem_init(struct drm_device *dev)
void void
i915_gem_cleanup_ringbuffer(struct drm_device *dev) i915_gem_cleanup_ringbuffer(struct drm_device *dev)
{ {
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct intel_ring_buffer *ring; struct intel_ring_buffer *ring;
int i; int i;
@ -4586,7 +4586,7 @@ void i915_init_vm(struct drm_i915_private *dev_priv,
void void
i915_gem_load(struct drm_device *dev) i915_gem_load(struct drm_device *dev)
{ {
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
int i; int i;
dev_priv->slab = dev_priv->slab =
@ -4653,7 +4653,7 @@ i915_gem_load(struct drm_device *dev)
static int i915_gem_init_phys_object(struct drm_device *dev, static int i915_gem_init_phys_object(struct drm_device *dev,
int id, int size, int align) int id, int size, int align)
{ {
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct drm_i915_gem_phys_object *phys_obj; struct drm_i915_gem_phys_object *phys_obj;
int ret; int ret;
@ -4685,7 +4685,7 @@ kfree_obj:
static void i915_gem_free_phys_object(struct drm_device *dev, int id) static void i915_gem_free_phys_object(struct drm_device *dev, int id)
{ {
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct drm_i915_gem_phys_object *phys_obj; struct drm_i915_gem_phys_object *phys_obj;
if (!dev_priv->mm.phys_objs[id - 1]) if (!dev_priv->mm.phys_objs[id - 1])
@ -4752,7 +4752,7 @@ i915_gem_attach_phys_object(struct drm_device *dev,
int align) int align)
{ {
struct address_space *mapping = file_inode(obj->base.filp)->i_mapping; struct address_space *mapping = file_inode(obj->base.filp)->i_mapping;
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
int ret = 0; int ret = 0;
int page_count; int page_count;
int i; int i;

View File

@ -34,7 +34,7 @@ int
i915_verify_lists(struct drm_device *dev) i915_verify_lists(struct drm_device *dev)
{ {
static int warned; static int warned;
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct drm_i915_gem_object *obj; struct drm_i915_gem_object *obj;
int err = 0; int err = 0;

View File

@ -70,7 +70,7 @@ i915_gem_evict_something(struct drm_device *dev, struct i915_address_space *vm,
int min_size, unsigned alignment, unsigned cache_level, int min_size, unsigned alignment, unsigned cache_level,
unsigned flags) unsigned flags)
{ {
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct list_head eviction_list, unwind_list; struct list_head eviction_list, unwind_list;
struct i915_vma *vma; struct i915_vma *vma;
int ret = 0; int ret = 0;
@ -243,7 +243,7 @@ int i915_gem_evict_vm(struct i915_address_space *vm, bool do_idle)
int int
i915_gem_evict_everything(struct drm_device *dev) i915_gem_evict_everything(struct drm_device *dev)
{ {
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct i915_address_space *vm; struct i915_address_space *vm;
bool lists_empty = true; bool lists_empty = true;
int ret; int ret;

View File

@ -978,7 +978,7 @@ static int
i915_reset_gen7_sol_offsets(struct drm_device *dev, i915_reset_gen7_sol_offsets(struct drm_device *dev,
struct intel_ring_buffer *ring) struct intel_ring_buffer *ring)
{ {
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
int ret, i; int ret, i;
if (!IS_GEN7(dev) || ring != &dev_priv->ring[RCS]) if (!IS_GEN7(dev) || ring != &dev_priv->ring[RCS])
@ -1005,7 +1005,7 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,
struct drm_i915_gem_execbuffer2 *args, struct drm_i915_gem_execbuffer2 *args,
struct drm_i915_gem_exec_object2 *exec) struct drm_i915_gem_exec_object2 *exec)
{ {
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct eb_vmas *eb; struct eb_vmas *eb;
struct drm_i915_gem_object *batch_obj; struct drm_i915_gem_object *batch_obj;
struct drm_clip_rect *cliprects = NULL; struct drm_clip_rect *cliprects = NULL;

View File

@ -888,7 +888,7 @@ err_out:
static int gen7_ppgtt_enable(struct i915_hw_ppgtt *ppgtt) static int gen7_ppgtt_enable(struct i915_hw_ppgtt *ppgtt)
{ {
struct drm_device *dev = ppgtt->base.dev; struct drm_device *dev = ppgtt->base.dev;
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct intel_ring_buffer *ring; struct intel_ring_buffer *ring;
uint32_t ecochk, ecobits; uint32_t ecochk, ecobits;
int i; int i;
@ -927,7 +927,7 @@ static int gen7_ppgtt_enable(struct i915_hw_ppgtt *ppgtt)
static int gen6_ppgtt_enable(struct i915_hw_ppgtt *ppgtt) static int gen6_ppgtt_enable(struct i915_hw_ppgtt *ppgtt)
{ {
struct drm_device *dev = ppgtt->base.dev; struct drm_device *dev = ppgtt->base.dev;
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct intel_ring_buffer *ring; struct intel_ring_buffer *ring;
uint32_t ecochk, gab_ctl, ecobits; uint32_t ecochk, gab_ctl, ecobits;
int i; int i;
@ -1340,7 +1340,7 @@ void i915_gem_suspend_gtt_mappings(struct drm_device *dev)
dev_priv->gtt.base.clear_range(&dev_priv->gtt.base, dev_priv->gtt.base.clear_range(&dev_priv->gtt.base,
dev_priv->gtt.base.start, dev_priv->gtt.base.start,
dev_priv->gtt.base.total, dev_priv->gtt.base.total,
false); true);
} }
void i915_gem_restore_gtt_mappings(struct drm_device *dev) void i915_gem_restore_gtt_mappings(struct drm_device *dev)

View File

@ -214,6 +214,13 @@ int i915_gem_init_stolen(struct drm_device *dev)
struct drm_i915_private *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
int bios_reserved = 0; int bios_reserved = 0;
#ifdef CONFIG_INTEL_IOMMU
if (intel_iommu_gfx_mapped && INTEL_INFO(dev)->gen < 8) {
DRM_INFO("DMAR active, disabling use of stolen memory\n");
return 0;
}
#endif
if (dev_priv->gtt.stolen_size == 0) if (dev_priv->gtt.stolen_size == 0)
return 0; return 0;

View File

@ -87,7 +87,7 @@
void void
i915_gem_detect_bit_6_swizzle(struct drm_device *dev) i915_gem_detect_bit_6_swizzle(struct drm_device *dev)
{ {
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
uint32_t swizzle_x = I915_BIT_6_SWIZZLE_UNKNOWN; uint32_t swizzle_x = I915_BIT_6_SWIZZLE_UNKNOWN;
uint32_t swizzle_y = I915_BIT_6_SWIZZLE_UNKNOWN; uint32_t swizzle_y = I915_BIT_6_SWIZZLE_UNKNOWN;
@ -294,7 +294,7 @@ i915_gem_set_tiling(struct drm_device *dev, void *data,
struct drm_file *file) struct drm_file *file)
{ {
struct drm_i915_gem_set_tiling *args = data; struct drm_i915_gem_set_tiling *args = data;
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct drm_i915_gem_object *obj; struct drm_i915_gem_object *obj;
int ret = 0; int ret = 0;
@ -415,7 +415,7 @@ i915_gem_get_tiling(struct drm_device *dev, void *data,
struct drm_file *file) struct drm_file *file)
{ {
struct drm_i915_gem_get_tiling *args = data; struct drm_i915_gem_get_tiling *args = data;
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct drm_i915_gem_object *obj; struct drm_i915_gem_object *obj;
obj = to_intel_bo(drm_gem_object_lookup(dev, file, args->handle)); obj = to_intel_bo(drm_gem_object_lookup(dev, file, args->handle));

View File

@ -247,12 +247,12 @@ static void i915_ring_error_state(struct drm_i915_error_state_buf *m,
err_printf(m, " TAIL: 0x%08x\n", ring->tail); err_printf(m, " TAIL: 0x%08x\n", ring->tail);
err_printf(m, " CTL: 0x%08x\n", ring->ctl); err_printf(m, " CTL: 0x%08x\n", ring->ctl);
err_printf(m, " HWS: 0x%08x\n", ring->hws); err_printf(m, " HWS: 0x%08x\n", ring->hws);
err_printf(m, " ACTHD: 0x%08x\n", ring->acthd); err_printf(m, " ACTHD: 0x%08x %08x\n", (u32)(ring->acthd>>32), (u32)ring->acthd);
err_printf(m, " IPEIR: 0x%08x\n", ring->ipeir); err_printf(m, " IPEIR: 0x%08x\n", ring->ipeir);
err_printf(m, " IPEHR: 0x%08x\n", ring->ipehr); err_printf(m, " IPEHR: 0x%08x\n", ring->ipehr);
err_printf(m, " INSTDONE: 0x%08x\n", ring->instdone); err_printf(m, " INSTDONE: 0x%08x\n", ring->instdone);
if (INTEL_INFO(dev)->gen >= 4) { if (INTEL_INFO(dev)->gen >= 4) {
err_printf(m, " BBADDR: 0x%08llx\n", ring->bbaddr); err_printf(m, " BBADDR: 0x%08x %08x\n", (u32)(ring->bbaddr>>32), (u32)ring->bbaddr);
err_printf(m, " BB_STATE: 0x%08x\n", ring->bbstate); err_printf(m, " BB_STATE: 0x%08x\n", ring->bbstate);
err_printf(m, " INSTPS: 0x%08x\n", ring->instps); err_printf(m, " INSTPS: 0x%08x\n", ring->instps);
} }
@ -322,7 +322,7 @@ int i915_error_state_to_str(struct drm_i915_error_state_buf *m,
const struct i915_error_state_file_priv *error_priv) const struct i915_error_state_file_priv *error_priv)
{ {
struct drm_device *dev = error_priv->dev; struct drm_device *dev = error_priv->dev;
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct drm_i915_error_state *error = error_priv->error; struct drm_i915_error_state *error = error_priv->error;
int i, j, offset, elt; int i, j, offset, elt;
int max_hangcheck_score; int max_hangcheck_score;

View File

@ -82,7 +82,7 @@ static const u32 hpd_status_i915[] = { /* i915 and valleyview are the same */
/* For display hotplug interrupt */ /* For display hotplug interrupt */
static void static void
ironlake_enable_display_irq(drm_i915_private_t *dev_priv, u32 mask) ironlake_enable_display_irq(struct drm_i915_private *dev_priv, u32 mask)
{ {
assert_spin_locked(&dev_priv->irq_lock); assert_spin_locked(&dev_priv->irq_lock);
@ -100,7 +100,7 @@ ironlake_enable_display_irq(drm_i915_private_t *dev_priv, u32 mask)
} }
static void static void
ironlake_disable_display_irq(drm_i915_private_t *dev_priv, u32 mask) ironlake_disable_display_irq(struct drm_i915_private *dev_priv, u32 mask)
{ {
assert_spin_locked(&dev_priv->irq_lock); assert_spin_locked(&dev_priv->irq_lock);
@ -596,7 +596,7 @@ i915_disable_pipestat(struct drm_i915_private *dev_priv, enum pipe pipe,
*/ */
static void i915_enable_asle_pipestat(struct drm_device *dev) static void i915_enable_asle_pipestat(struct drm_device *dev)
{ {
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
unsigned long irqflags; unsigned long irqflags;
if (!dev_priv->opregion.asle || !IS_MOBILE(dev)) if (!dev_priv->opregion.asle || !IS_MOBILE(dev))
@ -624,7 +624,7 @@ static void i915_enable_asle_pipestat(struct drm_device *dev)
static int static int
i915_pipe_enabled(struct drm_device *dev, int pipe) i915_pipe_enabled(struct drm_device *dev, int pipe)
{ {
drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
if (drm_core_check_feature(dev, DRIVER_MODESET)) { if (drm_core_check_feature(dev, DRIVER_MODESET)) {
/* Locking is horribly broken here, but whatever. */ /* Locking is horribly broken here, but whatever. */
@ -648,7 +648,7 @@ static u32 i8xx_get_vblank_counter(struct drm_device *dev, int pipe)
*/ */
static u32 i915_get_vblank_counter(struct drm_device *dev, int pipe) static u32 i915_get_vblank_counter(struct drm_device *dev, int pipe)
{ {
drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
unsigned long high_frame; unsigned long high_frame;
unsigned long low_frame; unsigned long low_frame;
u32 high1, high2, low, pixel, vbl_start; u32 high1, high2, low, pixel, vbl_start;
@ -704,7 +704,7 @@ static u32 i915_get_vblank_counter(struct drm_device *dev, int pipe)
static u32 gm45_get_vblank_counter(struct drm_device *dev, int pipe) static u32 gm45_get_vblank_counter(struct drm_device *dev, int pipe)
{ {
drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
int reg = PIPE_FRMCOUNT_GM45(pipe); int reg = PIPE_FRMCOUNT_GM45(pipe);
if (!i915_pipe_enabled(dev, pipe)) { if (!i915_pipe_enabled(dev, pipe)) {
@ -718,33 +718,25 @@ static u32 gm45_get_vblank_counter(struct drm_device *dev, int pipe)
/* raw reads, only for fast reads of display block, no need for forcewake etc. */ /* raw reads, only for fast reads of display block, no need for forcewake etc. */
#define __raw_i915_read32(dev_priv__, reg__) readl((dev_priv__)->regs + (reg__)) #define __raw_i915_read32(dev_priv__, reg__) readl((dev_priv__)->regs + (reg__))
#define __raw_i915_read16(dev_priv__, reg__) readw((dev_priv__)->regs + (reg__))
static bool ilk_pipe_in_vblank_locked(struct drm_device *dev, enum pipe pipe) static bool ilk_pipe_in_vblank_locked(struct drm_device *dev, enum pipe pipe)
{ {
struct drm_i915_private *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
uint32_t status; uint32_t status;
int reg;
if (INTEL_INFO(dev)->gen < 7) { if (INTEL_INFO(dev)->gen >= 8) {
status = pipe == PIPE_A ? status = GEN8_PIPE_VBLANK;
DE_PIPEA_VBLANK : reg = GEN8_DE_PIPE_ISR(pipe);
DE_PIPEB_VBLANK; } else if (INTEL_INFO(dev)->gen >= 7) {
status = DE_PIPE_VBLANK_IVB(pipe);
reg = DEISR;
} else { } else {
switch (pipe) { status = DE_PIPE_VBLANK(pipe);
default: reg = DEISR;
case PIPE_A:
status = DE_PIPEA_VBLANK_IVB;
break;
case PIPE_B:
status = DE_PIPEB_VBLANK_IVB;
break;
case PIPE_C:
status = DE_PIPEC_VBLANK_IVB;
break;
}
} }
return __raw_i915_read32(dev_priv, DEISR) & status; return __raw_i915_read32(dev_priv, reg) & status;
} }
static int i915_get_crtc_scanoutpos(struct drm_device *dev, int pipe, static int i915_get_crtc_scanoutpos(struct drm_device *dev, int pipe,
@ -802,7 +794,28 @@ static int i915_get_crtc_scanoutpos(struct drm_device *dev, int pipe,
else else
position = __raw_i915_read32(dev_priv, PIPEDSL(pipe)) & DSL_LINEMASK_GEN3; position = __raw_i915_read32(dev_priv, PIPEDSL(pipe)) & DSL_LINEMASK_GEN3;
if (HAS_PCH_SPLIT(dev)) { if (HAS_DDI(dev)) {
/*
* On HSW HDMI outputs there seems to be a 2 line
* difference, whereas eDP has the normal 1 line
* difference that earlier platforms have. External
* DP is unknown. For now just check for the 2 line
* difference case on all output types on HSW+.
*
* This might misinterpret the scanline counter being
* one line too far along on eDP, but that's less
* dangerous than the alternative since that would lead
* the vblank timestamp code astray when it sees a
* scanline count before vblank_start during a vblank
* interrupt.
*/
in_vbl = ilk_pipe_in_vblank_locked(dev, pipe);
if ((in_vbl && (position == vbl_start - 2 ||
position == vbl_start - 1)) ||
(!in_vbl && (position == vbl_end - 2 ||
position == vbl_end - 1)))
position = (position + 2) % vtotal;
} else if (HAS_PCH_SPLIT(dev)) {
/* /*
* The scanline counter increments at the leading edge * The scanline counter increments at the leading edge
* of hsync, ie. it completely misses the active portion * of hsync, ie. it completely misses the active portion
@ -946,8 +959,8 @@ static bool intel_hpd_irq_event(struct drm_device *dev,
static void i915_hotplug_work_func(struct work_struct *work) static void i915_hotplug_work_func(struct work_struct *work)
{ {
drm_i915_private_t *dev_priv = container_of(work, drm_i915_private_t, struct drm_i915_private *dev_priv =
hotplug_work); container_of(work, struct drm_i915_private, hotplug_work);
struct drm_device *dev = dev_priv->dev; struct drm_device *dev = dev_priv->dev;
struct drm_mode_config *mode_config = &dev->mode_config; struct drm_mode_config *mode_config = &dev->mode_config;
struct intel_connector *intel_connector; struct intel_connector *intel_connector;
@ -1022,7 +1035,7 @@ static void intel_hpd_irq_uninstall(struct drm_i915_private *dev_priv)
static void ironlake_rps_change_irq_handler(struct drm_device *dev) static void ironlake_rps_change_irq_handler(struct drm_device *dev)
{ {
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
u32 busy_up, busy_down, max_avg, min_avg; u32 busy_up, busy_down, max_avg, min_avg;
u8 new_delay; u8 new_delay;
@ -1071,47 +1084,10 @@ static void notify_ring(struct drm_device *dev,
i915_queue_hangcheck(dev); i915_queue_hangcheck(dev);
} }
void gen6_set_pm_mask(struct drm_i915_private *dev_priv,
u32 pm_iir, int new_delay)
{
if (pm_iir & GEN6_PM_RP_UP_THRESHOLD) {
if (new_delay >= dev_priv->rps.max_freq_softlimit) {
/* Mask UP THRESHOLD Interrupts */
I915_WRITE(GEN6_PMINTRMSK,
I915_READ(GEN6_PMINTRMSK) |
GEN6_PM_RP_UP_THRESHOLD);
dev_priv->rps.rp_up_masked = true;
}
if (dev_priv->rps.rp_down_masked) {
/* UnMask DOWN THRESHOLD Interrupts */
I915_WRITE(GEN6_PMINTRMSK,
I915_READ(GEN6_PMINTRMSK) &
~GEN6_PM_RP_DOWN_THRESHOLD);
dev_priv->rps.rp_down_masked = false;
}
} else if (pm_iir & GEN6_PM_RP_DOWN_THRESHOLD) {
if (new_delay <= dev_priv->rps.min_freq_softlimit) {
/* Mask DOWN THRESHOLD Interrupts */
I915_WRITE(GEN6_PMINTRMSK,
I915_READ(GEN6_PMINTRMSK) |
GEN6_PM_RP_DOWN_THRESHOLD);
dev_priv->rps.rp_down_masked = true;
}
if (dev_priv->rps.rp_up_masked) {
/* UnMask UP THRESHOLD Interrupts */
I915_WRITE(GEN6_PMINTRMSK,
I915_READ(GEN6_PMINTRMSK) &
~GEN6_PM_RP_UP_THRESHOLD);
dev_priv->rps.rp_up_masked = false;
}
}
}
static void gen6_pm_rps_work(struct work_struct *work) static void gen6_pm_rps_work(struct work_struct *work)
{ {
drm_i915_private_t *dev_priv = container_of(work, drm_i915_private_t, struct drm_i915_private *dev_priv =
rps.work); container_of(work, struct drm_i915_private, rps.work);
u32 pm_iir; u32 pm_iir;
int new_delay, adj; int new_delay, adj;
@ -1119,13 +1095,13 @@ static void gen6_pm_rps_work(struct work_struct *work)
pm_iir = dev_priv->rps.pm_iir; pm_iir = dev_priv->rps.pm_iir;
dev_priv->rps.pm_iir = 0; dev_priv->rps.pm_iir = 0;
/* Make sure not to corrupt PMIMR state used by ringbuffer code */ /* Make sure not to corrupt PMIMR state used by ringbuffer code */
snb_enable_pm_irq(dev_priv, GEN6_PM_RPS_EVENTS); snb_enable_pm_irq(dev_priv, dev_priv->pm_rps_events);
spin_unlock_irq(&dev_priv->irq_lock); spin_unlock_irq(&dev_priv->irq_lock);
/* Make sure we didn't queue anything we're not going to process. */ /* Make sure we didn't queue anything we're not going to process. */
WARN_ON(pm_iir & ~GEN6_PM_RPS_EVENTS); WARN_ON(pm_iir & ~dev_priv->pm_rps_events);
if ((pm_iir & GEN6_PM_RPS_EVENTS) == 0) if ((pm_iir & dev_priv->pm_rps_events) == 0)
return; return;
mutex_lock(&dev_priv->rps.hw_lock); mutex_lock(&dev_priv->rps.hw_lock);
@ -1167,7 +1143,6 @@ static void gen6_pm_rps_work(struct work_struct *work)
dev_priv->rps.min_freq_softlimit, dev_priv->rps.min_freq_softlimit,
dev_priv->rps.max_freq_softlimit); dev_priv->rps.max_freq_softlimit);
gen6_set_pm_mask(dev_priv, pm_iir, new_delay);
dev_priv->rps.last_adj = new_delay - dev_priv->rps.cur_freq; dev_priv->rps.last_adj = new_delay - dev_priv->rps.cur_freq;
if (IS_VALLEYVIEW(dev_priv->dev)) if (IS_VALLEYVIEW(dev_priv->dev))
@ -1190,8 +1165,8 @@ static void gen6_pm_rps_work(struct work_struct *work)
*/ */
static void ivybridge_parity_work(struct work_struct *work) static void ivybridge_parity_work(struct work_struct *work)
{ {
drm_i915_private_t *dev_priv = container_of(work, drm_i915_private_t, struct drm_i915_private *dev_priv =
l3_parity.error_work); container_of(work, struct drm_i915_private, l3_parity.error_work);
u32 error_status, row, bank, subbank; u32 error_status, row, bank, subbank;
char *parity_event[6]; char *parity_event[6];
uint32_t misccpctl; uint32_t misccpctl;
@ -1263,7 +1238,7 @@ out:
static void ivybridge_parity_error_irq_handler(struct drm_device *dev, u32 iir) static void ivybridge_parity_error_irq_handler(struct drm_device *dev, u32 iir)
{ {
drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
if (!HAS_L3_DPF(dev)) if (!HAS_L3_DPF(dev))
return; return;
@ -1374,7 +1349,7 @@ static inline void intel_hpd_irq_handler(struct drm_device *dev,
u32 hotplug_trigger, u32 hotplug_trigger,
const u32 *hpd) const u32 *hpd)
{ {
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
int i; int i;
bool storm_detected = false; bool storm_detected = false;
@ -1430,14 +1405,14 @@ static inline void intel_hpd_irq_handler(struct drm_device *dev,
static void gmbus_irq_handler(struct drm_device *dev) static void gmbus_irq_handler(struct drm_device *dev)
{ {
struct drm_i915_private *dev_priv = (drm_i915_private_t *) dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
wake_up_all(&dev_priv->gmbus_wait_queue); wake_up_all(&dev_priv->gmbus_wait_queue);
} }
static void dp_aux_irq_handler(struct drm_device *dev) static void dp_aux_irq_handler(struct drm_device *dev)
{ {
struct drm_i915_private *dev_priv = (drm_i915_private_t *) dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
wake_up_all(&dev_priv->gmbus_wait_queue); wake_up_all(&dev_priv->gmbus_wait_queue);
} }
@ -1543,10 +1518,10 @@ static void i9xx_pipe_crc_irq_handler(struct drm_device *dev, enum pipe pipe)
* the work queue. */ * the work queue. */
static void gen6_rps_irq_handler(struct drm_i915_private *dev_priv, u32 pm_iir) static void gen6_rps_irq_handler(struct drm_i915_private *dev_priv, u32 pm_iir)
{ {
if (pm_iir & GEN6_PM_RPS_EVENTS) { if (pm_iir & dev_priv->pm_rps_events) {
spin_lock(&dev_priv->irq_lock); spin_lock(&dev_priv->irq_lock);
dev_priv->rps.pm_iir |= pm_iir & GEN6_PM_RPS_EVENTS; dev_priv->rps.pm_iir |= pm_iir & dev_priv->pm_rps_events;
snb_disable_pm_irq(dev_priv, pm_iir & GEN6_PM_RPS_EVENTS); snb_disable_pm_irq(dev_priv, pm_iir & dev_priv->pm_rps_events);
spin_unlock(&dev_priv->irq_lock); spin_unlock(&dev_priv->irq_lock);
queue_work(dev_priv->wq, &dev_priv->rps.work); queue_work(dev_priv->wq, &dev_priv->rps.work);
@ -1637,7 +1612,7 @@ static void valleyview_pipestat_irq_handler(struct drm_device *dev, u32 iir)
static irqreturn_t valleyview_irq_handler(int irq, void *arg) static irqreturn_t valleyview_irq_handler(int irq, void *arg)
{ {
struct drm_device *dev = (struct drm_device *) arg; struct drm_device *dev = (struct drm_device *) arg;
drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
u32 iir, gt_iir, pm_iir; u32 iir, gt_iir, pm_iir;
irqreturn_t ret = IRQ_NONE; irqreturn_t ret = IRQ_NONE;
@ -1684,7 +1659,7 @@ out:
static void ibx_irq_handler(struct drm_device *dev, u32 pch_iir) static void ibx_irq_handler(struct drm_device *dev, u32 pch_iir)
{ {
drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
int pipe; int pipe;
u32 hotplug_trigger = pch_iir & SDE_HOTPLUG_MASK; u32 hotplug_trigger = pch_iir & SDE_HOTPLUG_MASK;
@ -1791,7 +1766,7 @@ static void cpt_serr_int_handler(struct drm_device *dev)
static void cpt_irq_handler(struct drm_device *dev, u32 pch_iir) static void cpt_irq_handler(struct drm_device *dev, u32 pch_iir)
{ {
drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
int pipe; int pipe;
u32 hotplug_trigger = pch_iir & SDE_HOTPLUG_MASK_CPT; u32 hotplug_trigger = pch_iir & SDE_HOTPLUG_MASK_CPT;
@ -1915,7 +1890,7 @@ static void ivb_display_irq_handler(struct drm_device *dev, u32 de_iir)
static irqreturn_t ironlake_irq_handler(int irq, void *arg) static irqreturn_t ironlake_irq_handler(int irq, void *arg)
{ {
struct drm_device *dev = (struct drm_device *) arg; struct drm_device *dev = (struct drm_device *) arg;
drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
u32 de_iir, gt_iir, de_ier, sde_ier = 0; u32 de_iir, gt_iir, de_ier, sde_ier = 0;
irqreturn_t ret = IRQ_NONE; irqreturn_t ret = IRQ_NONE;
@ -2126,8 +2101,8 @@ static void i915_error_work_func(struct work_struct *work)
{ {
struct i915_gpu_error *error = container_of(work, struct i915_gpu_error, struct i915_gpu_error *error = container_of(work, struct i915_gpu_error,
work); work);
drm_i915_private_t *dev_priv = container_of(error, drm_i915_private_t, struct drm_i915_private *dev_priv =
gpu_error); container_of(error, struct drm_i915_private, gpu_error);
struct drm_device *dev = dev_priv->dev; struct drm_device *dev = dev_priv->dev;
char *error_event[] = { I915_ERROR_UEVENT "=1", NULL }; char *error_event[] = { I915_ERROR_UEVENT "=1", NULL };
char *reset_event[] = { I915_RESET_UEVENT "=1", NULL }; char *reset_event[] = { I915_RESET_UEVENT "=1", NULL };
@ -2336,7 +2311,7 @@ void i915_handle_error(struct drm_device *dev, bool wedged,
static void __always_unused i915_pageflip_stall_check(struct drm_device *dev, int pipe) static void __always_unused i915_pageflip_stall_check(struct drm_device *dev, int pipe)
{ {
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct drm_crtc *crtc = dev_priv->pipe_to_crtc_mapping[pipe]; struct drm_crtc *crtc = dev_priv->pipe_to_crtc_mapping[pipe];
struct intel_crtc *intel_crtc = to_intel_crtc(crtc); struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
struct drm_i915_gem_object *obj; struct drm_i915_gem_object *obj;
@ -2385,7 +2360,7 @@ static void __always_unused i915_pageflip_stall_check(struct drm_device *dev, in
*/ */
static int i915_enable_vblank(struct drm_device *dev, int pipe) static int i915_enable_vblank(struct drm_device *dev, int pipe)
{ {
drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
unsigned long irqflags; unsigned long irqflags;
if (!i915_pipe_enabled(dev, pipe)) if (!i915_pipe_enabled(dev, pipe))
@ -2409,7 +2384,7 @@ static int i915_enable_vblank(struct drm_device *dev, int pipe)
static int ironlake_enable_vblank(struct drm_device *dev, int pipe) static int ironlake_enable_vblank(struct drm_device *dev, int pipe)
{ {
drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
unsigned long irqflags; unsigned long irqflags;
uint32_t bit = (INTEL_INFO(dev)->gen >= 7) ? DE_PIPE_VBLANK_IVB(pipe) : uint32_t bit = (INTEL_INFO(dev)->gen >= 7) ? DE_PIPE_VBLANK_IVB(pipe) :
DE_PIPE_VBLANK(pipe); DE_PIPE_VBLANK(pipe);
@ -2426,7 +2401,7 @@ static int ironlake_enable_vblank(struct drm_device *dev, int pipe)
static int valleyview_enable_vblank(struct drm_device *dev, int pipe) static int valleyview_enable_vblank(struct drm_device *dev, int pipe)
{ {
drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
unsigned long irqflags; unsigned long irqflags;
if (!i915_pipe_enabled(dev, pipe)) if (!i915_pipe_enabled(dev, pipe))
@ -2461,7 +2436,7 @@ static int gen8_enable_vblank(struct drm_device *dev, int pipe)
*/ */
static void i915_disable_vblank(struct drm_device *dev, int pipe) static void i915_disable_vblank(struct drm_device *dev, int pipe)
{ {
drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
unsigned long irqflags; unsigned long irqflags;
spin_lock_irqsave(&dev_priv->irq_lock, irqflags); spin_lock_irqsave(&dev_priv->irq_lock, irqflags);
@ -2476,7 +2451,7 @@ static void i915_disable_vblank(struct drm_device *dev, int pipe)
static void ironlake_disable_vblank(struct drm_device *dev, int pipe) static void ironlake_disable_vblank(struct drm_device *dev, int pipe)
{ {
drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
unsigned long irqflags; unsigned long irqflags;
uint32_t bit = (INTEL_INFO(dev)->gen >= 7) ? DE_PIPE_VBLANK_IVB(pipe) : uint32_t bit = (INTEL_INFO(dev)->gen >= 7) ? DE_PIPE_VBLANK_IVB(pipe) :
DE_PIPE_VBLANK(pipe); DE_PIPE_VBLANK(pipe);
@ -2488,7 +2463,7 @@ static void ironlake_disable_vblank(struct drm_device *dev, int pipe)
static void valleyview_disable_vblank(struct drm_device *dev, int pipe) static void valleyview_disable_vblank(struct drm_device *dev, int pipe)
{ {
drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
unsigned long irqflags; unsigned long irqflags;
spin_lock_irqsave(&dev_priv->irq_lock, irqflags); spin_lock_irqsave(&dev_priv->irq_lock, irqflags);
@ -2530,29 +2505,43 @@ static struct intel_ring_buffer *
semaphore_waits_for(struct intel_ring_buffer *ring, u32 *seqno) semaphore_waits_for(struct intel_ring_buffer *ring, u32 *seqno)
{ {
struct drm_i915_private *dev_priv = ring->dev->dev_private; struct drm_i915_private *dev_priv = ring->dev->dev_private;
u32 cmd, ipehr, acthd, acthd_min; u32 cmd, ipehr, head;
int i;
ipehr = I915_READ(RING_IPEHR(ring->mmio_base)); ipehr = I915_READ(RING_IPEHR(ring->mmio_base));
if ((ipehr & ~(0x3 << 16)) != if ((ipehr & ~(0x3 << 16)) !=
(MI_SEMAPHORE_MBOX | MI_SEMAPHORE_COMPARE | MI_SEMAPHORE_REGISTER)) (MI_SEMAPHORE_MBOX | MI_SEMAPHORE_COMPARE | MI_SEMAPHORE_REGISTER))
return NULL; return NULL;
/* ACTHD is likely pointing to the dword after the actual command, /*
* so scan backwards until we find the MBOX. * HEAD is likely pointing to the dword after the actual command,
* so scan backwards until we find the MBOX. But limit it to just 3
* dwords. Note that we don't care about ACTHD here since that might
* point at at batch, and semaphores are always emitted into the
* ringbuffer itself.
*/ */
acthd = intel_ring_get_active_head(ring) & HEAD_ADDR; head = I915_READ_HEAD(ring) & HEAD_ADDR;
acthd_min = max((int)acthd - 3 * 4, 0);
do { for (i = 4; i; --i) {
cmd = ioread32(ring->virtual_start + acthd); /*
* Be paranoid and presume the hw has gone off into the wild -
* our ring is smaller than what the hardware (and hence
* HEAD_ADDR) allows. Also handles wrap-around.
*/
head &= ring->size - 1;
/* This here seems to blow up */
cmd = ioread32(ring->virtual_start + head);
if (cmd == ipehr) if (cmd == ipehr)
break; break;
acthd -= 4; head -= 4;
if (acthd < acthd_min) }
return NULL;
} while (1);
*seqno = ioread32(ring->virtual_start+acthd+4)+1; if (!i)
return NULL;
*seqno = ioread32(ring->virtual_start + head + 4) + 1;
return &dev_priv->ring[(ring->id + (((ipehr >> 17) & 1) + 1)) % 3]; return &dev_priv->ring[(ring->id + (((ipehr >> 17) & 1) + 1)) % 3];
} }
@ -2586,7 +2575,7 @@ static void semaphore_clear_deadlocks(struct drm_i915_private *dev_priv)
} }
static enum intel_ring_hangcheck_action static enum intel_ring_hangcheck_action
ring_stuck(struct intel_ring_buffer *ring, u32 acthd) ring_stuck(struct intel_ring_buffer *ring, u64 acthd)
{ {
struct drm_device *dev = ring->dev; struct drm_device *dev = ring->dev;
struct drm_i915_private *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
@ -2641,7 +2630,7 @@ ring_stuck(struct intel_ring_buffer *ring, u32 acthd)
static void i915_hangcheck_elapsed(unsigned long data) static void i915_hangcheck_elapsed(unsigned long data)
{ {
struct drm_device *dev = (struct drm_device *)data; struct drm_device *dev = (struct drm_device *)data;
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct intel_ring_buffer *ring; struct intel_ring_buffer *ring;
int i; int i;
int busy_count = 0, rings_hung = 0; int busy_count = 0, rings_hung = 0;
@ -2654,7 +2643,8 @@ static void i915_hangcheck_elapsed(unsigned long data)
return; return;
for_each_ring(ring, dev_priv, i) { for_each_ring(ring, dev_priv, i) {
u32 seqno, acthd; u64 acthd;
u32 seqno;
bool busy = true; bool busy = true;
semaphore_clear_deadlocks(dev_priv); semaphore_clear_deadlocks(dev_priv);
@ -2799,7 +2789,7 @@ static void gen5_gt_irq_preinstall(struct drm_device *dev)
*/ */
static void ironlake_irq_preinstall(struct drm_device *dev) static void ironlake_irq_preinstall(struct drm_device *dev)
{ {
drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
I915_WRITE(HWSTAM, 0xeffe); I915_WRITE(HWSTAM, 0xeffe);
@ -2814,7 +2804,7 @@ static void ironlake_irq_preinstall(struct drm_device *dev)
static void valleyview_irq_preinstall(struct drm_device *dev) static void valleyview_irq_preinstall(struct drm_device *dev)
{ {
drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
int pipe; int pipe;
/* VLV magic */ /* VLV magic */
@ -2890,7 +2880,7 @@ static void gen8_irq_preinstall(struct drm_device *dev)
static void ibx_hpd_irq_setup(struct drm_device *dev) static void ibx_hpd_irq_setup(struct drm_device *dev)
{ {
drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct drm_mode_config *mode_config = &dev->mode_config; struct drm_mode_config *mode_config = &dev->mode_config;
struct intel_encoder *intel_encoder; struct intel_encoder *intel_encoder;
u32 hotplug_irqs, hotplug, enabled_irqs = 0; u32 hotplug_irqs, hotplug, enabled_irqs = 0;
@ -2925,17 +2915,16 @@ static void ibx_hpd_irq_setup(struct drm_device *dev)
static void ibx_irq_postinstall(struct drm_device *dev) static void ibx_irq_postinstall(struct drm_device *dev)
{ {
drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
u32 mask; u32 mask;
if (HAS_PCH_NOP(dev)) if (HAS_PCH_NOP(dev))
return; return;
if (HAS_PCH_IBX(dev)) { if (HAS_PCH_IBX(dev)) {
mask = SDE_GMBUS | SDE_AUX_MASK | SDE_TRANSB_FIFO_UNDER | mask = SDE_GMBUS | SDE_AUX_MASK | SDE_POISON;
SDE_TRANSA_FIFO_UNDER | SDE_POISON;
} else { } else {
mask = SDE_GMBUS_CPT | SDE_AUX_MASK_CPT | SDE_ERROR_CPT; mask = SDE_GMBUS_CPT | SDE_AUX_MASK_CPT;
I915_WRITE(SERR_INT, I915_READ(SERR_INT)); I915_WRITE(SERR_INT, I915_READ(SERR_INT));
} }
@ -2972,7 +2961,7 @@ static void gen5_gt_irq_postinstall(struct drm_device *dev)
POSTING_READ(GTIER); POSTING_READ(GTIER);
if (INTEL_INFO(dev)->gen >= 6) { if (INTEL_INFO(dev)->gen >= 6) {
pm_irqs |= GEN6_PM_RPS_EVENTS; pm_irqs |= dev_priv->pm_rps_events;
if (HAS_VEBOX(dev)) if (HAS_VEBOX(dev))
pm_irqs |= PM_VEBOX_USER_INTERRUPT; pm_irqs |= PM_VEBOX_USER_INTERRUPT;
@ -2988,27 +2977,26 @@ static void gen5_gt_irq_postinstall(struct drm_device *dev)
static int ironlake_irq_postinstall(struct drm_device *dev) static int ironlake_irq_postinstall(struct drm_device *dev)
{ {
unsigned long irqflags; unsigned long irqflags;
drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
u32 display_mask, extra_mask; u32 display_mask, extra_mask;
if (INTEL_INFO(dev)->gen >= 7) { if (INTEL_INFO(dev)->gen >= 7) {
display_mask = (DE_MASTER_IRQ_CONTROL | DE_GSE_IVB | display_mask = (DE_MASTER_IRQ_CONTROL | DE_GSE_IVB |
DE_PCH_EVENT_IVB | DE_PLANEC_FLIP_DONE_IVB | DE_PCH_EVENT_IVB | DE_PLANEC_FLIP_DONE_IVB |
DE_PLANEB_FLIP_DONE_IVB | DE_PLANEB_FLIP_DONE_IVB |
DE_PLANEA_FLIP_DONE_IVB | DE_AUX_CHANNEL_A_IVB | DE_PLANEA_FLIP_DONE_IVB | DE_AUX_CHANNEL_A_IVB);
DE_ERR_INT_IVB);
extra_mask = (DE_PIPEC_VBLANK_IVB | DE_PIPEB_VBLANK_IVB | extra_mask = (DE_PIPEC_VBLANK_IVB | DE_PIPEB_VBLANK_IVB |
DE_PIPEA_VBLANK_IVB); DE_PIPEA_VBLANK_IVB | DE_ERR_INT_IVB);
I915_WRITE(GEN7_ERR_INT, I915_READ(GEN7_ERR_INT)); I915_WRITE(GEN7_ERR_INT, I915_READ(GEN7_ERR_INT));
} else { } else {
display_mask = (DE_MASTER_IRQ_CONTROL | DE_GSE | DE_PCH_EVENT | display_mask = (DE_MASTER_IRQ_CONTROL | DE_GSE | DE_PCH_EVENT |
DE_PLANEA_FLIP_DONE | DE_PLANEB_FLIP_DONE | DE_PLANEA_FLIP_DONE | DE_PLANEB_FLIP_DONE |
DE_AUX_CHANNEL_A | DE_AUX_CHANNEL_A |
DE_PIPEB_FIFO_UNDERRUN | DE_PIPEA_FIFO_UNDERRUN |
DE_PIPEB_CRC_DONE | DE_PIPEA_CRC_DONE | DE_PIPEB_CRC_DONE | DE_PIPEA_CRC_DONE |
DE_POISON); DE_POISON);
extra_mask = DE_PIPEA_VBLANK | DE_PIPEB_VBLANK | DE_PCU_EVENT; extra_mask = DE_PIPEA_VBLANK | DE_PIPEB_VBLANK | DE_PCU_EVENT |
DE_PIPEB_FIFO_UNDERRUN | DE_PIPEA_FIFO_UNDERRUN;
} }
dev_priv->irq_mask = ~display_mask; dev_priv->irq_mask = ~display_mask;
@ -3126,7 +3114,7 @@ void valleyview_disable_display_irqs(struct drm_i915_private *dev_priv)
static int valleyview_irq_postinstall(struct drm_device *dev) static int valleyview_irq_postinstall(struct drm_device *dev)
{ {
drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
unsigned long irqflags; unsigned long irqflags;
dev_priv->irq_mask = ~0; dev_priv->irq_mask = ~0;
@ -3193,9 +3181,9 @@ static void gen8_de_irq_postinstall(struct drm_i915_private *dev_priv)
struct drm_device *dev = dev_priv->dev; struct drm_device *dev = dev_priv->dev;
uint32_t de_pipe_masked = GEN8_PIPE_FLIP_DONE | uint32_t de_pipe_masked = GEN8_PIPE_FLIP_DONE |
GEN8_PIPE_CDCLK_CRC_DONE | GEN8_PIPE_CDCLK_CRC_DONE |
GEN8_PIPE_FIFO_UNDERRUN |
GEN8_DE_PIPE_IRQ_FAULT_ERRORS; GEN8_DE_PIPE_IRQ_FAULT_ERRORS;
uint32_t de_pipe_enables = de_pipe_masked | GEN8_PIPE_VBLANK; uint32_t de_pipe_enables = de_pipe_masked | GEN8_PIPE_VBLANK |
GEN8_PIPE_FIFO_UNDERRUN;
int pipe; int pipe;
dev_priv->de_irq_mask[PIPE_A] = ~de_pipe_masked; dev_priv->de_irq_mask[PIPE_A] = ~de_pipe_masked;
dev_priv->de_irq_mask[PIPE_B] = ~de_pipe_masked; dev_priv->de_irq_mask[PIPE_B] = ~de_pipe_masked;
@ -3273,7 +3261,7 @@ static void gen8_irq_uninstall(struct drm_device *dev)
static void valleyview_irq_uninstall(struct drm_device *dev) static void valleyview_irq_uninstall(struct drm_device *dev)
{ {
drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
unsigned long irqflags; unsigned long irqflags;
int pipe; int pipe;
@ -3304,7 +3292,7 @@ static void valleyview_irq_uninstall(struct drm_device *dev)
static void ironlake_irq_uninstall(struct drm_device *dev) static void ironlake_irq_uninstall(struct drm_device *dev)
{ {
drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
if (!dev_priv) if (!dev_priv)
return; return;
@ -3335,7 +3323,7 @@ static void ironlake_irq_uninstall(struct drm_device *dev)
static void i8xx_irq_preinstall(struct drm_device * dev) static void i8xx_irq_preinstall(struct drm_device * dev)
{ {
drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
int pipe; int pipe;
for_each_pipe(pipe) for_each_pipe(pipe)
@ -3347,7 +3335,7 @@ static void i8xx_irq_preinstall(struct drm_device * dev)
static int i8xx_irq_postinstall(struct drm_device *dev) static int i8xx_irq_postinstall(struct drm_device *dev)
{ {
drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
unsigned long irqflags; unsigned long irqflags;
I915_WRITE16(EMR, I915_WRITE16(EMR,
@ -3385,7 +3373,7 @@ static int i8xx_irq_postinstall(struct drm_device *dev)
static bool i8xx_handle_vblank(struct drm_device *dev, static bool i8xx_handle_vblank(struct drm_device *dev,
int plane, int pipe, u32 iir) int plane, int pipe, u32 iir)
{ {
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
u16 flip_pending = DISPLAY_PLANE_FLIP_PENDING(plane); u16 flip_pending = DISPLAY_PLANE_FLIP_PENDING(plane);
if (!drm_handle_vblank(dev, pipe)) if (!drm_handle_vblank(dev, pipe))
@ -3413,7 +3401,7 @@ static bool i8xx_handle_vblank(struct drm_device *dev,
static irqreturn_t i8xx_irq_handler(int irq, void *arg) static irqreturn_t i8xx_irq_handler(int irq, void *arg)
{ {
struct drm_device *dev = (struct drm_device *) arg; struct drm_device *dev = (struct drm_device *) arg;
drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
u16 iir, new_iir; u16 iir, new_iir;
u32 pipe_stats[2]; u32 pipe_stats[2];
unsigned long irqflags; unsigned long irqflags;
@ -3483,7 +3471,7 @@ static irqreturn_t i8xx_irq_handler(int irq, void *arg)
static void i8xx_irq_uninstall(struct drm_device * dev) static void i8xx_irq_uninstall(struct drm_device * dev)
{ {
drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
int pipe; int pipe;
for_each_pipe(pipe) { for_each_pipe(pipe) {
@ -3498,7 +3486,7 @@ static void i8xx_irq_uninstall(struct drm_device * dev)
static void i915_irq_preinstall(struct drm_device * dev) static void i915_irq_preinstall(struct drm_device * dev)
{ {
drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
int pipe; int pipe;
if (I915_HAS_HOTPLUG(dev)) { if (I915_HAS_HOTPLUG(dev)) {
@ -3516,7 +3504,7 @@ static void i915_irq_preinstall(struct drm_device * dev)
static int i915_irq_postinstall(struct drm_device *dev) static int i915_irq_postinstall(struct drm_device *dev)
{ {
drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
u32 enable_mask; u32 enable_mask;
unsigned long irqflags; unsigned long irqflags;
@ -3570,7 +3558,7 @@ static int i915_irq_postinstall(struct drm_device *dev)
static bool i915_handle_vblank(struct drm_device *dev, static bool i915_handle_vblank(struct drm_device *dev,
int plane, int pipe, u32 iir) int plane, int pipe, u32 iir)
{ {
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
u32 flip_pending = DISPLAY_PLANE_FLIP_PENDING(plane); u32 flip_pending = DISPLAY_PLANE_FLIP_PENDING(plane);
if (!drm_handle_vblank(dev, pipe)) if (!drm_handle_vblank(dev, pipe))
@ -3598,7 +3586,7 @@ static bool i915_handle_vblank(struct drm_device *dev,
static irqreturn_t i915_irq_handler(int irq, void *arg) static irqreturn_t i915_irq_handler(int irq, void *arg)
{ {
struct drm_device *dev = (struct drm_device *) arg; struct drm_device *dev = (struct drm_device *) arg;
drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
u32 iir, new_iir, pipe_stats[I915_MAX_PIPES]; u32 iir, new_iir, pipe_stats[I915_MAX_PIPES];
unsigned long irqflags; unsigned long irqflags;
u32 flip_mask = u32 flip_mask =
@ -3704,7 +3692,7 @@ static irqreturn_t i915_irq_handler(int irq, void *arg)
static void i915_irq_uninstall(struct drm_device * dev) static void i915_irq_uninstall(struct drm_device * dev)
{ {
drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
int pipe; int pipe;
intel_hpd_irq_uninstall(dev_priv); intel_hpd_irq_uninstall(dev_priv);
@ -3728,7 +3716,7 @@ static void i915_irq_uninstall(struct drm_device * dev)
static void i965_irq_preinstall(struct drm_device * dev) static void i965_irq_preinstall(struct drm_device * dev)
{ {
drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
int pipe; int pipe;
I915_WRITE(PORT_HOTPLUG_EN, 0); I915_WRITE(PORT_HOTPLUG_EN, 0);
@ -3744,7 +3732,7 @@ static void i965_irq_preinstall(struct drm_device * dev)
static int i965_irq_postinstall(struct drm_device *dev) static int i965_irq_postinstall(struct drm_device *dev)
{ {
drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
u32 enable_mask; u32 enable_mask;
u32 error_mask; u32 error_mask;
unsigned long irqflags; unsigned long irqflags;
@ -3803,7 +3791,7 @@ static int i965_irq_postinstall(struct drm_device *dev)
static void i915_hpd_irq_setup(struct drm_device *dev) static void i915_hpd_irq_setup(struct drm_device *dev)
{ {
drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct drm_mode_config *mode_config = &dev->mode_config; struct drm_mode_config *mode_config = &dev->mode_config;
struct intel_encoder *intel_encoder; struct intel_encoder *intel_encoder;
u32 hotplug_en; u32 hotplug_en;
@ -3835,7 +3823,7 @@ static void i915_hpd_irq_setup(struct drm_device *dev)
static irqreturn_t i965_irq_handler(int irq, void *arg) static irqreturn_t i965_irq_handler(int irq, void *arg)
{ {
struct drm_device *dev = (struct drm_device *) arg; struct drm_device *dev = (struct drm_device *) arg;
drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
u32 iir, new_iir; u32 iir, new_iir;
u32 pipe_stats[I915_MAX_PIPES]; u32 pipe_stats[I915_MAX_PIPES];
unsigned long irqflags; unsigned long irqflags;
@ -3953,7 +3941,7 @@ static irqreturn_t i965_irq_handler(int irq, void *arg)
static void i965_irq_uninstall(struct drm_device * dev) static void i965_irq_uninstall(struct drm_device * dev)
{ {
drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
int pipe; int pipe;
if (!dev_priv) if (!dev_priv)
@ -3978,7 +3966,7 @@ static void i965_irq_uninstall(struct drm_device * dev)
static void intel_hpd_irq_reenable(unsigned long data) static void intel_hpd_irq_reenable(unsigned long data)
{ {
drm_i915_private_t *dev_priv = (drm_i915_private_t *)data; struct drm_i915_private *dev_priv = (struct drm_i915_private *)data;
struct drm_device *dev = dev_priv->dev; struct drm_device *dev = dev_priv->dev;
struct drm_mode_config *mode_config = &dev->mode_config; struct drm_mode_config *mode_config = &dev->mode_config;
unsigned long irqflags; unsigned long irqflags;
@ -4020,6 +4008,9 @@ void intel_irq_init(struct drm_device *dev)
INIT_WORK(&dev_priv->rps.work, gen6_pm_rps_work); INIT_WORK(&dev_priv->rps.work, gen6_pm_rps_work);
INIT_WORK(&dev_priv->l3_parity.error_work, ivybridge_parity_work); INIT_WORK(&dev_priv->l3_parity.error_work, ivybridge_parity_work);
/* Let's track the enabled rps events */
dev_priv->pm_rps_events = GEN6_PM_RPS_EVENTS;
setup_timer(&dev_priv->gpu_error.hangcheck_timer, setup_timer(&dev_priv->gpu_error.hangcheck_timer,
i915_hangcheck_elapsed, i915_hangcheck_elapsed,
(unsigned long) dev); (unsigned long) dev);

View File

@ -706,6 +706,7 @@ enum punit_power_well {
#define BLT_HWS_PGA_GEN7 (0x04280) #define BLT_HWS_PGA_GEN7 (0x04280)
#define VEBOX_HWS_PGA_GEN7 (0x04380) #define VEBOX_HWS_PGA_GEN7 (0x04380)
#define RING_ACTHD(base) ((base)+0x74) #define RING_ACTHD(base) ((base)+0x74)
#define RING_ACTHD_UDW(base) ((base)+0x5c)
#define RING_NOPID(base) ((base)+0x94) #define RING_NOPID(base) ((base)+0x94)
#define RING_IMR(base) ((base)+0xa8) #define RING_IMR(base) ((base)+0xa8)
#define RING_TIMESTAMP(base) ((base)+0x358) #define RING_TIMESTAMP(base) ((base)+0x358)
@ -973,7 +974,8 @@ enum punit_power_well {
#define CACHE_MODE_0_GEN7 0x7000 /* IVB+ */ #define CACHE_MODE_0_GEN7 0x7000 /* IVB+ */
#define HIZ_RAW_STALL_OPT_DISABLE (1<<2) #define HIZ_RAW_STALL_OPT_DISABLE (1<<2)
#define CACHE_MODE_1 0x7004 /* IVB+ */ #define CACHE_MODE_1 0x7004 /* IVB+ */
#define PIXEL_SUBSPAN_COLLECT_OPT_DISABLE (1<<6) #define PIXEL_SUBSPAN_COLLECT_OPT_DISABLE (1<<6)
#define GEN8_4x4_STC_OPTIMIZATION_DISABLE (1<<6)
#define GEN6_BLITTER_ECOSKPD 0x221d0 #define GEN6_BLITTER_ECOSKPD 0x221d0
#define GEN6_BLITTER_LOCK_SHIFT 16 #define GEN6_BLITTER_LOCK_SHIFT 16

View File

@ -804,6 +804,14 @@ static const struct dmi_system_id intel_no_crt[] = {
DMI_MATCH(DMI_PRODUCT_NAME, "ZGB"), DMI_MATCH(DMI_PRODUCT_NAME, "ZGB"),
}, },
}, },
{
.callback = intel_no_crt_dmi_callback,
.ident = "DELL XPS 8700",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
DMI_MATCH(DMI_PRODUCT_NAME, "XPS 8700"),
},
},
{ } { }
}; };

View File

@ -1108,8 +1108,13 @@ bool intel_ddi_connector_get_hw_state(struct intel_connector *intel_connector)
enum port port = intel_ddi_get_encoder_port(intel_encoder); enum port port = intel_ddi_get_encoder_port(intel_encoder);
enum pipe pipe = 0; enum pipe pipe = 0;
enum transcoder cpu_transcoder; enum transcoder cpu_transcoder;
enum intel_display_power_domain power_domain;
uint32_t tmp; uint32_t tmp;
power_domain = intel_display_port_power_domain(intel_encoder);
if (!intel_display_power_enabled(dev_priv, power_domain))
return false;
if (!intel_encoder->get_hw_state(intel_encoder, &pipe)) if (!intel_encoder->get_hw_state(intel_encoder, &pipe))
return false; return false;

View File

@ -5375,21 +5375,26 @@ static void intel_set_pipe_timings(struct intel_crtc *intel_crtc)
enum transcoder cpu_transcoder = intel_crtc->config.cpu_transcoder; enum transcoder cpu_transcoder = intel_crtc->config.cpu_transcoder;
struct drm_display_mode *adjusted_mode = struct drm_display_mode *adjusted_mode =
&intel_crtc->config.adjusted_mode; &intel_crtc->config.adjusted_mode;
uint32_t vsyncshift, crtc_vtotal, crtc_vblank_end; uint32_t crtc_vtotal, crtc_vblank_end;
int vsyncshift = 0;
/* We need to be careful not to changed the adjusted mode, for otherwise /* We need to be careful not to changed the adjusted mode, for otherwise
* the hw state checker will get angry at the mismatch. */ * the hw state checker will get angry at the mismatch. */
crtc_vtotal = adjusted_mode->crtc_vtotal; crtc_vtotal = adjusted_mode->crtc_vtotal;
crtc_vblank_end = adjusted_mode->crtc_vblank_end; crtc_vblank_end = adjusted_mode->crtc_vblank_end;
if (!IS_GEN2(dev) && adjusted_mode->flags & DRM_MODE_FLAG_INTERLACE) { if (adjusted_mode->flags & DRM_MODE_FLAG_INTERLACE) {
/* the chip adds 2 halflines automatically */ /* the chip adds 2 halflines automatically */
crtc_vtotal -= 1; crtc_vtotal -= 1;
crtc_vblank_end -= 1; crtc_vblank_end -= 1;
vsyncshift = adjusted_mode->crtc_hsync_start
- adjusted_mode->crtc_htotal / 2; if (intel_pipe_has_type(&intel_crtc->base, INTEL_OUTPUT_SDVO))
} else { vsyncshift = (adjusted_mode->crtc_htotal - 1) / 2;
vsyncshift = 0; else
vsyncshift = adjusted_mode->crtc_hsync_start -
adjusted_mode->crtc_htotal / 2;
if (vsyncshift < 0)
vsyncshift += adjusted_mode->crtc_htotal;
} }
if (INTEL_INFO(dev)->gen > 3) if (INTEL_INFO(dev)->gen > 3)
@ -5539,10 +5544,13 @@ static void i9xx_set_pipeconf(struct intel_crtc *intel_crtc)
} }
} }
if (!IS_GEN2(dev) && if (intel_crtc->config.adjusted_mode.flags & DRM_MODE_FLAG_INTERLACE) {
intel_crtc->config.adjusted_mode.flags & DRM_MODE_FLAG_INTERLACE) if (INTEL_INFO(dev)->gen < 4 ||
pipeconf |= PIPECONF_INTERLACE_W_FIELD_INDICATION; intel_pipe_has_type(&intel_crtc->base, INTEL_OUTPUT_SDVO))
else pipeconf |= PIPECONF_INTERLACE_W_FIELD_INDICATION;
else
pipeconf |= PIPECONF_INTERLACE_W_SYNC_SHIFT;
} else
pipeconf |= PIPECONF_PROGRESSIVE; pipeconf |= PIPECONF_PROGRESSIVE;
if (IS_VALLEYVIEW(dev) && intel_crtc->config.limited_color_range) if (IS_VALLEYVIEW(dev) && intel_crtc->config.limited_color_range)
@ -7751,6 +7759,7 @@ static int intel_crtc_cursor_set(struct drm_crtc *crtc,
struct drm_i915_private *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct intel_crtc *intel_crtc = to_intel_crtc(crtc); struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
struct drm_i915_gem_object *obj; struct drm_i915_gem_object *obj;
unsigned old_width;
uint32_t addr; uint32_t addr;
int ret; int ret;
@ -7841,13 +7850,18 @@ static int intel_crtc_cursor_set(struct drm_crtc *crtc,
mutex_unlock(&dev->struct_mutex); mutex_unlock(&dev->struct_mutex);
old_width = intel_crtc->cursor_width;
intel_crtc->cursor_addr = addr; intel_crtc->cursor_addr = addr;
intel_crtc->cursor_bo = obj; intel_crtc->cursor_bo = obj;
intel_crtc->cursor_width = width; intel_crtc->cursor_width = width;
intel_crtc->cursor_height = height; intel_crtc->cursor_height = height;
if (intel_crtc->active) if (intel_crtc->active) {
if (old_width != width)
intel_update_watermarks(crtc);
intel_crtc_update_cursor(crtc, intel_crtc->cursor_bo != NULL); intel_crtc_update_cursor(crtc, intel_crtc->cursor_bo != NULL);
}
return 0; return 0;
fail_unpin: fail_unpin:
@ -8351,7 +8365,7 @@ struct drm_display_mode *intel_crtc_mode_get(struct drm_device *dev,
static void intel_increase_pllclock(struct drm_crtc *crtc) static void intel_increase_pllclock(struct drm_crtc *crtc)
{ {
struct drm_device *dev = crtc->dev; struct drm_device *dev = crtc->dev;
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct intel_crtc *intel_crtc = to_intel_crtc(crtc); struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
int pipe = intel_crtc->pipe; int pipe = intel_crtc->pipe;
int dpll_reg = DPLL(pipe); int dpll_reg = DPLL(pipe);
@ -8382,7 +8396,7 @@ static void intel_increase_pllclock(struct drm_crtc *crtc)
static void intel_decrease_pllclock(struct drm_crtc *crtc) static void intel_decrease_pllclock(struct drm_crtc *crtc)
{ {
struct drm_device *dev = crtc->dev; struct drm_device *dev = crtc->dev;
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct intel_crtc *intel_crtc = to_intel_crtc(crtc); struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
if (HAS_PCH_SPLIT(dev)) if (HAS_PCH_SPLIT(dev))
@ -8523,7 +8537,7 @@ static void intel_unpin_work_fn(struct work_struct *__work)
static void do_intel_finish_page_flip(struct drm_device *dev, static void do_intel_finish_page_flip(struct drm_device *dev,
struct drm_crtc *crtc) struct drm_crtc *crtc)
{ {
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct intel_crtc *intel_crtc = to_intel_crtc(crtc); struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
struct intel_unpin_work *work; struct intel_unpin_work *work;
unsigned long flags; unsigned long flags;
@ -8564,7 +8578,7 @@ static void do_intel_finish_page_flip(struct drm_device *dev,
void intel_finish_page_flip(struct drm_device *dev, int pipe) void intel_finish_page_flip(struct drm_device *dev, int pipe)
{ {
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct drm_crtc *crtc = dev_priv->pipe_to_crtc_mapping[pipe]; struct drm_crtc *crtc = dev_priv->pipe_to_crtc_mapping[pipe];
do_intel_finish_page_flip(dev, crtc); do_intel_finish_page_flip(dev, crtc);
@ -8572,7 +8586,7 @@ void intel_finish_page_flip(struct drm_device *dev, int pipe)
void intel_finish_page_flip_plane(struct drm_device *dev, int plane) void intel_finish_page_flip_plane(struct drm_device *dev, int plane)
{ {
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct drm_crtc *crtc = dev_priv->plane_to_crtc_mapping[plane]; struct drm_crtc *crtc = dev_priv->plane_to_crtc_mapping[plane];
do_intel_finish_page_flip(dev, crtc); do_intel_finish_page_flip(dev, crtc);
@ -8580,7 +8594,7 @@ void intel_finish_page_flip_plane(struct drm_device *dev, int plane)
void intel_prepare_page_flip(struct drm_device *dev, int plane) void intel_prepare_page_flip(struct drm_device *dev, int plane)
{ {
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct intel_crtc *intel_crtc = struct intel_crtc *intel_crtc =
to_intel_crtc(dev_priv->plane_to_crtc_mapping[plane]); to_intel_crtc(dev_priv->plane_to_crtc_mapping[plane]);
unsigned long flags; unsigned long flags;
@ -9755,7 +9769,7 @@ check_encoder_state(struct drm_device *dev)
static void static void
check_crtc_state(struct drm_device *dev) check_crtc_state(struct drm_device *dev)
{ {
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct intel_crtc *crtc; struct intel_crtc *crtc;
struct intel_encoder *encoder; struct intel_encoder *encoder;
struct intel_crtc_config pipe_config; struct intel_crtc_config pipe_config;
@ -9823,7 +9837,7 @@ check_crtc_state(struct drm_device *dev)
static void static void
check_shared_dpll_state(struct drm_device *dev) check_shared_dpll_state(struct drm_device *dev)
{ {
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct intel_crtc *crtc; struct intel_crtc *crtc;
struct intel_dpll_hw_state dpll_hw_state; struct intel_dpll_hw_state dpll_hw_state;
int i; int i;
@ -9896,7 +9910,7 @@ static int __intel_set_mode(struct drm_crtc *crtc,
int x, int y, struct drm_framebuffer *fb) int x, int y, struct drm_framebuffer *fb)
{ {
struct drm_device *dev = crtc->dev; struct drm_device *dev = crtc->dev;
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct drm_display_mode *saved_mode; struct drm_display_mode *saved_mode;
struct intel_crtc_config *pipe_config = NULL; struct intel_crtc_config *pipe_config = NULL;
struct intel_crtc *intel_crtc; struct intel_crtc *intel_crtc;
@ -10543,7 +10557,7 @@ static void intel_shared_dpll_init(struct drm_device *dev)
static void intel_crtc_init(struct drm_device *dev, int pipe) static void intel_crtc_init(struct drm_device *dev, int pipe)
{ {
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct intel_crtc *intel_crtc; struct intel_crtc *intel_crtc;
int i; int i;
@ -11505,6 +11519,17 @@ static void intel_sanitize_crtc(struct intel_crtc *crtc)
encoder->base.crtc = NULL; encoder->base.crtc = NULL;
} }
} }
if (crtc->active) {
/*
* We start out with underrun reporting disabled to avoid races.
* For correct bookkeeping mark this on active crtcs.
*
* No protection against concurrent access is required - at
* worst a fifo underrun happens which also sets this to false.
*/
crtc->cpu_fifo_underrun_disabled = true;
crtc->pch_fifo_underrun_disabled = true;
}
} }
static void intel_sanitize_encoder(struct intel_encoder *encoder) static void intel_sanitize_encoder(struct intel_encoder *encoder)
@ -11740,6 +11765,10 @@ void intel_modeset_gem_init(struct drm_device *dev)
struct drm_crtc *c; struct drm_crtc *c;
struct intel_framebuffer *fb; struct intel_framebuffer *fb;
mutex_lock(&dev->struct_mutex);
intel_init_gt_powersave(dev);
mutex_unlock(&dev->struct_mutex);
intel_modeset_init_hw(dev); intel_modeset_init_hw(dev);
intel_setup_overlay(dev); intel_setup_overlay(dev);
@ -11826,6 +11855,10 @@ void intel_modeset_cleanup(struct drm_device *dev)
drm_mode_config_cleanup(dev); drm_mode_config_cleanup(dev);
intel_cleanup_overlay(dev); intel_cleanup_overlay(dev);
mutex_lock(&dev->struct_mutex);
intel_cleanup_gt_powersave(dev);
mutex_unlock(&dev->struct_mutex);
} }
/* /*
@ -11920,7 +11953,7 @@ struct intel_display_error_state {
struct intel_display_error_state * struct intel_display_error_state *
intel_display_capture_error_state(struct drm_device *dev) intel_display_capture_error_state(struct drm_device *dev)
{ {
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct intel_display_error_state *error; struct intel_display_error_state *error;
int transcoders[] = { int transcoders[] = {
TRANSCODER_A, TRANSCODER_A,

View File

@ -314,7 +314,8 @@ static bool edp_have_panel_vdd(struct intel_dp *intel_dp)
struct drm_device *dev = intel_dp_to_dev(intel_dp); struct drm_device *dev = intel_dp_to_dev(intel_dp);
struct drm_i915_private *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
return (I915_READ(_pp_ctrl_reg(intel_dp)) & EDP_FORCE_VDD) != 0; return !dev_priv->pm.suspended &&
(I915_READ(_pp_ctrl_reg(intel_dp)) & EDP_FORCE_VDD) != 0;
} }
static void static void
@ -1621,7 +1622,7 @@ static void intel_edp_psr_enable_source(struct intel_dp *intel_dp)
val |= EDP_PSR_LINK_DISABLE; val |= EDP_PSR_LINK_DISABLE;
I915_WRITE(EDP_PSR_CTL(dev), val | I915_WRITE(EDP_PSR_CTL(dev), val |
IS_BROADWELL(dev) ? 0 : link_entry_time | (IS_BROADWELL(dev) ? 0 : link_entry_time) |
max_sleep_time << EDP_PSR_MAX_SLEEP_TIME_SHIFT | max_sleep_time << EDP_PSR_MAX_SLEEP_TIME_SHIFT |
idle_frames << EDP_PSR_IDLE_FRAME_SHIFT | idle_frames << EDP_PSR_IDLE_FRAME_SHIFT |
EDP_PSR_ENABLE); EDP_PSR_ENABLE);

View File

@ -897,6 +897,8 @@ void intel_display_power_get(struct drm_i915_private *dev_priv,
void intel_display_power_put(struct drm_i915_private *dev_priv, void intel_display_power_put(struct drm_i915_private *dev_priv,
enum intel_display_power_domain domain); enum intel_display_power_domain domain);
void intel_power_domains_init_hw(struct drm_i915_private *dev_priv); void intel_power_domains_init_hw(struct drm_i915_private *dev_priv);
void intel_init_gt_powersave(struct drm_device *dev);
void intel_cleanup_gt_powersave(struct drm_device *dev);
void intel_enable_gt_powersave(struct drm_device *dev); void intel_enable_gt_powersave(struct drm_device *dev);
void intel_disable_gt_powersave(struct drm_device *dev); void intel_disable_gt_powersave(struct drm_device *dev);
void ironlake_teardown_rc6(struct drm_device *dev); void ironlake_teardown_rc6(struct drm_device *dev);

View File

@ -518,16 +518,29 @@ static bool intel_fbdev_init_bios(struct drm_device *dev,
/* /*
* See if the plane fb we found above will fit on this * See if the plane fb we found above will fit on this
* pipe. Note we need to use the selected fb's bpp rather * pipe. Note we need to use the selected fb's pitch and bpp
* than the current pipe's, since they could be different. * rather than the current pipe's, since they differ.
*/ */
cur_size = intel_crtc->config.adjusted_mode.crtc_hdisplay * cur_size = intel_crtc->config.adjusted_mode.crtc_hdisplay;
intel_crtc->config.adjusted_mode.crtc_vdisplay; cur_size = cur_size * fb->base.bits_per_pixel / 8;
DRM_DEBUG_KMS("pipe %c area: %d\n", pipe_name(intel_crtc->pipe), if (fb->base.pitches[0] < cur_size) {
DRM_DEBUG_KMS("fb not wide enough for plane %c (%d vs %d)\n",
pipe_name(intel_crtc->pipe),
cur_size, fb->base.pitches[0]);
plane_config = NULL;
fb = NULL;
break;
}
cur_size = intel_crtc->config.adjusted_mode.crtc_vdisplay;
cur_size = ALIGN(cur_size, plane_config->tiled ? (IS_GEN2(dev) ? 16 : 8) : 1);
cur_size *= fb->base.pitches[0];
DRM_DEBUG_KMS("pipe %c area: %dx%d, bpp: %d, size: %d\n",
pipe_name(intel_crtc->pipe),
intel_crtc->config.adjusted_mode.crtc_hdisplay,
intel_crtc->config.adjusted_mode.crtc_vdisplay,
fb->base.bits_per_pixel,
cur_size); cur_size);
cur_size *= fb->base.bits_per_pixel / 8;
DRM_DEBUG_KMS("total size %d (bpp %d)\n", cur_size,
fb->base.bits_per_pixel / 8);
if (cur_size > max_size) { if (cur_size > max_size) {
DRM_DEBUG_KMS("fb not big enough for plane %c (%d vs %d)\n", DRM_DEBUG_KMS("fb not big enough for plane %c (%d vs %d)\n",

View File

@ -189,7 +189,7 @@ struct intel_overlay {
static struct overlay_registers __iomem * static struct overlay_registers __iomem *
intel_overlay_map_regs(struct intel_overlay *overlay) intel_overlay_map_regs(struct intel_overlay *overlay)
{ {
drm_i915_private_t *dev_priv = overlay->dev->dev_private; struct drm_i915_private *dev_priv = overlay->dev->dev_private;
struct overlay_registers __iomem *regs; struct overlay_registers __iomem *regs;
if (OVERLAY_NEEDS_PHYSICAL(overlay->dev)) if (OVERLAY_NEEDS_PHYSICAL(overlay->dev))
@ -212,7 +212,7 @@ static int intel_overlay_do_wait_request(struct intel_overlay *overlay,
void (*tail)(struct intel_overlay *)) void (*tail)(struct intel_overlay *))
{ {
struct drm_device *dev = overlay->dev; struct drm_device *dev = overlay->dev;
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct intel_ring_buffer *ring = &dev_priv->ring[RCS]; struct intel_ring_buffer *ring = &dev_priv->ring[RCS];
int ret; int ret;
@ -262,7 +262,7 @@ static int intel_overlay_continue(struct intel_overlay *overlay,
bool load_polyphase_filter) bool load_polyphase_filter)
{ {
struct drm_device *dev = overlay->dev; struct drm_device *dev = overlay->dev;
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct intel_ring_buffer *ring = &dev_priv->ring[RCS]; struct intel_ring_buffer *ring = &dev_priv->ring[RCS];
u32 flip_addr = overlay->flip_addr; u32 flip_addr = overlay->flip_addr;
u32 tmp; u32 tmp;
@ -362,7 +362,7 @@ static int intel_overlay_off(struct intel_overlay *overlay)
static int intel_overlay_recover_from_interrupt(struct intel_overlay *overlay) static int intel_overlay_recover_from_interrupt(struct intel_overlay *overlay)
{ {
struct drm_device *dev = overlay->dev; struct drm_device *dev = overlay->dev;
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct intel_ring_buffer *ring = &dev_priv->ring[RCS]; struct intel_ring_buffer *ring = &dev_priv->ring[RCS];
int ret; int ret;
@ -388,7 +388,7 @@ static int intel_overlay_recover_from_interrupt(struct intel_overlay *overlay)
static int intel_overlay_release_old_vid(struct intel_overlay *overlay) static int intel_overlay_release_old_vid(struct intel_overlay *overlay)
{ {
struct drm_device *dev = overlay->dev; struct drm_device *dev = overlay->dev;
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct intel_ring_buffer *ring = &dev_priv->ring[RCS]; struct intel_ring_buffer *ring = &dev_priv->ring[RCS];
int ret; int ret;
@ -834,7 +834,7 @@ static int check_overlay_possible_on_crtc(struct intel_overlay *overlay,
static void update_pfit_vscale_ratio(struct intel_overlay *overlay) static void update_pfit_vscale_ratio(struct intel_overlay *overlay)
{ {
struct drm_device *dev = overlay->dev; struct drm_device *dev = overlay->dev;
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
u32 pfit_control = I915_READ(PFIT_CONTROL); u32 pfit_control = I915_READ(PFIT_CONTROL);
u32 ratio; u32 ratio;
@ -1026,7 +1026,7 @@ int intel_overlay_put_image(struct drm_device *dev, void *data,
struct drm_file *file_priv) struct drm_file *file_priv)
{ {
struct drm_intel_overlay_put_image *put_image_rec = data; struct drm_intel_overlay_put_image *put_image_rec = data;
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct intel_overlay *overlay; struct intel_overlay *overlay;
struct drm_mode_object *drmmode_obj; struct drm_mode_object *drmmode_obj;
struct intel_crtc *crtc; struct intel_crtc *crtc;
@ -1226,7 +1226,7 @@ int intel_overlay_attrs(struct drm_device *dev, void *data,
struct drm_file *file_priv) struct drm_file *file_priv)
{ {
struct drm_intel_overlay_attrs *attrs = data; struct drm_intel_overlay_attrs *attrs = data;
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct intel_overlay *overlay; struct intel_overlay *overlay;
struct overlay_registers __iomem *regs; struct overlay_registers __iomem *regs;
int ret; int ret;
@ -1311,7 +1311,7 @@ out_unlock:
void intel_setup_overlay(struct drm_device *dev) void intel_setup_overlay(struct drm_device *dev)
{ {
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct intel_overlay *overlay; struct intel_overlay *overlay;
struct drm_i915_gem_object *reg_bo; struct drm_i915_gem_object *reg_bo;
struct overlay_registers __iomem *regs; struct overlay_registers __iomem *regs;
@ -1397,7 +1397,7 @@ out_free:
void intel_cleanup_overlay(struct drm_device *dev) void intel_cleanup_overlay(struct drm_device *dev)
{ {
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
if (!dev_priv->overlay) if (!dev_priv->overlay)
return; return;
@ -1421,7 +1421,7 @@ struct intel_overlay_error_state {
static struct overlay_registers __iomem * static struct overlay_registers __iomem *
intel_overlay_map_regs_atomic(struct intel_overlay *overlay) intel_overlay_map_regs_atomic(struct intel_overlay *overlay)
{ {
drm_i915_private_t *dev_priv = overlay->dev->dev_private; struct drm_i915_private *dev_priv = overlay->dev->dev_private;
struct overlay_registers __iomem *regs; struct overlay_registers __iomem *regs;
if (OVERLAY_NEEDS_PHYSICAL(overlay->dev)) if (OVERLAY_NEEDS_PHYSICAL(overlay->dev))
@ -1447,7 +1447,7 @@ static void intel_overlay_unmap_regs_atomic(struct intel_overlay *overlay,
struct intel_overlay_error_state * struct intel_overlay_error_state *
intel_overlay_capture_error_state(struct drm_device *dev) intel_overlay_capture_error_state(struct drm_device *dev)
{ {
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct intel_overlay *overlay = dev_priv->overlay; struct intel_overlay *overlay = dev_priv->overlay;
struct intel_overlay_error_state *error; struct intel_overlay_error_state *error;
struct overlay_registers __iomem *regs; struct overlay_registers __iomem *regs;

View File

@ -623,7 +623,7 @@ out_disable:
static void i915_pineview_get_mem_freq(struct drm_device *dev) static void i915_pineview_get_mem_freq(struct drm_device *dev)
{ {
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
u32 tmp; u32 tmp;
tmp = I915_READ(CLKCFG); tmp = I915_READ(CLKCFG);
@ -662,7 +662,7 @@ static void i915_pineview_get_mem_freq(struct drm_device *dev)
static void i915_ironlake_get_mem_freq(struct drm_device *dev) static void i915_ironlake_get_mem_freq(struct drm_device *dev)
{ {
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
u16 ddrpll, csipll; u16 ddrpll, csipll;
ddrpll = I915_READ16(DDRMPLL1); ddrpll = I915_READ16(DDRMPLL1);
@ -1136,7 +1136,7 @@ static bool g4x_compute_wm0(struct drm_device *dev,
/* Use the large buffer method to calculate cursor watermark */ /* Use the large buffer method to calculate cursor watermark */
line_time_us = max(htotal * 1000 / clock, 1); line_time_us = max(htotal * 1000 / clock, 1);
line_count = (cursor_latency_ns / line_time_us + 1000) / 1000; line_count = (cursor_latency_ns / line_time_us + 1000) / 1000;
entries = line_count * 64 * pixel_size; entries = line_count * to_intel_crtc(crtc)->cursor_width * pixel_size;
tlb_miss = cursor->fifo_size*cursor->cacheline_size - hdisplay * 8; tlb_miss = cursor->fifo_size*cursor->cacheline_size - hdisplay * 8;
if (tlb_miss > 0) if (tlb_miss > 0)
entries += tlb_miss; entries += tlb_miss;
@ -1222,7 +1222,7 @@ static bool g4x_compute_srwm(struct drm_device *dev,
*display_wm = entries + display->guard_size; *display_wm = entries + display->guard_size;
/* calculate the self-refresh watermark for display cursor */ /* calculate the self-refresh watermark for display cursor */
entries = line_count * pixel_size * 64; entries = line_count * pixel_size * to_intel_crtc(crtc)->cursor_width;
entries = DIV_ROUND_UP(entries, cursor->cacheline_size); entries = DIV_ROUND_UP(entries, cursor->cacheline_size);
*cursor_wm = entries + cursor->guard_size; *cursor_wm = entries + cursor->guard_size;
@ -1457,7 +1457,7 @@ static void i965_update_wm(struct drm_crtc *unused_crtc)
entries, srwm); entries, srwm);
entries = (((sr_latency_ns / line_time_us) + 1000) / 1000) * entries = (((sr_latency_ns / line_time_us) + 1000) / 1000) *
pixel_size * 64; pixel_size * to_intel_crtc(crtc)->cursor_width;
entries = DIV_ROUND_UP(entries, entries = DIV_ROUND_UP(entries,
i965_cursor_wm_info.cacheline_size); i965_cursor_wm_info.cacheline_size);
cursor_sr = i965_cursor_wm_info.fifo_size - cursor_sr = i965_cursor_wm_info.fifo_size -
@ -2120,7 +2120,7 @@ static void ilk_compute_wm_parameters(struct drm_crtc *crtc,
p->pri.bytes_per_pixel = crtc->primary->fb->bits_per_pixel / 8; p->pri.bytes_per_pixel = crtc->primary->fb->bits_per_pixel / 8;
p->cur.bytes_per_pixel = 4; p->cur.bytes_per_pixel = 4;
p->pri.horiz_pixels = intel_crtc->config.pipe_src_w; p->pri.horiz_pixels = intel_crtc->config.pipe_src_w;
p->cur.horiz_pixels = 64; p->cur.horiz_pixels = intel_crtc->cursor_width;
/* TODO: for now, assume primary and cursor planes are always enabled. */ /* TODO: for now, assume primary and cursor planes are always enabled. */
p->pri.enabled = true; p->pri.enabled = true;
p->cur.enabled = true; p->cur.enabled = true;
@ -3006,6 +3006,24 @@ static void gen6_set_rps_thresholds(struct drm_i915_private *dev_priv, u8 val)
dev_priv->rps.last_adj = 0; dev_priv->rps.last_adj = 0;
} }
static u32 gen6_rps_pm_mask(struct drm_i915_private *dev_priv, u8 val)
{
u32 mask = 0;
if (val > dev_priv->rps.min_freq_softlimit)
mask |= GEN6_PM_RP_DOWN_THRESHOLD | GEN6_PM_RP_DOWN_TIMEOUT;
if (val < dev_priv->rps.max_freq_softlimit)
mask |= GEN6_PM_RP_UP_THRESHOLD;
/* IVB and SNB hard hangs on looping batchbuffer
* if GEN6_PM_UP_EI_EXPIRED is masked.
*/
if (INTEL_INFO(dev_priv->dev)->gen <= 7 && !IS_HASWELL(dev_priv->dev))
mask |= GEN6_PM_RP_UP_EI_EXPIRED;
return ~mask;
}
/* gen6_set_rps is called to update the frequency request, but should also be /* gen6_set_rps is called to update the frequency request, but should also be
* called when the range (min_delay and max_delay) is modified so that we can * called when the range (min_delay and max_delay) is modified so that we can
* update the GEN6_RP_INTERRUPT_LIMITS register accordingly. */ * update the GEN6_RP_INTERRUPT_LIMITS register accordingly. */
@ -3017,36 +3035,31 @@ void gen6_set_rps(struct drm_device *dev, u8 val)
WARN_ON(val > dev_priv->rps.max_freq_softlimit); WARN_ON(val > dev_priv->rps.max_freq_softlimit);
WARN_ON(val < dev_priv->rps.min_freq_softlimit); WARN_ON(val < dev_priv->rps.min_freq_softlimit);
if (val == dev_priv->rps.cur_freq) { /* min/max delay may still have been modified so be sure to
/* min/max delay may still have been modified so be sure to * write the limits value.
* write the limits value */ */
I915_WRITE(GEN6_RP_INTERRUPT_LIMITS, if (val != dev_priv->rps.cur_freq) {
gen6_rps_limits(dev_priv, val)); gen6_set_rps_thresholds(dev_priv, val);
return; if (IS_HASWELL(dev))
I915_WRITE(GEN6_RPNSWREQ,
HSW_FREQUENCY(val));
else
I915_WRITE(GEN6_RPNSWREQ,
GEN6_FREQUENCY(val) |
GEN6_OFFSET(0) |
GEN6_AGGRESSIVE_TURBO);
} }
gen6_set_rps_thresholds(dev_priv, val);
if (IS_HASWELL(dev))
I915_WRITE(GEN6_RPNSWREQ,
HSW_FREQUENCY(val));
else
I915_WRITE(GEN6_RPNSWREQ,
GEN6_FREQUENCY(val) |
GEN6_OFFSET(0) |
GEN6_AGGRESSIVE_TURBO);
/* Make sure we continue to get interrupts /* Make sure we continue to get interrupts
* until we hit the minimum or maximum frequencies. * until we hit the minimum or maximum frequencies.
*/ */
I915_WRITE(GEN6_RP_INTERRUPT_LIMITS, I915_WRITE(GEN6_RP_INTERRUPT_LIMITS, gen6_rps_limits(dev_priv, val));
gen6_rps_limits(dev_priv, val)); I915_WRITE(GEN6_PMINTRMSK, gen6_rps_pm_mask(dev_priv, val));
POSTING_READ(GEN6_RPNSWREQ); POSTING_READ(GEN6_RPNSWREQ);
dev_priv->rps.cur_freq = val; dev_priv->rps.cur_freq = val;
trace_intel_gpu_freq_change(val * 50); trace_intel_gpu_freq_change(val * 50);
} }
@ -3096,10 +3109,8 @@ static void vlv_set_rps_idle(struct drm_i915_private *dev_priv)
I915_READ(VLV_GTLC_SURVIVABILITY_REG) & I915_READ(VLV_GTLC_SURVIVABILITY_REG) &
~VLV_GFX_CLK_FORCE_ON_BIT); ~VLV_GFX_CLK_FORCE_ON_BIT);
/* Unmask Up interrupts */ I915_WRITE(GEN6_PMINTRMSK,
dev_priv->rps.rp_up_masked = true; gen6_rps_pm_mask(dev_priv, dev_priv->rps.cur_freq));
gen6_set_pm_mask(dev_priv, GEN6_PM_RP_DOWN_THRESHOLD,
dev_priv->rps.min_freq_softlimit);
} }
void gen6_rps_idle(struct drm_i915_private *dev_priv) void gen6_rps_idle(struct drm_i915_private *dev_priv)
@ -3145,13 +3156,12 @@ void valleyview_set_rps(struct drm_device *dev, u8 val)
dev_priv->rps.cur_freq, dev_priv->rps.cur_freq,
vlv_gpu_freq(dev_priv, val), val); vlv_gpu_freq(dev_priv, val), val);
if (val == dev_priv->rps.cur_freq) if (val != dev_priv->rps.cur_freq)
return; vlv_punit_write(dev_priv, PUNIT_REG_GPU_FREQ_REQ, val);
vlv_punit_write(dev_priv, PUNIT_REG_GPU_FREQ_REQ, val); I915_WRITE(GEN6_PMINTRMSK, gen6_rps_pm_mask(dev_priv, val));
dev_priv->rps.cur_freq = val; dev_priv->rps.cur_freq = val;
trace_intel_gpu_freq_change(vlv_gpu_freq(dev_priv, val)); trace_intel_gpu_freq_change(vlv_gpu_freq(dev_priv, val));
} }
@ -3160,7 +3170,8 @@ static void gen6_disable_rps_interrupts(struct drm_device *dev)
struct drm_i915_private *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
I915_WRITE(GEN6_PMINTRMSK, 0xffffffff); I915_WRITE(GEN6_PMINTRMSK, 0xffffffff);
I915_WRITE(GEN6_PMIER, I915_READ(GEN6_PMIER) & ~GEN6_PM_RPS_EVENTS); I915_WRITE(GEN6_PMIER, I915_READ(GEN6_PMIER) &
~dev_priv->pm_rps_events);
/* Complete PM interrupt masking here doesn't race with the rps work /* Complete PM interrupt masking here doesn't race with the rps work
* item again unmasking PM interrupts because that is using a different * item again unmasking PM interrupts because that is using a different
* register (PMIMR) to mask PM interrupts. The only risk is in leaving * register (PMIMR) to mask PM interrupts. The only risk is in leaving
@ -3170,7 +3181,7 @@ static void gen6_disable_rps_interrupts(struct drm_device *dev)
dev_priv->rps.pm_iir = 0; dev_priv->rps.pm_iir = 0;
spin_unlock_irq(&dev_priv->irq_lock); spin_unlock_irq(&dev_priv->irq_lock);
I915_WRITE(GEN6_PMIIR, GEN6_PM_RPS_EVENTS); I915_WRITE(GEN6_PMIIR, dev_priv->pm_rps_events);
} }
static void gen6_disable_rps(struct drm_device *dev) static void gen6_disable_rps(struct drm_device *dev)
@ -3190,11 +3201,6 @@ static void valleyview_disable_rps(struct drm_device *dev)
I915_WRITE(GEN6_RC_CONTROL, 0); I915_WRITE(GEN6_RC_CONTROL, 0);
gen6_disable_rps_interrupts(dev); gen6_disable_rps_interrupts(dev);
if (dev_priv->vlv_pctx) {
drm_gem_object_unreference(&dev_priv->vlv_pctx->base);
dev_priv->vlv_pctx = NULL;
}
} }
static void intel_print_rc6_info(struct drm_device *dev, u32 mode) static void intel_print_rc6_info(struct drm_device *dev, u32 mode)
@ -3228,24 +3234,12 @@ int intel_enable_rc6(const struct drm_device *dev)
static void gen6_enable_rps_interrupts(struct drm_device *dev) static void gen6_enable_rps_interrupts(struct drm_device *dev)
{ {
struct drm_i915_private *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
u32 enabled_intrs;
spin_lock_irq(&dev_priv->irq_lock); spin_lock_irq(&dev_priv->irq_lock);
WARN_ON(dev_priv->rps.pm_iir); WARN_ON(dev_priv->rps.pm_iir);
snb_enable_pm_irq(dev_priv, GEN6_PM_RPS_EVENTS); snb_enable_pm_irq(dev_priv, dev_priv->pm_rps_events);
I915_WRITE(GEN6_PMIIR, GEN6_PM_RPS_EVENTS); I915_WRITE(GEN6_PMIIR, dev_priv->pm_rps_events);
spin_unlock_irq(&dev_priv->irq_lock); spin_unlock_irq(&dev_priv->irq_lock);
/* only unmask PM interrupts we need. Mask all others. */
enabled_intrs = GEN6_PM_RPS_EVENTS;
/* IVB and SNB hard hangs on looping batchbuffer
* if GEN6_PM_UP_EI_EXPIRED is masked.
*/
if (INTEL_INFO(dev)->gen <= 7 && !IS_HASWELL(dev))
enabled_intrs |= GEN6_PM_RP_UP_EI_EXPIRED;
I915_WRITE(GEN6_PMINTRMSK, ~enabled_intrs);
} }
static void gen8_enable_rps(struct drm_device *dev) static void gen8_enable_rps(struct drm_device *dev)
@ -3550,6 +3544,15 @@ int valleyview_rps_min_freq(struct drm_i915_private *dev_priv)
return vlv_punit_read(dev_priv, PUNIT_REG_GPU_LFM) & 0xff; return vlv_punit_read(dev_priv, PUNIT_REG_GPU_LFM) & 0xff;
} }
/* Check that the pctx buffer wasn't move under us. */
static void valleyview_check_pctx(struct drm_i915_private *dev_priv)
{
unsigned long pctx_addr = I915_READ(VLV_PCBR) & ~4095;
WARN_ON(pctx_addr != dev_priv->mm.stolen_base +
dev_priv->vlv_pctx->stolen->start);
}
static void valleyview_setup_pctx(struct drm_device *dev) static void valleyview_setup_pctx(struct drm_device *dev)
{ {
struct drm_i915_private *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
@ -3594,6 +3597,17 @@ out:
dev_priv->vlv_pctx = pctx; dev_priv->vlv_pctx = pctx;
} }
static void valleyview_cleanup_pctx(struct drm_device *dev)
{
struct drm_i915_private *dev_priv = dev->dev_private;
if (WARN_ON(!dev_priv->vlv_pctx))
return;
drm_gem_object_unreference(&dev_priv->vlv_pctx->base);
dev_priv->vlv_pctx = NULL;
}
static void valleyview_enable_rps(struct drm_device *dev) static void valleyview_enable_rps(struct drm_device *dev)
{ {
struct drm_i915_private *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
@ -3603,6 +3617,8 @@ static void valleyview_enable_rps(struct drm_device *dev)
WARN_ON(!mutex_is_locked(&dev_priv->rps.hw_lock)); WARN_ON(!mutex_is_locked(&dev_priv->rps.hw_lock));
valleyview_check_pctx(dev_priv);
if ((gtfifodbg = I915_READ(GTFIFODBG))) { if ((gtfifodbg = I915_READ(GTFIFODBG))) {
DRM_DEBUG_DRIVER("GT fifo had a previous error %x\n", DRM_DEBUG_DRIVER("GT fifo had a previous error %x\n",
gtfifodbg); gtfifodbg);
@ -3687,9 +3703,6 @@ static void valleyview_enable_rps(struct drm_device *dev)
valleyview_set_rps(dev_priv->dev, dev_priv->rps.efficient_freq); valleyview_set_rps(dev_priv->dev, dev_priv->rps.efficient_freq);
dev_priv->rps.rp_up_masked = false;
dev_priv->rps.rp_down_masked = false;
gen6_enable_rps_interrupts(dev); gen6_enable_rps_interrupts(dev);
gen6_gt_force_wake_put(dev_priv, FORCEWAKE_ALL); gen6_gt_force_wake_put(dev_priv, FORCEWAKE_ALL);
@ -4422,6 +4435,18 @@ static void intel_init_emon(struct drm_device *dev)
dev_priv->ips.corr = (lcfuse & LCFUSE_HIV_MASK); dev_priv->ips.corr = (lcfuse & LCFUSE_HIV_MASK);
} }
void intel_init_gt_powersave(struct drm_device *dev)
{
if (IS_VALLEYVIEW(dev))
valleyview_setup_pctx(dev);
}
void intel_cleanup_gt_powersave(struct drm_device *dev)
{
if (IS_VALLEYVIEW(dev))
valleyview_cleanup_pctx(dev);
}
void intel_disable_gt_powersave(struct drm_device *dev) void intel_disable_gt_powersave(struct drm_device *dev)
{ {
struct drm_i915_private *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
@ -4476,8 +4501,6 @@ void intel_enable_gt_powersave(struct drm_device *dev)
ironlake_enable_rc6(dev); ironlake_enable_rc6(dev);
intel_init_emon(dev); intel_init_emon(dev);
} else if (IS_GEN6(dev) || IS_GEN7(dev)) { } else if (IS_GEN6(dev) || IS_GEN7(dev)) {
if (IS_VALLEYVIEW(dev))
valleyview_setup_pctx(dev);
/* /*
* PCU communication is slow and this doesn't need to be * PCU communication is slow and this doesn't need to be
* done at any specific time, so do this out of our fast path * done at any specific time, so do this out of our fast path
@ -4881,6 +4904,10 @@ static void gen8_init_clock_gating(struct drm_device *dev)
/* WaDisableSDEUnitClockGating:bdw */ /* WaDisableSDEUnitClockGating:bdw */
I915_WRITE(GEN8_UCGCTL6, I915_READ(GEN8_UCGCTL6) | I915_WRITE(GEN8_UCGCTL6, I915_READ(GEN8_UCGCTL6) |
GEN8_SDEUNIT_CLOCK_GATE_DISABLE); GEN8_SDEUNIT_CLOCK_GATE_DISABLE);
/* Wa4x4STCOptimizationDisable:bdw */
I915_WRITE(CACHE_MODE_1,
_MASKED_BIT_ENABLE(GEN8_4x4_STC_OPTIMIZATION_DISABLE));
} }
static void haswell_init_clock_gating(struct drm_device *dev) static void haswell_init_clock_gating(struct drm_device *dev)
@ -5037,13 +5064,11 @@ static void valleyview_init_clock_gating(struct drm_device *dev)
mutex_unlock(&dev_priv->rps.hw_lock); mutex_unlock(&dev_priv->rps.hw_lock);
switch ((val >> 6) & 3) { switch ((val >> 6) & 3) {
case 0: case 0:
case 1:
dev_priv->mem_freq = 800; dev_priv->mem_freq = 800;
break; break;
case 1:
dev_priv->mem_freq = 1066;
break;
case 2: case 2:
dev_priv->mem_freq = 1333; dev_priv->mem_freq = 1066;
break; break;
case 3: case 3:
dev_priv->mem_freq = 1333; dev_priv->mem_freq = 1333;
@ -5253,6 +5278,9 @@ bool intel_display_power_enabled(struct drm_i915_private *dev_priv,
bool is_enabled; bool is_enabled;
int i; int i;
if (dev_priv->pm.suspended)
return false;
power_domains = &dev_priv->power_domains; power_domains = &dev_priv->power_domains;
is_enabled = true; is_enabled = true;

View File

@ -406,17 +406,24 @@ gen8_render_ring_flush(struct intel_ring_buffer *ring,
static void ring_write_tail(struct intel_ring_buffer *ring, static void ring_write_tail(struct intel_ring_buffer *ring,
u32 value) u32 value)
{ {
drm_i915_private_t *dev_priv = ring->dev->dev_private; struct drm_i915_private *dev_priv = ring->dev->dev_private;
I915_WRITE_TAIL(ring, value); I915_WRITE_TAIL(ring, value);
} }
u32 intel_ring_get_active_head(struct intel_ring_buffer *ring) u64 intel_ring_get_active_head(struct intel_ring_buffer *ring)
{ {
drm_i915_private_t *dev_priv = ring->dev->dev_private; struct drm_i915_private *dev_priv = ring->dev->dev_private;
u32 acthd_reg = INTEL_INFO(ring->dev)->gen >= 4 ? u64 acthd;
RING_ACTHD(ring->mmio_base) : ACTHD;
return I915_READ(acthd_reg); if (INTEL_INFO(ring->dev)->gen >= 8)
acthd = I915_READ64_2x32(RING_ACTHD(ring->mmio_base),
RING_ACTHD_UDW(ring->mmio_base));
else if (INTEL_INFO(ring->dev)->gen >= 4)
acthd = I915_READ(RING_ACTHD(ring->mmio_base));
else
acthd = I915_READ(ACTHD);
return acthd;
} }
static void ring_setup_phys_status_page(struct intel_ring_buffer *ring) static void ring_setup_phys_status_page(struct intel_ring_buffer *ring)
@ -433,7 +440,7 @@ static void ring_setup_phys_status_page(struct intel_ring_buffer *ring)
static int init_ring_common(struct intel_ring_buffer *ring) static int init_ring_common(struct intel_ring_buffer *ring)
{ {
struct drm_device *dev = ring->dev; struct drm_device *dev = ring->dev;
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct drm_i915_gem_object *obj = ring->obj; struct drm_i915_gem_object *obj = ring->obj;
int ret = 0; int ret = 0;
u32 head; u32 head;
@ -566,7 +573,8 @@ static int init_render_ring(struct intel_ring_buffer *ring)
struct drm_i915_private *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
int ret = init_ring_common(ring); int ret = init_ring_common(ring);
if (INTEL_INFO(dev)->gen > 3) /* WaTimedSingleVertexDispatch:cl,bw,ctg,elk,ilk,snb */
if (INTEL_INFO(dev)->gen >= 4 && INTEL_INFO(dev)->gen < 7)
I915_WRITE(MI_MODE, _MASKED_BIT_ENABLE(VS_TIMER_DISPATCH)); I915_WRITE(MI_MODE, _MASKED_BIT_ENABLE(VS_TIMER_DISPATCH));
/* We need to disable the AsyncFlip performance optimisations in order /* We need to disable the AsyncFlip performance optimisations in order
@ -813,8 +821,11 @@ gen6_ring_get_seqno(struct intel_ring_buffer *ring, bool lazy_coherency)
/* Workaround to force correct ordering between irq and seqno writes on /* Workaround to force correct ordering between irq and seqno writes on
* ivb (and maybe also on snb) by reading from a CS register (like * ivb (and maybe also on snb) by reading from a CS register (like
* ACTHD) before reading the status page. */ * ACTHD) before reading the status page. */
if (!lazy_coherency) if (!lazy_coherency) {
intel_ring_get_active_head(ring); struct drm_i915_private *dev_priv = ring->dev->dev_private;
POSTING_READ(RING_ACTHD(ring->mmio_base));
}
return intel_read_status_page(ring, I915_GEM_HWS_INDEX); return intel_read_status_page(ring, I915_GEM_HWS_INDEX);
} }
@ -846,7 +857,7 @@ static bool
gen5_ring_get_irq(struct intel_ring_buffer *ring) gen5_ring_get_irq(struct intel_ring_buffer *ring)
{ {
struct drm_device *dev = ring->dev; struct drm_device *dev = ring->dev;
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
unsigned long flags; unsigned long flags;
if (!dev->irq_enabled) if (!dev->irq_enabled)
@ -864,7 +875,7 @@ static void
gen5_ring_put_irq(struct intel_ring_buffer *ring) gen5_ring_put_irq(struct intel_ring_buffer *ring)
{ {
struct drm_device *dev = ring->dev; struct drm_device *dev = ring->dev;
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&dev_priv->irq_lock, flags); spin_lock_irqsave(&dev_priv->irq_lock, flags);
@ -877,7 +888,7 @@ static bool
i9xx_ring_get_irq(struct intel_ring_buffer *ring) i9xx_ring_get_irq(struct intel_ring_buffer *ring)
{ {
struct drm_device *dev = ring->dev; struct drm_device *dev = ring->dev;
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
unsigned long flags; unsigned long flags;
if (!dev->irq_enabled) if (!dev->irq_enabled)
@ -898,7 +909,7 @@ static void
i9xx_ring_put_irq(struct intel_ring_buffer *ring) i9xx_ring_put_irq(struct intel_ring_buffer *ring)
{ {
struct drm_device *dev = ring->dev; struct drm_device *dev = ring->dev;
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&dev_priv->irq_lock, flags); spin_lock_irqsave(&dev_priv->irq_lock, flags);
@ -914,7 +925,7 @@ static bool
i8xx_ring_get_irq(struct intel_ring_buffer *ring) i8xx_ring_get_irq(struct intel_ring_buffer *ring)
{ {
struct drm_device *dev = ring->dev; struct drm_device *dev = ring->dev;
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
unsigned long flags; unsigned long flags;
if (!dev->irq_enabled) if (!dev->irq_enabled)
@ -935,7 +946,7 @@ static void
i8xx_ring_put_irq(struct intel_ring_buffer *ring) i8xx_ring_put_irq(struct intel_ring_buffer *ring)
{ {
struct drm_device *dev = ring->dev; struct drm_device *dev = ring->dev;
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&dev_priv->irq_lock, flags); spin_lock_irqsave(&dev_priv->irq_lock, flags);
@ -950,7 +961,7 @@ i8xx_ring_put_irq(struct intel_ring_buffer *ring)
void intel_ring_setup_status_page(struct intel_ring_buffer *ring) void intel_ring_setup_status_page(struct intel_ring_buffer *ring)
{ {
struct drm_device *dev = ring->dev; struct drm_device *dev = ring->dev;
drm_i915_private_t *dev_priv = ring->dev->dev_private; struct drm_i915_private *dev_priv = ring->dev->dev_private;
u32 mmio = 0; u32 mmio = 0;
/* The ring status page addresses are no longer next to the rest of /* The ring status page addresses are no longer next to the rest of
@ -1043,7 +1054,7 @@ static bool
gen6_ring_get_irq(struct intel_ring_buffer *ring) gen6_ring_get_irq(struct intel_ring_buffer *ring)
{ {
struct drm_device *dev = ring->dev; struct drm_device *dev = ring->dev;
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
unsigned long flags; unsigned long flags;
if (!dev->irq_enabled) if (!dev->irq_enabled)
@ -1068,7 +1079,7 @@ static void
gen6_ring_put_irq(struct intel_ring_buffer *ring) gen6_ring_put_irq(struct intel_ring_buffer *ring)
{ {
struct drm_device *dev = ring->dev; struct drm_device *dev = ring->dev;
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&dev_priv->irq_lock, flags); spin_lock_irqsave(&dev_priv->irq_lock, flags);
@ -1635,7 +1646,7 @@ static int __intel_ring_prepare(struct intel_ring_buffer *ring,
int intel_ring_begin(struct intel_ring_buffer *ring, int intel_ring_begin(struct intel_ring_buffer *ring,
int num_dwords) int num_dwords)
{ {
drm_i915_private_t *dev_priv = ring->dev->dev_private; struct drm_i915_private *dev_priv = ring->dev->dev_private;
int ret; int ret;
ret = i915_gem_check_wedge(&dev_priv->gpu_error, ret = i915_gem_check_wedge(&dev_priv->gpu_error,
@ -1697,7 +1708,7 @@ void intel_ring_init_seqno(struct intel_ring_buffer *ring, u32 seqno)
static void gen6_bsd_ring_write_tail(struct intel_ring_buffer *ring, static void gen6_bsd_ring_write_tail(struct intel_ring_buffer *ring,
u32 value) u32 value)
{ {
drm_i915_private_t *dev_priv = ring->dev->dev_private; struct drm_i915_private *dev_priv = ring->dev->dev_private;
/* Every tail move must follow the sequence below */ /* Every tail move must follow the sequence below */
@ -1872,7 +1883,7 @@ static int gen6_ring_flush(struct intel_ring_buffer *ring,
int intel_init_render_ring_buffer(struct drm_device *dev) int intel_init_render_ring_buffer(struct drm_device *dev)
{ {
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct intel_ring_buffer *ring = &dev_priv->ring[RCS]; struct intel_ring_buffer *ring = &dev_priv->ring[RCS];
ring->name = "render ring"; ring->name = "render ring";
@ -1973,7 +1984,7 @@ int intel_init_render_ring_buffer(struct drm_device *dev)
int intel_render_ring_init_dri(struct drm_device *dev, u64 start, u32 size) int intel_render_ring_init_dri(struct drm_device *dev, u64 start, u32 size)
{ {
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct intel_ring_buffer *ring = &dev_priv->ring[RCS]; struct intel_ring_buffer *ring = &dev_priv->ring[RCS];
int ret; int ret;
@ -2041,7 +2052,7 @@ int intel_render_ring_init_dri(struct drm_device *dev, u64 start, u32 size)
int intel_init_bsd_ring_buffer(struct drm_device *dev) int intel_init_bsd_ring_buffer(struct drm_device *dev)
{ {
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct intel_ring_buffer *ring = &dev_priv->ring[VCS]; struct intel_ring_buffer *ring = &dev_priv->ring[VCS];
ring->name = "bsd ring"; ring->name = "bsd ring";
@ -2104,7 +2115,7 @@ int intel_init_bsd_ring_buffer(struct drm_device *dev)
int intel_init_blt_ring_buffer(struct drm_device *dev) int intel_init_blt_ring_buffer(struct drm_device *dev)
{ {
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct intel_ring_buffer *ring = &dev_priv->ring[BCS]; struct intel_ring_buffer *ring = &dev_priv->ring[BCS];
ring->name = "blitter ring"; ring->name = "blitter ring";
@ -2144,7 +2155,7 @@ int intel_init_blt_ring_buffer(struct drm_device *dev)
int intel_init_vebox_ring_buffer(struct drm_device *dev) int intel_init_vebox_ring_buffer(struct drm_device *dev)
{ {
drm_i915_private_t *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct intel_ring_buffer *ring = &dev_priv->ring[VECS]; struct intel_ring_buffer *ring = &dev_priv->ring[VECS];
ring->name = "video enhancement ring"; ring->name = "video enhancement ring";

View File

@ -46,11 +46,11 @@ enum intel_ring_hangcheck_action {
#define HANGCHECK_SCORE_RING_HUNG 31 #define HANGCHECK_SCORE_RING_HUNG 31
struct intel_ring_hangcheck { struct intel_ring_hangcheck {
bool deadlock; u64 acthd;
u32 seqno; u32 seqno;
u32 acthd;
int score; int score;
enum intel_ring_hangcheck_action action; enum intel_ring_hangcheck_action action;
bool deadlock;
}; };
struct intel_ring_buffer { struct intel_ring_buffer {
@ -292,7 +292,7 @@ int intel_init_bsd_ring_buffer(struct drm_device *dev);
int intel_init_blt_ring_buffer(struct drm_device *dev); int intel_init_blt_ring_buffer(struct drm_device *dev);
int intel_init_vebox_ring_buffer(struct drm_device *dev); int intel_init_vebox_ring_buffer(struct drm_device *dev);
u32 intel_ring_get_active_head(struct intel_ring_buffer *ring); u64 intel_ring_get_active_head(struct intel_ring_buffer *ring);
void intel_ring_setup_status_page(struct intel_ring_buffer *ring); void intel_ring_setup_status_page(struct intel_ring_buffer *ring);
static inline u32 intel_ring_get_tail(struct intel_ring_buffer *ring) static inline u32 intel_ring_get_tail(struct intel_ring_buffer *ring)

View File

@ -1536,9 +1536,14 @@ static int tv_is_present_in_vbt(struct drm_device *dev)
/* /*
* If the device type is not TV, continue. * If the device type is not TV, continue.
*/ */
if (p_child->old.device_type != DEVICE_TYPE_INT_TV && switch (p_child->old.device_type) {
p_child->old.device_type != DEVICE_TYPE_TV) case DEVICE_TYPE_INT_TV:
case DEVICE_TYPE_TV:
case DEVICE_TYPE_TV_SVIDEO_COMPOSITE:
break;
default:
continue; continue;
}
/* Only when the addin_offset is non-zero, it is regarded /* Only when the addin_offset is non-zero, it is regarded
* as present. * as present.
*/ */

View File

@ -550,11 +550,12 @@ gen6_read##x(struct drm_i915_private *dev_priv, off_t reg, bool trace) { \
NEEDS_FORCE_WAKE((dev_priv), (reg))) { \ NEEDS_FORCE_WAKE((dev_priv), (reg))) { \
dev_priv->uncore.funcs.force_wake_get(dev_priv, \ dev_priv->uncore.funcs.force_wake_get(dev_priv, \
FORCEWAKE_ALL); \ FORCEWAKE_ALL); \
dev_priv->uncore.forcewake_count++; \ val = __raw_i915_read##x(dev_priv, reg); \
mod_timer_pinned(&dev_priv->uncore.force_wake_timer, \ dev_priv->uncore.funcs.force_wake_put(dev_priv, \
jiffies + 1); \ FORCEWAKE_ALL); \
} else { \
val = __raw_i915_read##x(dev_priv, reg); \
} \ } \
val = __raw_i915_read##x(dev_priv, reg); \
REG_READ_FOOTER; \ REG_READ_FOOTER; \
} }
@ -865,7 +866,7 @@ int i915_reg_read_ioctl(struct drm_device *dev,
struct drm_i915_private *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct drm_i915_reg_read *reg = data; struct drm_i915_reg_read *reg = data;
struct register_whitelist const *entry = whitelist; struct register_whitelist const *entry = whitelist;
int i; int i, ret = 0;
for (i = 0; i < ARRAY_SIZE(whitelist); i++, entry++) { for (i = 0; i < ARRAY_SIZE(whitelist); i++, entry++) {
if (entry->offset == reg->offset && if (entry->offset == reg->offset &&
@ -876,6 +877,8 @@ int i915_reg_read_ioctl(struct drm_device *dev,
if (i == ARRAY_SIZE(whitelist)) if (i == ARRAY_SIZE(whitelist))
return -EINVAL; return -EINVAL;
intel_runtime_pm_get(dev_priv);
switch (entry->size) { switch (entry->size) {
case 8: case 8:
reg->val = I915_READ64(reg->offset); reg->val = I915_READ64(reg->offset);
@ -891,10 +894,13 @@ int i915_reg_read_ioctl(struct drm_device *dev,
break; break;
default: default:
WARN_ON(1); WARN_ON(1);
return -EINVAL; ret = -EINVAL;
goto out;
} }
return 0; out:
intel_runtime_pm_put(dev_priv);
return ret;
} }
int i915_get_reset_stats_ioctl(struct drm_device *dev, int i915_get_reset_stats_ioctl(struct drm_device *dev,

View File

@ -891,13 +891,16 @@ static int nouveau_pmops_runtime_suspend(struct device *dev)
struct drm_device *drm_dev = pci_get_drvdata(pdev); struct drm_device *drm_dev = pci_get_drvdata(pdev);
int ret; int ret;
if (nouveau_runtime_pm == 0) if (nouveau_runtime_pm == 0) {
return -EINVAL; pm_runtime_forbid(dev);
return -EBUSY;
}
/* are we optimus enabled? */ /* are we optimus enabled? */
if (nouveau_runtime_pm == -1 && !nouveau_is_optimus() && !nouveau_is_v1_dsm()) { if (nouveau_runtime_pm == -1 && !nouveau_is_optimus() && !nouveau_is_v1_dsm()) {
DRM_DEBUG_DRIVER("failing to power off - not optimus\n"); DRM_DEBUG_DRIVER("failing to power off - not optimus\n");
return -EINVAL; pm_runtime_forbid(dev);
return -EBUSY;
} }
nv_debug_level(SILENT); nv_debug_level(SILENT);
@ -946,12 +949,15 @@ static int nouveau_pmops_runtime_idle(struct device *dev)
struct nouveau_drm *drm = nouveau_drm(drm_dev); struct nouveau_drm *drm = nouveau_drm(drm_dev);
struct drm_crtc *crtc; struct drm_crtc *crtc;
if (nouveau_runtime_pm == 0) if (nouveau_runtime_pm == 0) {
pm_runtime_forbid(dev);
return -EBUSY; return -EBUSY;
}
/* are we optimus enabled? */ /* are we optimus enabled? */
if (nouveau_runtime_pm == -1 && !nouveau_is_optimus() && !nouveau_is_v1_dsm()) { if (nouveau_runtime_pm == -1 && !nouveau_is_optimus() && !nouveau_is_v1_dsm()) {
DRM_DEBUG_DRIVER("failing to power off - not optimus\n"); DRM_DEBUG_DRIVER("failing to power off - not optimus\n");
pm_runtime_forbid(dev);
return -EBUSY; return -EBUSY;
} }

View File

@ -177,8 +177,10 @@ void udl_gem_free_object(struct drm_gem_object *gem_obj)
if (obj->vmapping) if (obj->vmapping)
udl_gem_vunmap(obj); udl_gem_vunmap(obj);
if (gem_obj->import_attach) if (gem_obj->import_attach) {
drm_prime_gem_destroy(gem_obj, obj->sg); drm_prime_gem_destroy(gem_obj, obj->sg);
put_device(gem_obj->dev->dev);
}
if (obj->pages) if (obj->pages)
udl_gem_put_pages(obj); udl_gem_put_pages(obj);
@ -256,9 +258,12 @@ struct drm_gem_object *udl_gem_prime_import(struct drm_device *dev,
int ret; int ret;
/* need to attach */ /* need to attach */
get_device(dev->dev);
attach = dma_buf_attach(dma_buf, dev->dev); attach = dma_buf_attach(dma_buf, dev->dev);
if (IS_ERR(attach)) if (IS_ERR(attach)) {
put_device(dev->dev);
return ERR_CAST(attach); return ERR_CAST(attach);
}
get_dma_buf(dma_buf); get_dma_buf(dma_buf);
@ -282,6 +287,6 @@ fail_unmap:
fail_detach: fail_detach:
dma_buf_detach(dma_buf, attach); dma_buf_detach(dma_buf, attach);
dma_buf_put(dma_buf); dma_buf_put(dma_buf);
put_device(dev->dev);
return ERR_PTR(ret); return ERR_PTR(ret);
} }

View File

@ -43,6 +43,7 @@
#define G25_REV_MIN 0x22 #define G25_REV_MIN 0x22
#define G27_REV_MAJ 0x12 #define G27_REV_MAJ 0x12
#define G27_REV_MIN 0x38 #define G27_REV_MIN 0x38
#define G27_2_REV_MIN 0x39
#define to_hid_device(pdev) container_of(pdev, struct hid_device, dev) #define to_hid_device(pdev) container_of(pdev, struct hid_device, dev)
@ -130,6 +131,7 @@ static const struct lg4ff_usb_revision lg4ff_revs[] = {
{DFP_REV_MAJ, DFP_REV_MIN, &native_dfp}, /* Driving Force Pro */ {DFP_REV_MAJ, DFP_REV_MIN, &native_dfp}, /* Driving Force Pro */
{G25_REV_MAJ, G25_REV_MIN, &native_g25}, /* G25 */ {G25_REV_MAJ, G25_REV_MIN, &native_g25}, /* G25 */
{G27_REV_MAJ, G27_REV_MIN, &native_g27}, /* G27 */ {G27_REV_MAJ, G27_REV_MIN, &native_g27}, /* G27 */
{G27_REV_MAJ, G27_2_REV_MIN, &native_g27}, /* G27 v2 */
}; };
/* Recalculates X axis value accordingly to currently selected range */ /* Recalculates X axis value accordingly to currently selected range */

View File

@ -42,6 +42,7 @@
#define DUALSHOCK4_CONTROLLER_BT BIT(6) #define DUALSHOCK4_CONTROLLER_BT BIT(6)
#define SONY_LED_SUPPORT (SIXAXIS_CONTROLLER_USB | BUZZ_CONTROLLER | DUALSHOCK4_CONTROLLER_USB) #define SONY_LED_SUPPORT (SIXAXIS_CONTROLLER_USB | BUZZ_CONTROLLER | DUALSHOCK4_CONTROLLER_USB)
#define SONY_FF_SUPPORT (SIXAXIS_CONTROLLER_USB | DUALSHOCK4_CONTROLLER_USB)
#define MAX_LEDS 4 #define MAX_LEDS 4
@ -499,6 +500,7 @@ struct sony_sc {
__u8 right; __u8 right;
#endif #endif
__u8 worker_initialized;
__u8 led_state[MAX_LEDS]; __u8 led_state[MAX_LEDS];
__u8 led_count; __u8 led_count;
}; };
@ -993,22 +995,11 @@ static int sony_init_ff(struct hid_device *hdev)
return input_ff_create_memless(input_dev, NULL, sony_play_effect); return input_ff_create_memless(input_dev, NULL, sony_play_effect);
} }
static void sony_destroy_ff(struct hid_device *hdev)
{
struct sony_sc *sc = hid_get_drvdata(hdev);
cancel_work_sync(&sc->state_worker);
}
#else #else
static int sony_init_ff(struct hid_device *hdev) static int sony_init_ff(struct hid_device *hdev)
{ {
return 0; return 0;
} }
static void sony_destroy_ff(struct hid_device *hdev)
{
}
#endif #endif
static int sony_set_output_report(struct sony_sc *sc, int req_id, int req_size) static int sony_set_output_report(struct sony_sc *sc, int req_id, int req_size)
@ -1077,6 +1068,8 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id)
if (sc->quirks & SIXAXIS_CONTROLLER_USB) { if (sc->quirks & SIXAXIS_CONTROLLER_USB) {
hdev->hid_output_raw_report = sixaxis_usb_output_raw_report; hdev->hid_output_raw_report = sixaxis_usb_output_raw_report;
ret = sixaxis_set_operational_usb(hdev); ret = sixaxis_set_operational_usb(hdev);
sc->worker_initialized = 1;
INIT_WORK(&sc->state_worker, sixaxis_state_worker); INIT_WORK(&sc->state_worker, sixaxis_state_worker);
} }
else if (sc->quirks & SIXAXIS_CONTROLLER_BT) else if (sc->quirks & SIXAXIS_CONTROLLER_BT)
@ -1087,6 +1080,7 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id)
if (ret < 0) if (ret < 0)
goto err_stop; goto err_stop;
sc->worker_initialized = 1;
INIT_WORK(&sc->state_worker, dualshock4_state_worker); INIT_WORK(&sc->state_worker, dualshock4_state_worker);
} else { } else {
ret = 0; ret = 0;
@ -1101,9 +1095,11 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id)
goto err_stop; goto err_stop;
} }
ret = sony_init_ff(hdev); if (sc->quirks & SONY_FF_SUPPORT) {
if (ret < 0) ret = sony_init_ff(hdev);
goto err_stop; if (ret < 0)
goto err_stop;
}
return 0; return 0;
err_stop: err_stop:
@ -1120,7 +1116,8 @@ static void sony_remove(struct hid_device *hdev)
if (sc->quirks & SONY_LED_SUPPORT) if (sc->quirks & SONY_LED_SUPPORT)
sony_leds_remove(hdev); sony_leds_remove(hdev);
sony_destroy_ff(hdev); if (sc->worker_initialized)
cancel_work_sync(&sc->state_worker);
hid_hw_stop(hdev); hid_hw_stop(hdev);
} }

View File

@ -320,13 +320,13 @@ static void drop_ref(struct hidraw *hidraw, int exists_bit)
hid_hw_close(hidraw->hid); hid_hw_close(hidraw->hid);
wake_up_interruptible(&hidraw->wait); wake_up_interruptible(&hidraw->wait);
} }
device_destroy(hidraw_class,
MKDEV(hidraw_major, hidraw->minor));
} else { } else {
--hidraw->open; --hidraw->open;
} }
if (!hidraw->open) { if (!hidraw->open) {
if (!hidraw->exist) { if (!hidraw->exist) {
device_destroy(hidraw_class,
MKDEV(hidraw_major, hidraw->minor));
hidraw_table[hidraw->minor] = NULL; hidraw_table[hidraw->minor] = NULL;
kfree(hidraw); kfree(hidraw);
} else { } else {

View File

@ -39,7 +39,9 @@
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/dma-mapping.h> #include <linux/dma-mapping.h>
#include <linux/of_address.h>
#include <linux/of_device.h> #include <linux/of_device.h>
#include <linux/of_irq.h>
#include <linux/of_platform.h> #include <linux/of_platform.h>
#include <sysdev/fsl_soc.h> #include <sysdev/fsl_soc.h>
#include <asm/cpm.h> #include <asm/cpm.h>

View File

@ -954,11 +954,13 @@ static long evdev_do_ioctl(struct file *file, unsigned int cmd,
return -EFAULT; return -EFAULT;
error = input_ff_upload(dev, &effect, file); error = input_ff_upload(dev, &effect, file);
if (error)
return error;
if (put_user(effect.id, &(((struct ff_effect __user *)p)->id))) if (put_user(effect.id, &(((struct ff_effect __user *)p)->id)))
return -EFAULT; return -EFAULT;
return error; return 0;
} }
/* Multi-number variable-length handlers */ /* Multi-number variable-length handlers */

View File

@ -76,8 +76,18 @@ static int adp5588_gpio_get_value(struct gpio_chip *chip, unsigned off)
struct adp5588_kpad *kpad = container_of(chip, struct adp5588_kpad, gc); struct adp5588_kpad *kpad = container_of(chip, struct adp5588_kpad, gc);
unsigned int bank = ADP5588_BANK(kpad->gpiomap[off]); unsigned int bank = ADP5588_BANK(kpad->gpiomap[off]);
unsigned int bit = ADP5588_BIT(kpad->gpiomap[off]); unsigned int bit = ADP5588_BIT(kpad->gpiomap[off]);
int val;
return !!(adp5588_read(kpad->client, GPIO_DAT_STAT1 + bank) & bit); mutex_lock(&kpad->gpio_lock);
if (kpad->dir[bank] & bit)
val = kpad->dat_out[bank];
else
val = adp5588_read(kpad->client, GPIO_DAT_STAT1 + bank);
mutex_unlock(&kpad->gpio_lock);
return !!(val & bit);
} }
static void adp5588_gpio_set_value(struct gpio_chip *chip, static void adp5588_gpio_set_value(struct gpio_chip *chip,

View File

@ -27,29 +27,32 @@ struct da9052_onkey {
static void da9052_onkey_query(struct da9052_onkey *onkey) static void da9052_onkey_query(struct da9052_onkey *onkey)
{ {
int key_stat; int ret;
key_stat = da9052_reg_read(onkey->da9052, DA9052_EVENT_B_REG); ret = da9052_reg_read(onkey->da9052, DA9052_STATUS_A_REG);
if (key_stat < 0) { if (ret < 0) {
dev_err(onkey->da9052->dev, dev_err(onkey->da9052->dev,
"Failed to read onkey event %d\n", key_stat); "Failed to read onkey event err=%d\n", ret);
} else { } else {
/* /*
* Since interrupt for deassertion of ONKEY pin is not * Since interrupt for deassertion of ONKEY pin is not
* generated, onkey event state determines the onkey * generated, onkey event state determines the onkey
* button state. * button state.
*/ */
key_stat &= DA9052_EVENTB_ENONKEY; bool pressed = !(ret & DA9052_STATUSA_NONKEY);
input_report_key(onkey->input, KEY_POWER, key_stat);
input_sync(onkey->input);
}
/* input_report_key(onkey->input, KEY_POWER, pressed);
* Interrupt is generated only when the ONKEY pin is asserted. input_sync(onkey->input);
* Hence the deassertion of the pin is simulated through work queue.
*/ /*
if (key_stat) * Interrupt is generated only when the ONKEY pin
schedule_delayed_work(&onkey->work, msecs_to_jiffies(50)); * is asserted. Hence the deassertion of the pin
* is simulated through work queue.
*/
if (pressed)
schedule_delayed_work(&onkey->work,
msecs_to_jiffies(50));
}
} }
static void da9052_onkey_work(struct work_struct *work) static void da9052_onkey_work(struct work_struct *work)

View File

@ -409,7 +409,6 @@ static int cypress_set_input_params(struct input_dev *input,
__clear_bit(REL_X, input->relbit); __clear_bit(REL_X, input->relbit);
__clear_bit(REL_Y, input->relbit); __clear_bit(REL_Y, input->relbit);
__set_bit(INPUT_PROP_BUTTONPAD, input->propbit);
__set_bit(EV_KEY, input->evbit); __set_bit(EV_KEY, input->evbit);
__set_bit(BTN_LEFT, input->keybit); __set_bit(BTN_LEFT, input->keybit);
__set_bit(BTN_RIGHT, input->keybit); __set_bit(BTN_RIGHT, input->keybit);

View File

@ -265,11 +265,22 @@ static int synaptics_identify(struct psmouse *psmouse)
* Read touchpad resolution and maximum reported coordinates * Read touchpad resolution and maximum reported coordinates
* Resolution is left zero if touchpad does not support the query * Resolution is left zero if touchpad does not support the query
*/ */
static const int *quirk_min_max;
static int synaptics_resolution(struct psmouse *psmouse) static int synaptics_resolution(struct psmouse *psmouse)
{ {
struct synaptics_data *priv = psmouse->private; struct synaptics_data *priv = psmouse->private;
unsigned char resp[3]; unsigned char resp[3];
if (quirk_min_max) {
priv->x_min = quirk_min_max[0];
priv->x_max = quirk_min_max[1];
priv->y_min = quirk_min_max[2];
priv->y_max = quirk_min_max[3];
return 0;
}
if (SYN_ID_MAJOR(priv->identity) < 4) if (SYN_ID_MAJOR(priv->identity) < 4)
return 0; return 0;
@ -1485,10 +1496,54 @@ static const struct dmi_system_id olpc_dmi_table[] __initconst = {
{ } { }
}; };
static const struct dmi_system_id min_max_dmi_table[] __initconst = {
#if defined(CONFIG_DMI)
{
/* Lenovo ThinkPad Helix */
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad Helix"),
},
.driver_data = (int []){1024, 5052, 2258, 4832},
},
{
/* Lenovo ThinkPad X240 */
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad X240"),
},
.driver_data = (int []){1232, 5710, 1156, 4696},
},
{
/* Lenovo ThinkPad T440s */
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T440"),
},
.driver_data = (int []){1024, 5112, 2024, 4832},
},
{
/* Lenovo ThinkPad T540p */
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T540"),
},
.driver_data = (int []){1024, 5056, 2058, 4832},
},
#endif
{ }
};
void __init synaptics_module_init(void) void __init synaptics_module_init(void)
{ {
const struct dmi_system_id *min_max_dmi;
impaired_toshiba_kbc = dmi_check_system(toshiba_dmi_table); impaired_toshiba_kbc = dmi_check_system(toshiba_dmi_table);
broken_olpc_ec = dmi_check_system(olpc_dmi_table); broken_olpc_ec = dmi_check_system(olpc_dmi_table);
min_max_dmi = dmi_first_match(min_max_dmi_table);
if (min_max_dmi)
quirk_min_max = min_max_dmi->driver_data;
} }
static int __synaptics_init(struct psmouse *psmouse, bool absolute_mode) static int __synaptics_init(struct psmouse *psmouse, bool absolute_mode)

View File

@ -67,7 +67,6 @@ struct mousedev {
struct device dev; struct device dev;
struct cdev cdev; struct cdev cdev;
bool exist; bool exist;
bool is_mixdev;
struct list_head mixdev_node; struct list_head mixdev_node;
bool opened_by_mixdev; bool opened_by_mixdev;
@ -77,6 +76,9 @@ struct mousedev {
int old_x[4], old_y[4]; int old_x[4], old_y[4];
int frac_dx, frac_dy; int frac_dx, frac_dy;
unsigned long touch; unsigned long touch;
int (*open_device)(struct mousedev *mousedev);
void (*close_device)(struct mousedev *mousedev);
}; };
enum mousedev_emul { enum mousedev_emul {
@ -116,9 +118,6 @@ static unsigned char mousedev_imex_seq[] = { 0xf3, 200, 0xf3, 200, 0xf3, 80 };
static struct mousedev *mousedev_mix; static struct mousedev *mousedev_mix;
static LIST_HEAD(mousedev_mix_list); static LIST_HEAD(mousedev_mix_list);
static void mixdev_open_devices(void);
static void mixdev_close_devices(void);
#define fx(i) (mousedev->old_x[(mousedev->pkt_count - (i)) & 03]) #define fx(i) (mousedev->old_x[(mousedev->pkt_count - (i)) & 03])
#define fy(i) (mousedev->old_y[(mousedev->pkt_count - (i)) & 03]) #define fy(i) (mousedev->old_y[(mousedev->pkt_count - (i)) & 03])
@ -428,9 +427,7 @@ static int mousedev_open_device(struct mousedev *mousedev)
if (retval) if (retval)
return retval; return retval;
if (mousedev->is_mixdev) if (!mousedev->exist)
mixdev_open_devices();
else if (!mousedev->exist)
retval = -ENODEV; retval = -ENODEV;
else if (!mousedev->open++) { else if (!mousedev->open++) {
retval = input_open_device(&mousedev->handle); retval = input_open_device(&mousedev->handle);
@ -446,9 +443,7 @@ static void mousedev_close_device(struct mousedev *mousedev)
{ {
mutex_lock(&mousedev->mutex); mutex_lock(&mousedev->mutex);
if (mousedev->is_mixdev) if (mousedev->exist && !--mousedev->open)
mixdev_close_devices();
else if (mousedev->exist && !--mousedev->open)
input_close_device(&mousedev->handle); input_close_device(&mousedev->handle);
mutex_unlock(&mousedev->mutex); mutex_unlock(&mousedev->mutex);
@ -459,21 +454,29 @@ static void mousedev_close_device(struct mousedev *mousedev)
* stream. Note that this function is called with mousedev_mix->mutex * stream. Note that this function is called with mousedev_mix->mutex
* held. * held.
*/ */
static void mixdev_open_devices(void) static int mixdev_open_devices(struct mousedev *mixdev)
{ {
struct mousedev *mousedev; int error;
if (mousedev_mix->open++) error = mutex_lock_interruptible(&mixdev->mutex);
return; if (error)
return error;
list_for_each_entry(mousedev, &mousedev_mix_list, mixdev_node) { if (!mixdev->open++) {
if (!mousedev->opened_by_mixdev) { struct mousedev *mousedev;
if (mousedev_open_device(mousedev))
continue;
mousedev->opened_by_mixdev = true; list_for_each_entry(mousedev, &mousedev_mix_list, mixdev_node) {
if (!mousedev->opened_by_mixdev) {
if (mousedev_open_device(mousedev))
continue;
mousedev->opened_by_mixdev = true;
}
} }
} }
mutex_unlock(&mixdev->mutex);
return 0;
} }
/* /*
@ -481,19 +484,22 @@ static void mixdev_open_devices(void)
* device. Note that this function is called with mousedev_mix->mutex * device. Note that this function is called with mousedev_mix->mutex
* held. * held.
*/ */
static void mixdev_close_devices(void) static void mixdev_close_devices(struct mousedev *mixdev)
{ {
struct mousedev *mousedev; mutex_lock(&mixdev->mutex);
if (--mousedev_mix->open) if (!--mixdev->open) {
return; struct mousedev *mousedev;
list_for_each_entry(mousedev, &mousedev_mix_list, mixdev_node) { list_for_each_entry(mousedev, &mousedev_mix_list, mixdev_node) {
if (mousedev->opened_by_mixdev) { if (mousedev->opened_by_mixdev) {
mousedev->opened_by_mixdev = false; mousedev->opened_by_mixdev = false;
mousedev_close_device(mousedev); mousedev_close_device(mousedev);
}
} }
} }
mutex_unlock(&mixdev->mutex);
} }
@ -522,7 +528,7 @@ static int mousedev_release(struct inode *inode, struct file *file)
mousedev_detach_client(mousedev, client); mousedev_detach_client(mousedev, client);
kfree(client); kfree(client);
mousedev_close_device(mousedev); mousedev->close_device(mousedev);
return 0; return 0;
} }
@ -550,7 +556,7 @@ static int mousedev_open(struct inode *inode, struct file *file)
client->mousedev = mousedev; client->mousedev = mousedev;
mousedev_attach_client(mousedev, client); mousedev_attach_client(mousedev, client);
error = mousedev_open_device(mousedev); error = mousedev->open_device(mousedev);
if (error) if (error)
goto err_free_client; goto err_free_client;
@ -861,16 +867,21 @@ static struct mousedev *mousedev_create(struct input_dev *dev,
if (mixdev) { if (mixdev) {
dev_set_name(&mousedev->dev, "mice"); dev_set_name(&mousedev->dev, "mice");
mousedev->open_device = mixdev_open_devices;
mousedev->close_device = mixdev_close_devices;
} else { } else {
int dev_no = minor; int dev_no = minor;
/* Normalize device number if it falls into legacy range */ /* Normalize device number if it falls into legacy range */
if (dev_no < MOUSEDEV_MINOR_BASE + MOUSEDEV_MINORS) if (dev_no < MOUSEDEV_MINOR_BASE + MOUSEDEV_MINORS)
dev_no -= MOUSEDEV_MINOR_BASE; dev_no -= MOUSEDEV_MINOR_BASE;
dev_set_name(&mousedev->dev, "mouse%d", dev_no); dev_set_name(&mousedev->dev, "mouse%d", dev_no);
mousedev->open_device = mousedev_open_device;
mousedev->close_device = mousedev_close_device;
} }
mousedev->exist = true; mousedev->exist = true;
mousedev->is_mixdev = mixdev;
mousedev->handle.dev = input_get_device(dev); mousedev->handle.dev = input_get_device(dev);
mousedev->handle.name = dev_name(&mousedev->dev); mousedev->handle.name = dev_name(&mousedev->dev);
mousedev->handle.handler = handler; mousedev->handle.handler = handler;
@ -919,7 +930,7 @@ static void mousedev_destroy(struct mousedev *mousedev)
device_del(&mousedev->dev); device_del(&mousedev->dev);
mousedev_cleanup(mousedev); mousedev_cleanup(mousedev);
input_free_minor(MINOR(mousedev->dev.devt)); input_free_minor(MINOR(mousedev->dev.devt));
if (!mousedev->is_mixdev) if (mousedev != mousedev_mix)
input_unregister_handle(&mousedev->handle); input_unregister_handle(&mousedev->handle);
put_device(&mousedev->dev); put_device(&mousedev->dev);
} }

View File

@ -16,16 +16,6 @@ config CAPI_TRACE
This will increase the size of the kernelcapi module by 20 KB. This will increase the size of the kernelcapi module by 20 KB.
If unsure, say Y. If unsure, say Y.
config ISDN_CAPI_MIDDLEWARE
bool "CAPI2.0 Middleware support"
depends on TTY
help
This option will enhance the capabilities of the /dev/capi20
interface. It will provide a means of moving a data connection,
established via the usual /dev/capi20 interface to a special tty
device. If you want to use pppd with pppdcapiplugin to dial up to
your ISP, say Y here.
config ISDN_CAPI_CAPI20 config ISDN_CAPI_CAPI20
tristate "CAPI2.0 /dev/capi support" tristate "CAPI2.0 /dev/capi support"
help help
@ -34,6 +24,16 @@ config ISDN_CAPI_CAPI20
standardized libcapi20 to access this functionality. You should say standardized libcapi20 to access this functionality. You should say
Y/M here. Y/M here.
config ISDN_CAPI_MIDDLEWARE
bool "CAPI2.0 Middleware support"
depends on ISDN_CAPI_CAPI20 && TTY
help
This option will enhance the capabilities of the /dev/capi20
interface. It will provide a means of moving a data connection,
established via the usual /dev/capi20 interface to a special tty
device. If you want to use pppd with pppdcapiplugin to dial up to
your ISP, say Y here.
config ISDN_CAPI_CAPIDRV config ISDN_CAPI_CAPIDRV
tristate "CAPI2.0 capidrv interface support" tristate "CAPI2.0 capidrv interface support"
depends on ISDN_I4L depends on ISDN_I4L

View File

@ -1248,19 +1248,13 @@ static int alx_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
* shared register for the high 32 bits, so only a single, aligned, * shared register for the high 32 bits, so only a single, aligned,
* 4 GB physical address range can be used for descriptors. * 4 GB physical address range can be used for descriptors.
*/ */
if (!dma_set_mask(&pdev->dev, DMA_BIT_MASK(64)) && if (!dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64))) {
!dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(64))) {
dev_dbg(&pdev->dev, "DMA to 64-BIT addresses\n"); dev_dbg(&pdev->dev, "DMA to 64-BIT addresses\n");
} else { } else {
err = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32)); err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
if (err) { if (err) {
err = dma_set_coherent_mask(&pdev->dev, dev_err(&pdev->dev, "No usable DMA config, aborting\n");
DMA_BIT_MASK(32)); goto out_pci_disable;
if (err) {
dev_err(&pdev->dev,
"No usable DMA config, aborting\n");
goto out_pci_disable;
}
} }
} }

View File

@ -2436,7 +2436,7 @@ err_reset:
err_register: err_register:
err_sw_init: err_sw_init:
err_eeprom: err_eeprom:
iounmap(adapter->hw.hw_addr); pci_iounmap(pdev, adapter->hw.hw_addr);
err_init_netdev: err_init_netdev:
err_ioremap: err_ioremap:
free_netdev(netdev); free_netdev(netdev);
@ -2474,7 +2474,7 @@ static void atl1e_remove(struct pci_dev *pdev)
unregister_netdev(netdev); unregister_netdev(netdev);
atl1e_free_ring_resources(adapter); atl1e_free_ring_resources(adapter);
atl1e_force_ps(&adapter->hw); atl1e_force_ps(&adapter->hw);
iounmap(adapter->hw.hw_addr); pci_iounmap(pdev, adapter->hw.hw_addr);
pci_release_regions(pdev); pci_release_regions(pdev);
free_netdev(netdev); free_netdev(netdev);
pci_disable_device(pdev); pci_disable_device(pdev);

View File

@ -1,6 +1,6 @@
/* cnic.c: Broadcom CNIC core network driver. /* cnic.c: Broadcom CNIC core network driver.
* *
* Copyright (c) 2006-2013 Broadcom Corporation * Copyright (c) 2006-2014 Broadcom Corporation
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -342,7 +342,7 @@ static int cnic_send_nlmsg(struct cnic_local *cp, u32 type,
while (retry < 3) { while (retry < 3) {
rc = 0; rc = 0;
rcu_read_lock(); rcu_read_lock();
ulp_ops = rcu_dereference(cnic_ulp_tbl[CNIC_ULP_ISCSI]); ulp_ops = rcu_dereference(cp->ulp_ops[CNIC_ULP_ISCSI]);
if (ulp_ops) if (ulp_ops)
rc = ulp_ops->iscsi_nl_send_msg( rc = ulp_ops->iscsi_nl_send_msg(
cp->ulp_handle[CNIC_ULP_ISCSI], cp->ulp_handle[CNIC_ULP_ISCSI],
@ -726,7 +726,7 @@ static void cnic_free_dma(struct cnic_dev *dev, struct cnic_dma *dma)
for (i = 0; i < dma->num_pages; i++) { for (i = 0; i < dma->num_pages; i++) {
if (dma->pg_arr[i]) { if (dma->pg_arr[i]) {
dma_free_coherent(&dev->pcidev->dev, BNX2_PAGE_SIZE, dma_free_coherent(&dev->pcidev->dev, CNIC_PAGE_SIZE,
dma->pg_arr[i], dma->pg_map_arr[i]); dma->pg_arr[i], dma->pg_map_arr[i]);
dma->pg_arr[i] = NULL; dma->pg_arr[i] = NULL;
} }
@ -785,7 +785,7 @@ static int cnic_alloc_dma(struct cnic_dev *dev, struct cnic_dma *dma,
for (i = 0; i < pages; i++) { for (i = 0; i < pages; i++) {
dma->pg_arr[i] = dma_alloc_coherent(&dev->pcidev->dev, dma->pg_arr[i] = dma_alloc_coherent(&dev->pcidev->dev,
BNX2_PAGE_SIZE, CNIC_PAGE_SIZE,
&dma->pg_map_arr[i], &dma->pg_map_arr[i],
GFP_ATOMIC); GFP_ATOMIC);
if (dma->pg_arr[i] == NULL) if (dma->pg_arr[i] == NULL)
@ -794,8 +794,8 @@ static int cnic_alloc_dma(struct cnic_dev *dev, struct cnic_dma *dma,
if (!use_pg_tbl) if (!use_pg_tbl)
return 0; return 0;
dma->pgtbl_size = ((pages * 8) + BNX2_PAGE_SIZE - 1) & dma->pgtbl_size = ((pages * 8) + CNIC_PAGE_SIZE - 1) &
~(BNX2_PAGE_SIZE - 1); ~(CNIC_PAGE_SIZE - 1);
dma->pgtbl = dma_alloc_coherent(&dev->pcidev->dev, dma->pgtbl_size, dma->pgtbl = dma_alloc_coherent(&dev->pcidev->dev, dma->pgtbl_size,
&dma->pgtbl_map, GFP_ATOMIC); &dma->pgtbl_map, GFP_ATOMIC);
if (dma->pgtbl == NULL) if (dma->pgtbl == NULL)
@ -900,8 +900,8 @@ static int cnic_alloc_context(struct cnic_dev *dev)
if (BNX2_CHIP(cp) == BNX2_CHIP_5709) { if (BNX2_CHIP(cp) == BNX2_CHIP_5709) {
int i, k, arr_size; int i, k, arr_size;
cp->ctx_blk_size = BNX2_PAGE_SIZE; cp->ctx_blk_size = CNIC_PAGE_SIZE;
cp->cids_per_blk = BNX2_PAGE_SIZE / 128; cp->cids_per_blk = CNIC_PAGE_SIZE / 128;
arr_size = BNX2_MAX_CID / cp->cids_per_blk * arr_size = BNX2_MAX_CID / cp->cids_per_blk *
sizeof(struct cnic_ctx); sizeof(struct cnic_ctx);
cp->ctx_arr = kzalloc(arr_size, GFP_KERNEL); cp->ctx_arr = kzalloc(arr_size, GFP_KERNEL);
@ -933,7 +933,7 @@ static int cnic_alloc_context(struct cnic_dev *dev)
for (i = 0; i < cp->ctx_blks; i++) { for (i = 0; i < cp->ctx_blks; i++) {
cp->ctx_arr[i].ctx = cp->ctx_arr[i].ctx =
dma_alloc_coherent(&dev->pcidev->dev, dma_alloc_coherent(&dev->pcidev->dev,
BNX2_PAGE_SIZE, CNIC_PAGE_SIZE,
&cp->ctx_arr[i].mapping, &cp->ctx_arr[i].mapping,
GFP_KERNEL); GFP_KERNEL);
if (cp->ctx_arr[i].ctx == NULL) if (cp->ctx_arr[i].ctx == NULL)
@ -1013,7 +1013,7 @@ static int __cnic_alloc_uio_rings(struct cnic_uio_dev *udev, int pages)
if (udev->l2_ring) if (udev->l2_ring)
return 0; return 0;
udev->l2_ring_size = pages * BNX2_PAGE_SIZE; udev->l2_ring_size = pages * CNIC_PAGE_SIZE;
udev->l2_ring = dma_alloc_coherent(&udev->pdev->dev, udev->l2_ring_size, udev->l2_ring = dma_alloc_coherent(&udev->pdev->dev, udev->l2_ring_size,
&udev->l2_ring_map, &udev->l2_ring_map,
GFP_KERNEL | __GFP_COMP); GFP_KERNEL | __GFP_COMP);
@ -1021,7 +1021,7 @@ static int __cnic_alloc_uio_rings(struct cnic_uio_dev *udev, int pages)
return -ENOMEM; return -ENOMEM;
udev->l2_buf_size = (cp->l2_rx_ring_size + 1) * cp->l2_single_buf_size; udev->l2_buf_size = (cp->l2_rx_ring_size + 1) * cp->l2_single_buf_size;
udev->l2_buf_size = PAGE_ALIGN(udev->l2_buf_size); udev->l2_buf_size = CNIC_PAGE_ALIGN(udev->l2_buf_size);
udev->l2_buf = dma_alloc_coherent(&udev->pdev->dev, udev->l2_buf_size, udev->l2_buf = dma_alloc_coherent(&udev->pdev->dev, udev->l2_buf_size,
&udev->l2_buf_map, &udev->l2_buf_map,
GFP_KERNEL | __GFP_COMP); GFP_KERNEL | __GFP_COMP);
@ -1102,7 +1102,7 @@ static int cnic_init_uio(struct cnic_dev *dev)
uinfo->mem[0].size = MB_GET_CID_ADDR(TX_TSS_CID + uinfo->mem[0].size = MB_GET_CID_ADDR(TX_TSS_CID +
TX_MAX_TSS_RINGS + 1); TX_MAX_TSS_RINGS + 1);
uinfo->mem[1].addr = (unsigned long) cp->status_blk.gen & uinfo->mem[1].addr = (unsigned long) cp->status_blk.gen &
PAGE_MASK; CNIC_PAGE_MASK;
if (cp->ethdev->drv_state & CNIC_DRV_STATE_USING_MSIX) if (cp->ethdev->drv_state & CNIC_DRV_STATE_USING_MSIX)
uinfo->mem[1].size = BNX2_SBLK_MSIX_ALIGN_SIZE * 9; uinfo->mem[1].size = BNX2_SBLK_MSIX_ALIGN_SIZE * 9;
else else
@ -1113,7 +1113,7 @@ static int cnic_init_uio(struct cnic_dev *dev)
uinfo->mem[0].size = pci_resource_len(dev->pcidev, 0); uinfo->mem[0].size = pci_resource_len(dev->pcidev, 0);
uinfo->mem[1].addr = (unsigned long) cp->bnx2x_def_status_blk & uinfo->mem[1].addr = (unsigned long) cp->bnx2x_def_status_blk &
PAGE_MASK; CNIC_PAGE_MASK;
uinfo->mem[1].size = sizeof(*cp->bnx2x_def_status_blk); uinfo->mem[1].size = sizeof(*cp->bnx2x_def_status_blk);
uinfo->name = "bnx2x_cnic"; uinfo->name = "bnx2x_cnic";
@ -1267,14 +1267,14 @@ static int cnic_alloc_bnx2x_resc(struct cnic_dev *dev)
for (i = MAX_ISCSI_TBL_SZ; i < cp->max_cid_space; i++) for (i = MAX_ISCSI_TBL_SZ; i < cp->max_cid_space; i++)
cp->ctx_tbl[i].ulp_proto_id = CNIC_ULP_FCOE; cp->ctx_tbl[i].ulp_proto_id = CNIC_ULP_FCOE;
pages = PAGE_ALIGN(cp->max_cid_space * CNIC_KWQ16_DATA_SIZE) / pages = CNIC_PAGE_ALIGN(cp->max_cid_space * CNIC_KWQ16_DATA_SIZE) /
PAGE_SIZE; CNIC_PAGE_SIZE;
ret = cnic_alloc_dma(dev, kwq_16_dma, pages, 0); ret = cnic_alloc_dma(dev, kwq_16_dma, pages, 0);
if (ret) if (ret)
return -ENOMEM; return -ENOMEM;
n = PAGE_SIZE / CNIC_KWQ16_DATA_SIZE; n = CNIC_PAGE_SIZE / CNIC_KWQ16_DATA_SIZE;
for (i = 0, j = 0; i < cp->max_cid_space; i++) { for (i = 0, j = 0; i < cp->max_cid_space; i++) {
long off = CNIC_KWQ16_DATA_SIZE * (i % n); long off = CNIC_KWQ16_DATA_SIZE * (i % n);
@ -1296,7 +1296,7 @@ static int cnic_alloc_bnx2x_resc(struct cnic_dev *dev)
goto error; goto error;
} }
pages = PAGE_ALIGN(BNX2X_ISCSI_GLB_BUF_SIZE) / PAGE_SIZE; pages = CNIC_PAGE_ALIGN(BNX2X_ISCSI_GLB_BUF_SIZE) / CNIC_PAGE_SIZE;
ret = cnic_alloc_dma(dev, &cp->gbl_buf_info, pages, 0); ret = cnic_alloc_dma(dev, &cp->gbl_buf_info, pages, 0);
if (ret) if (ret)
goto error; goto error;
@ -1466,8 +1466,8 @@ static int cnic_bnx2x_iscsi_init1(struct cnic_dev *dev, struct kwqe *kwqe)
cp->r2tq_size = cp->num_iscsi_tasks * BNX2X_ISCSI_MAX_PENDING_R2TS * cp->r2tq_size = cp->num_iscsi_tasks * BNX2X_ISCSI_MAX_PENDING_R2TS *
BNX2X_ISCSI_R2TQE_SIZE; BNX2X_ISCSI_R2TQE_SIZE;
cp->hq_size = cp->num_ccells * BNX2X_ISCSI_HQ_BD_SIZE; cp->hq_size = cp->num_ccells * BNX2X_ISCSI_HQ_BD_SIZE;
pages = PAGE_ALIGN(cp->hq_size) / PAGE_SIZE; pages = CNIC_PAGE_ALIGN(cp->hq_size) / CNIC_PAGE_SIZE;
hq_bds = pages * (PAGE_SIZE / BNX2X_ISCSI_HQ_BD_SIZE); hq_bds = pages * (CNIC_PAGE_SIZE / BNX2X_ISCSI_HQ_BD_SIZE);
cp->num_cqs = req1->num_cqs; cp->num_cqs = req1->num_cqs;
if (!dev->max_iscsi_conn) if (!dev->max_iscsi_conn)
@ -1477,9 +1477,9 @@ static int cnic_bnx2x_iscsi_init1(struct cnic_dev *dev, struct kwqe *kwqe)
CNIC_WR16(dev, BAR_TSTRORM_INTMEM + TSTORM_ISCSI_RQ_SIZE_OFFSET(pfid), CNIC_WR16(dev, BAR_TSTRORM_INTMEM + TSTORM_ISCSI_RQ_SIZE_OFFSET(pfid),
req1->rq_num_wqes); req1->rq_num_wqes);
CNIC_WR16(dev, BAR_TSTRORM_INTMEM + TSTORM_ISCSI_PAGE_SIZE_OFFSET(pfid), CNIC_WR16(dev, BAR_TSTRORM_INTMEM + TSTORM_ISCSI_PAGE_SIZE_OFFSET(pfid),
PAGE_SIZE); CNIC_PAGE_SIZE);
CNIC_WR8(dev, BAR_TSTRORM_INTMEM + CNIC_WR8(dev, BAR_TSTRORM_INTMEM +
TSTORM_ISCSI_PAGE_SIZE_LOG_OFFSET(pfid), PAGE_SHIFT); TSTORM_ISCSI_PAGE_SIZE_LOG_OFFSET(pfid), CNIC_PAGE_BITS);
CNIC_WR16(dev, BAR_TSTRORM_INTMEM + CNIC_WR16(dev, BAR_TSTRORM_INTMEM +
TSTORM_ISCSI_NUM_OF_TASKS_OFFSET(pfid), TSTORM_ISCSI_NUM_OF_TASKS_OFFSET(pfid),
req1->num_tasks_per_conn); req1->num_tasks_per_conn);
@ -1489,9 +1489,9 @@ static int cnic_bnx2x_iscsi_init1(struct cnic_dev *dev, struct kwqe *kwqe)
USTORM_ISCSI_RQ_BUFFER_SIZE_OFFSET(pfid), USTORM_ISCSI_RQ_BUFFER_SIZE_OFFSET(pfid),
req1->rq_buffer_size); req1->rq_buffer_size);
CNIC_WR16(dev, BAR_USTRORM_INTMEM + USTORM_ISCSI_PAGE_SIZE_OFFSET(pfid), CNIC_WR16(dev, BAR_USTRORM_INTMEM + USTORM_ISCSI_PAGE_SIZE_OFFSET(pfid),
PAGE_SIZE); CNIC_PAGE_SIZE);
CNIC_WR8(dev, BAR_USTRORM_INTMEM + CNIC_WR8(dev, BAR_USTRORM_INTMEM +
USTORM_ISCSI_PAGE_SIZE_LOG_OFFSET(pfid), PAGE_SHIFT); USTORM_ISCSI_PAGE_SIZE_LOG_OFFSET(pfid), CNIC_PAGE_BITS);
CNIC_WR16(dev, BAR_USTRORM_INTMEM + CNIC_WR16(dev, BAR_USTRORM_INTMEM +
USTORM_ISCSI_NUM_OF_TASKS_OFFSET(pfid), USTORM_ISCSI_NUM_OF_TASKS_OFFSET(pfid),
req1->num_tasks_per_conn); req1->num_tasks_per_conn);
@ -1504,9 +1504,9 @@ static int cnic_bnx2x_iscsi_init1(struct cnic_dev *dev, struct kwqe *kwqe)
/* init Xstorm RAM */ /* init Xstorm RAM */
CNIC_WR16(dev, BAR_XSTRORM_INTMEM + XSTORM_ISCSI_PAGE_SIZE_OFFSET(pfid), CNIC_WR16(dev, BAR_XSTRORM_INTMEM + XSTORM_ISCSI_PAGE_SIZE_OFFSET(pfid),
PAGE_SIZE); CNIC_PAGE_SIZE);
CNIC_WR8(dev, BAR_XSTRORM_INTMEM + CNIC_WR8(dev, BAR_XSTRORM_INTMEM +
XSTORM_ISCSI_PAGE_SIZE_LOG_OFFSET(pfid), PAGE_SHIFT); XSTORM_ISCSI_PAGE_SIZE_LOG_OFFSET(pfid), CNIC_PAGE_BITS);
CNIC_WR16(dev, BAR_XSTRORM_INTMEM + CNIC_WR16(dev, BAR_XSTRORM_INTMEM +
XSTORM_ISCSI_NUM_OF_TASKS_OFFSET(pfid), XSTORM_ISCSI_NUM_OF_TASKS_OFFSET(pfid),
req1->num_tasks_per_conn); req1->num_tasks_per_conn);
@ -1519,9 +1519,9 @@ static int cnic_bnx2x_iscsi_init1(struct cnic_dev *dev, struct kwqe *kwqe)
/* init Cstorm RAM */ /* init Cstorm RAM */
CNIC_WR16(dev, BAR_CSTRORM_INTMEM + CSTORM_ISCSI_PAGE_SIZE_OFFSET(pfid), CNIC_WR16(dev, BAR_CSTRORM_INTMEM + CSTORM_ISCSI_PAGE_SIZE_OFFSET(pfid),
PAGE_SIZE); CNIC_PAGE_SIZE);
CNIC_WR8(dev, BAR_CSTRORM_INTMEM + CNIC_WR8(dev, BAR_CSTRORM_INTMEM +
CSTORM_ISCSI_PAGE_SIZE_LOG_OFFSET(pfid), PAGE_SHIFT); CSTORM_ISCSI_PAGE_SIZE_LOG_OFFSET(pfid), CNIC_PAGE_BITS);
CNIC_WR16(dev, BAR_CSTRORM_INTMEM + CNIC_WR16(dev, BAR_CSTRORM_INTMEM +
CSTORM_ISCSI_NUM_OF_TASKS_OFFSET(pfid), CSTORM_ISCSI_NUM_OF_TASKS_OFFSET(pfid),
req1->num_tasks_per_conn); req1->num_tasks_per_conn);
@ -1623,18 +1623,18 @@ static int cnic_alloc_bnx2x_conn_resc(struct cnic_dev *dev, u32 l5_cid)
} }
ctx->cid = cid; ctx->cid = cid;
pages = PAGE_ALIGN(cp->task_array_size) / PAGE_SIZE; pages = CNIC_PAGE_ALIGN(cp->task_array_size) / CNIC_PAGE_SIZE;
ret = cnic_alloc_dma(dev, &iscsi->task_array_info, pages, 1); ret = cnic_alloc_dma(dev, &iscsi->task_array_info, pages, 1);
if (ret) if (ret)
goto error; goto error;
pages = PAGE_ALIGN(cp->r2tq_size) / PAGE_SIZE; pages = CNIC_PAGE_ALIGN(cp->r2tq_size) / CNIC_PAGE_SIZE;
ret = cnic_alloc_dma(dev, &iscsi->r2tq_info, pages, 1); ret = cnic_alloc_dma(dev, &iscsi->r2tq_info, pages, 1);
if (ret) if (ret)
goto error; goto error;
pages = PAGE_ALIGN(cp->hq_size) / PAGE_SIZE; pages = CNIC_PAGE_ALIGN(cp->hq_size) / CNIC_PAGE_SIZE;
ret = cnic_alloc_dma(dev, &iscsi->hq_info, pages, 1); ret = cnic_alloc_dma(dev, &iscsi->hq_info, pages, 1);
if (ret) if (ret)
goto error; goto error;
@ -1760,7 +1760,7 @@ static int cnic_setup_bnx2x_ctx(struct cnic_dev *dev, struct kwqe *wqes[],
ictx->tstorm_st_context.iscsi.hdr_bytes_2_fetch = ISCSI_HEADER_SIZE; ictx->tstorm_st_context.iscsi.hdr_bytes_2_fetch = ISCSI_HEADER_SIZE;
/* TSTORM requires the base address of RQ DB & not PTE */ /* TSTORM requires the base address of RQ DB & not PTE */
ictx->tstorm_st_context.iscsi.rq_db_phy_addr.lo = ictx->tstorm_st_context.iscsi.rq_db_phy_addr.lo =
req2->rq_page_table_addr_lo & PAGE_MASK; req2->rq_page_table_addr_lo & CNIC_PAGE_MASK;
ictx->tstorm_st_context.iscsi.rq_db_phy_addr.hi = ictx->tstorm_st_context.iscsi.rq_db_phy_addr.hi =
req2->rq_page_table_addr_hi; req2->rq_page_table_addr_hi;
ictx->tstorm_st_context.iscsi.iscsi_conn_id = req1->iscsi_conn_id; ictx->tstorm_st_context.iscsi.iscsi_conn_id = req1->iscsi_conn_id;
@ -1842,7 +1842,7 @@ static int cnic_setup_bnx2x_ctx(struct cnic_dev *dev, struct kwqe *wqes[],
/* CSTORM and USTORM initialization is different, CSTORM requires /* CSTORM and USTORM initialization is different, CSTORM requires
* CQ DB base & not PTE addr */ * CQ DB base & not PTE addr */
ictx->cstorm_st_context.cq_db_base.lo = ictx->cstorm_st_context.cq_db_base.lo =
req1->cq_page_table_addr_lo & PAGE_MASK; req1->cq_page_table_addr_lo & CNIC_PAGE_MASK;
ictx->cstorm_st_context.cq_db_base.hi = req1->cq_page_table_addr_hi; ictx->cstorm_st_context.cq_db_base.hi = req1->cq_page_table_addr_hi;
ictx->cstorm_st_context.iscsi_conn_id = req1->iscsi_conn_id; ictx->cstorm_st_context.iscsi_conn_id = req1->iscsi_conn_id;
ictx->cstorm_st_context.cq_proc_en_bit_map = (1 << cp->num_cqs) - 1; ictx->cstorm_st_context.cq_proc_en_bit_map = (1 << cp->num_cqs) - 1;
@ -2911,7 +2911,7 @@ static int cnic_l2_completion(struct cnic_local *cp)
u16 hw_cons, sw_cons; u16 hw_cons, sw_cons;
struct cnic_uio_dev *udev = cp->udev; struct cnic_uio_dev *udev = cp->udev;
union eth_rx_cqe *cqe, *cqe_ring = (union eth_rx_cqe *) union eth_rx_cqe *cqe, *cqe_ring = (union eth_rx_cqe *)
(udev->l2_ring + (2 * BNX2_PAGE_SIZE)); (udev->l2_ring + (2 * CNIC_PAGE_SIZE));
u32 cmd; u32 cmd;
int comp = 0; int comp = 0;
@ -3244,7 +3244,8 @@ static int cnic_copy_ulp_stats(struct cnic_dev *dev, int ulp_type)
int rc; int rc;
mutex_lock(&cnic_lock); mutex_lock(&cnic_lock);
ulp_ops = cnic_ulp_tbl_prot(ulp_type); ulp_ops = rcu_dereference_protected(cp->ulp_ops[ulp_type],
lockdep_is_held(&cnic_lock));
if (ulp_ops && ulp_ops->cnic_get_stats) if (ulp_ops && ulp_ops->cnic_get_stats)
rc = ulp_ops->cnic_get_stats(cp->ulp_handle[ulp_type]); rc = ulp_ops->cnic_get_stats(cp->ulp_handle[ulp_type]);
else else
@ -4384,7 +4385,7 @@ static int cnic_setup_5709_context(struct cnic_dev *dev, int valid)
u32 idx = cp->ctx_arr[i].cid / cp->cids_per_blk; u32 idx = cp->ctx_arr[i].cid / cp->cids_per_blk;
u32 val; u32 val;
memset(cp->ctx_arr[i].ctx, 0, BNX2_PAGE_SIZE); memset(cp->ctx_arr[i].ctx, 0, CNIC_PAGE_SIZE);
CNIC_WR(dev, BNX2_CTX_HOST_PAGE_TBL_DATA0, CNIC_WR(dev, BNX2_CTX_HOST_PAGE_TBL_DATA0,
(cp->ctx_arr[i].mapping & 0xffffffff) | valid_bit); (cp->ctx_arr[i].mapping & 0xffffffff) | valid_bit);
@ -4628,7 +4629,7 @@ static void cnic_init_bnx2_rx_ring(struct cnic_dev *dev)
val = BNX2_L2CTX_L2_STATUSB_NUM(sb_id); val = BNX2_L2CTX_L2_STATUSB_NUM(sb_id);
cnic_ctx_wr(dev, cid_addr, BNX2_L2CTX_HOST_BDIDX, val); cnic_ctx_wr(dev, cid_addr, BNX2_L2CTX_HOST_BDIDX, val);
rxbd = udev->l2_ring + BNX2_PAGE_SIZE; rxbd = udev->l2_ring + CNIC_PAGE_SIZE;
for (i = 0; i < BNX2_MAX_RX_DESC_CNT; i++, rxbd++) { for (i = 0; i < BNX2_MAX_RX_DESC_CNT; i++, rxbd++) {
dma_addr_t buf_map; dma_addr_t buf_map;
int n = (i % cp->l2_rx_ring_size) + 1; int n = (i % cp->l2_rx_ring_size) + 1;
@ -4639,11 +4640,11 @@ static void cnic_init_bnx2_rx_ring(struct cnic_dev *dev)
rxbd->rx_bd_haddr_hi = (u64) buf_map >> 32; rxbd->rx_bd_haddr_hi = (u64) buf_map >> 32;
rxbd->rx_bd_haddr_lo = (u64) buf_map & 0xffffffff; rxbd->rx_bd_haddr_lo = (u64) buf_map & 0xffffffff;
} }
val = (u64) (ring_map + BNX2_PAGE_SIZE) >> 32; val = (u64) (ring_map + CNIC_PAGE_SIZE) >> 32;
cnic_ctx_wr(dev, cid_addr, BNX2_L2CTX_NX_BDHADDR_HI, val); cnic_ctx_wr(dev, cid_addr, BNX2_L2CTX_NX_BDHADDR_HI, val);
rxbd->rx_bd_haddr_hi = val; rxbd->rx_bd_haddr_hi = val;
val = (u64) (ring_map + BNX2_PAGE_SIZE) & 0xffffffff; val = (u64) (ring_map + CNIC_PAGE_SIZE) & 0xffffffff;
cnic_ctx_wr(dev, cid_addr, BNX2_L2CTX_NX_BDHADDR_LO, val); cnic_ctx_wr(dev, cid_addr, BNX2_L2CTX_NX_BDHADDR_LO, val);
rxbd->rx_bd_haddr_lo = val; rxbd->rx_bd_haddr_lo = val;
@ -4709,10 +4710,10 @@ static int cnic_start_bnx2_hw(struct cnic_dev *dev)
val = CNIC_RD(dev, BNX2_MQ_CONFIG); val = CNIC_RD(dev, BNX2_MQ_CONFIG);
val &= ~BNX2_MQ_CONFIG_KNL_BYP_BLK_SIZE; val &= ~BNX2_MQ_CONFIG_KNL_BYP_BLK_SIZE;
if (BNX2_PAGE_BITS > 12) if (CNIC_PAGE_BITS > 12)
val |= (12 - 8) << 4; val |= (12 - 8) << 4;
else else
val |= (BNX2_PAGE_BITS - 8) << 4; val |= (CNIC_PAGE_BITS - 8) << 4;
CNIC_WR(dev, BNX2_MQ_CONFIG, val); CNIC_WR(dev, BNX2_MQ_CONFIG, val);
@ -4742,13 +4743,13 @@ static int cnic_start_bnx2_hw(struct cnic_dev *dev)
/* Initialize the kernel work queue context. */ /* Initialize the kernel work queue context. */
val = KRNLQ_TYPE_TYPE_KRNLQ | KRNLQ_SIZE_TYPE_SIZE | val = KRNLQ_TYPE_TYPE_KRNLQ | KRNLQ_SIZE_TYPE_SIZE |
(BNX2_PAGE_BITS - 8) | KRNLQ_FLAGS_QE_SELF_SEQ; (CNIC_PAGE_BITS - 8) | KRNLQ_FLAGS_QE_SELF_SEQ;
cnic_ctx_wr(dev, kwq_cid_addr, L5_KRNLQ_TYPE, val); cnic_ctx_wr(dev, kwq_cid_addr, L5_KRNLQ_TYPE, val);
val = (BNX2_PAGE_SIZE / sizeof(struct kwqe) - 1) << 16; val = (CNIC_PAGE_SIZE / sizeof(struct kwqe) - 1) << 16;
cnic_ctx_wr(dev, kwq_cid_addr, L5_KRNLQ_QE_SELF_SEQ_MAX, val); cnic_ctx_wr(dev, kwq_cid_addr, L5_KRNLQ_QE_SELF_SEQ_MAX, val);
val = ((BNX2_PAGE_SIZE / sizeof(struct kwqe)) << 16) | KWQ_PAGE_CNT; val = ((CNIC_PAGE_SIZE / sizeof(struct kwqe)) << 16) | KWQ_PAGE_CNT;
cnic_ctx_wr(dev, kwq_cid_addr, L5_KRNLQ_PGTBL_NPAGES, val); cnic_ctx_wr(dev, kwq_cid_addr, L5_KRNLQ_PGTBL_NPAGES, val);
val = (u32) ((u64) cp->kwq_info.pgtbl_map >> 32); val = (u32) ((u64) cp->kwq_info.pgtbl_map >> 32);
@ -4768,13 +4769,13 @@ static int cnic_start_bnx2_hw(struct cnic_dev *dev)
/* Initialize the kernel complete queue context. */ /* Initialize the kernel complete queue context. */
val = KRNLQ_TYPE_TYPE_KRNLQ | KRNLQ_SIZE_TYPE_SIZE | val = KRNLQ_TYPE_TYPE_KRNLQ | KRNLQ_SIZE_TYPE_SIZE |
(BNX2_PAGE_BITS - 8) | KRNLQ_FLAGS_QE_SELF_SEQ; (CNIC_PAGE_BITS - 8) | KRNLQ_FLAGS_QE_SELF_SEQ;
cnic_ctx_wr(dev, kcq_cid_addr, L5_KRNLQ_TYPE, val); cnic_ctx_wr(dev, kcq_cid_addr, L5_KRNLQ_TYPE, val);
val = (BNX2_PAGE_SIZE / sizeof(struct kcqe) - 1) << 16; val = (CNIC_PAGE_SIZE / sizeof(struct kcqe) - 1) << 16;
cnic_ctx_wr(dev, kcq_cid_addr, L5_KRNLQ_QE_SELF_SEQ_MAX, val); cnic_ctx_wr(dev, kcq_cid_addr, L5_KRNLQ_QE_SELF_SEQ_MAX, val);
val = ((BNX2_PAGE_SIZE / sizeof(struct kcqe)) << 16) | KCQ_PAGE_CNT; val = ((CNIC_PAGE_SIZE / sizeof(struct kcqe)) << 16) | KCQ_PAGE_CNT;
cnic_ctx_wr(dev, kcq_cid_addr, L5_KRNLQ_PGTBL_NPAGES, val); cnic_ctx_wr(dev, kcq_cid_addr, L5_KRNLQ_PGTBL_NPAGES, val);
val = (u32) ((u64) cp->kcq1.dma.pgtbl_map >> 32); val = (u32) ((u64) cp->kcq1.dma.pgtbl_map >> 32);
@ -4918,7 +4919,7 @@ static void cnic_init_bnx2x_tx_ring(struct cnic_dev *dev,
u32 cli = cp->ethdev->iscsi_l2_client_id; u32 cli = cp->ethdev->iscsi_l2_client_id;
u32 val; u32 val;
memset(txbd, 0, BNX2_PAGE_SIZE); memset(txbd, 0, CNIC_PAGE_SIZE);
buf_map = udev->l2_buf_map; buf_map = udev->l2_buf_map;
for (i = 0; i < BNX2_MAX_TX_DESC_CNT; i += 3, txbd += 3) { for (i = 0; i < BNX2_MAX_TX_DESC_CNT; i += 3, txbd += 3) {
@ -4978,9 +4979,9 @@ static void cnic_init_bnx2x_rx_ring(struct cnic_dev *dev,
struct bnx2x *bp = netdev_priv(dev->netdev); struct bnx2x *bp = netdev_priv(dev->netdev);
struct cnic_uio_dev *udev = cp->udev; struct cnic_uio_dev *udev = cp->udev;
struct eth_rx_bd *rxbd = (struct eth_rx_bd *) (udev->l2_ring + struct eth_rx_bd *rxbd = (struct eth_rx_bd *) (udev->l2_ring +
BNX2_PAGE_SIZE); CNIC_PAGE_SIZE);
struct eth_rx_cqe_next_page *rxcqe = (struct eth_rx_cqe_next_page *) struct eth_rx_cqe_next_page *rxcqe = (struct eth_rx_cqe_next_page *)
(udev->l2_ring + (2 * BNX2_PAGE_SIZE)); (udev->l2_ring + (2 * CNIC_PAGE_SIZE));
struct host_sp_status_block *sb = cp->bnx2x_def_status_blk; struct host_sp_status_block *sb = cp->bnx2x_def_status_blk;
int i; int i;
u32 cli = cp->ethdev->iscsi_l2_client_id; u32 cli = cp->ethdev->iscsi_l2_client_id;
@ -5004,20 +5005,20 @@ static void cnic_init_bnx2x_rx_ring(struct cnic_dev *dev,
rxbd->addr_lo = cpu_to_le32(buf_map & 0xffffffff); rxbd->addr_lo = cpu_to_le32(buf_map & 0xffffffff);
} }
val = (u64) (ring_map + BNX2_PAGE_SIZE) >> 32; val = (u64) (ring_map + CNIC_PAGE_SIZE) >> 32;
rxbd->addr_hi = cpu_to_le32(val); rxbd->addr_hi = cpu_to_le32(val);
data->rx.bd_page_base.hi = cpu_to_le32(val); data->rx.bd_page_base.hi = cpu_to_le32(val);
val = (u64) (ring_map + BNX2_PAGE_SIZE) & 0xffffffff; val = (u64) (ring_map + CNIC_PAGE_SIZE) & 0xffffffff;
rxbd->addr_lo = cpu_to_le32(val); rxbd->addr_lo = cpu_to_le32(val);
data->rx.bd_page_base.lo = cpu_to_le32(val); data->rx.bd_page_base.lo = cpu_to_le32(val);
rxcqe += BNX2X_MAX_RCQ_DESC_CNT; rxcqe += BNX2X_MAX_RCQ_DESC_CNT;
val = (u64) (ring_map + (2 * BNX2_PAGE_SIZE)) >> 32; val = (u64) (ring_map + (2 * CNIC_PAGE_SIZE)) >> 32;
rxcqe->addr_hi = cpu_to_le32(val); rxcqe->addr_hi = cpu_to_le32(val);
data->rx.cqe_page_base.hi = cpu_to_le32(val); data->rx.cqe_page_base.hi = cpu_to_le32(val);
val = (u64) (ring_map + (2 * BNX2_PAGE_SIZE)) & 0xffffffff; val = (u64) (ring_map + (2 * CNIC_PAGE_SIZE)) & 0xffffffff;
rxcqe->addr_lo = cpu_to_le32(val); rxcqe->addr_lo = cpu_to_le32(val);
data->rx.cqe_page_base.lo = cpu_to_le32(val); data->rx.cqe_page_base.lo = cpu_to_le32(val);
@ -5265,8 +5266,8 @@ static void cnic_shutdown_rings(struct cnic_dev *dev)
msleep(10); msleep(10);
} }
clear_bit(CNIC_LCL_FL_RINGS_INITED, &cp->cnic_local_flags); clear_bit(CNIC_LCL_FL_RINGS_INITED, &cp->cnic_local_flags);
rx_ring = udev->l2_ring + BNX2_PAGE_SIZE; rx_ring = udev->l2_ring + CNIC_PAGE_SIZE;
memset(rx_ring, 0, BNX2_PAGE_SIZE); memset(rx_ring, 0, CNIC_PAGE_SIZE);
} }
static int cnic_register_netdev(struct cnic_dev *dev) static int cnic_register_netdev(struct cnic_dev *dev)

View File

@ -1,6 +1,6 @@
/* cnic.h: Broadcom CNIC core network driver. /* cnic.h: Broadcom CNIC core network driver.
* *
* Copyright (c) 2006-2013 Broadcom Corporation * Copyright (c) 2006-2014 Broadcom Corporation
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
/* cnic.c: Broadcom CNIC core network driver. /* cnic.c: Broadcom CNIC core network driver.
* *
* Copyright (c) 2006-2013 Broadcom Corporation * Copyright (c) 2006-2014 Broadcom Corporation
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View File

@ -1,6 +1,6 @@
/* cnic_if.h: Broadcom CNIC core network driver. /* cnic_if.h: Broadcom CNIC core network driver.
* *
* Copyright (c) 2006-2013 Broadcom Corporation * Copyright (c) 2006-2014 Broadcom Corporation
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -14,8 +14,8 @@
#include "bnx2x/bnx2x_mfw_req.h" #include "bnx2x/bnx2x_mfw_req.h"
#define CNIC_MODULE_VERSION "2.5.19" #define CNIC_MODULE_VERSION "2.5.20"
#define CNIC_MODULE_RELDATE "December 19, 2013" #define CNIC_MODULE_RELDATE "March 14, 2014"
#define CNIC_ULP_RDMA 0 #define CNIC_ULP_RDMA 0
#define CNIC_ULP_ISCSI 1 #define CNIC_ULP_ISCSI 1
@ -24,6 +24,16 @@
#define MAX_CNIC_ULP_TYPE_EXT 3 #define MAX_CNIC_ULP_TYPE_EXT 3
#define MAX_CNIC_ULP_TYPE 4 #define MAX_CNIC_ULP_TYPE 4
/* Use CPU native page size up to 16K for cnic ring sizes. */
#if (PAGE_SHIFT > 14)
#define CNIC_PAGE_BITS 14
#else
#define CNIC_PAGE_BITS PAGE_SHIFT
#endif
#define CNIC_PAGE_SIZE (1 << (CNIC_PAGE_BITS))
#define CNIC_PAGE_ALIGN(addr) ALIGN(addr, CNIC_PAGE_SIZE)
#define CNIC_PAGE_MASK (~((CNIC_PAGE_SIZE) - 1))
struct kwqe { struct kwqe {
u32 kwqe_op_flag; u32 kwqe_op_flag;

View File

@ -17649,8 +17649,6 @@ static int tg3_init_one(struct pci_dev *pdev,
tg3_init_bufmgr_config(tp); tg3_init_bufmgr_config(tp);
features |= NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX;
/* 5700 B0 chips do not support checksumming correctly due /* 5700 B0 chips do not support checksumming correctly due
* to hardware bugs. * to hardware bugs.
*/ */
@ -17682,7 +17680,8 @@ static int tg3_init_one(struct pci_dev *pdev,
features |= NETIF_F_TSO_ECN; features |= NETIF_F_TSO_ECN;
} }
dev->features |= features; dev->features |= features | NETIF_F_HW_VLAN_CTAG_TX |
NETIF_F_HW_VLAN_CTAG_RX;
dev->vlan_features |= features; dev->vlan_features |= features;
/* /*

View File

@ -22,6 +22,7 @@
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <net/ip.h> #include <net/ip.h>
#include <net/ipv6.h> #include <net/ipv6.h>
#include <linux/io.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/of_irq.h> #include <linux/of_irq.h>
#include <linux/of_mdio.h> #include <linux/of_mdio.h>
@ -88,8 +89,9 @@
#define MVNETA_TX_IN_PRGRS BIT(1) #define MVNETA_TX_IN_PRGRS BIT(1)
#define MVNETA_TX_FIFO_EMPTY BIT(8) #define MVNETA_TX_FIFO_EMPTY BIT(8)
#define MVNETA_RX_MIN_FRAME_SIZE 0x247c #define MVNETA_RX_MIN_FRAME_SIZE 0x247c
#define MVNETA_SGMII_SERDES_CFG 0x24A0 #define MVNETA_SERDES_CFG 0x24A0
#define MVNETA_SGMII_SERDES_PROTO 0x0cc7 #define MVNETA_SGMII_SERDES_PROTO 0x0cc7
#define MVNETA_RGMII_SERDES_PROTO 0x0667
#define MVNETA_TYPE_PRIO 0x24bc #define MVNETA_TYPE_PRIO 0x24bc
#define MVNETA_FORCE_UNI BIT(21) #define MVNETA_FORCE_UNI BIT(21)
#define MVNETA_TXQ_CMD_1 0x24e4 #define MVNETA_TXQ_CMD_1 0x24e4
@ -161,7 +163,7 @@
#define MVNETA_GMAC_MAX_RX_SIZE_MASK 0x7ffc #define MVNETA_GMAC_MAX_RX_SIZE_MASK 0x7ffc
#define MVNETA_GMAC0_PORT_ENABLE BIT(0) #define MVNETA_GMAC0_PORT_ENABLE BIT(0)
#define MVNETA_GMAC_CTRL_2 0x2c08 #define MVNETA_GMAC_CTRL_2 0x2c08
#define MVNETA_GMAC2_PSC_ENABLE BIT(3) #define MVNETA_GMAC2_PCS_ENABLE BIT(3)
#define MVNETA_GMAC2_PORT_RGMII BIT(4) #define MVNETA_GMAC2_PORT_RGMII BIT(4)
#define MVNETA_GMAC2_PORT_RESET BIT(6) #define MVNETA_GMAC2_PORT_RESET BIT(6)
#define MVNETA_GMAC_STATUS 0x2c10 #define MVNETA_GMAC_STATUS 0x2c10
@ -710,35 +712,6 @@ static void mvneta_rxq_bm_disable(struct mvneta_port *pp,
mvreg_write(pp, MVNETA_RXQ_CONFIG_REG(rxq->id), val); mvreg_write(pp, MVNETA_RXQ_CONFIG_REG(rxq->id), val);
} }
/* Sets the RGMII Enable bit (RGMIIEn) in port MAC control register */
static void mvneta_gmac_rgmii_set(struct mvneta_port *pp, int enable)
{
u32 val;
val = mvreg_read(pp, MVNETA_GMAC_CTRL_2);
if (enable)
val |= MVNETA_GMAC2_PORT_RGMII;
else
val &= ~MVNETA_GMAC2_PORT_RGMII;
mvreg_write(pp, MVNETA_GMAC_CTRL_2, val);
}
/* Config SGMII port */
static void mvneta_port_sgmii_config(struct mvneta_port *pp)
{
u32 val;
val = mvreg_read(pp, MVNETA_GMAC_CTRL_2);
val |= MVNETA_GMAC2_PSC_ENABLE;
mvreg_write(pp, MVNETA_GMAC_CTRL_2, val);
mvreg_write(pp, MVNETA_SGMII_SERDES_CFG, MVNETA_SGMII_SERDES_PROTO);
}
/* Start the Ethernet port RX and TX activity */ /* Start the Ethernet port RX and TX activity */
static void mvneta_port_up(struct mvneta_port *pp) static void mvneta_port_up(struct mvneta_port *pp)
{ {
@ -2756,12 +2729,15 @@ static void mvneta_port_power_up(struct mvneta_port *pp, int phy_mode)
mvreg_write(pp, MVNETA_UNIT_INTR_CAUSE, 0); mvreg_write(pp, MVNETA_UNIT_INTR_CAUSE, 0);
if (phy_mode == PHY_INTERFACE_MODE_SGMII) if (phy_mode == PHY_INTERFACE_MODE_SGMII)
mvneta_port_sgmii_config(pp); mvreg_write(pp, MVNETA_SERDES_CFG, MVNETA_SGMII_SERDES_PROTO);
else
mvreg_write(pp, MVNETA_SERDES_CFG, MVNETA_RGMII_SERDES_PROTO);
mvneta_gmac_rgmii_set(pp, 1); val = mvreg_read(pp, MVNETA_GMAC_CTRL_2);
val |= MVNETA_GMAC2_PCS_ENABLE | MVNETA_GMAC2_PORT_RGMII;
/* Cancel Port Reset */ /* Cancel Port Reset */
val = mvreg_read(pp, MVNETA_GMAC_CTRL_2);
val &= ~MVNETA_GMAC2_PORT_RESET; val &= ~MVNETA_GMAC2_PORT_RESET;
mvreg_write(pp, MVNETA_GMAC_CTRL_2, val); mvreg_write(pp, MVNETA_GMAC_CTRL_2, val);
@ -2774,6 +2750,7 @@ static void mvneta_port_power_up(struct mvneta_port *pp, int phy_mode)
static int mvneta_probe(struct platform_device *pdev) static int mvneta_probe(struct platform_device *pdev)
{ {
const struct mbus_dram_target_info *dram_target_info; const struct mbus_dram_target_info *dram_target_info;
struct resource *res;
struct device_node *dn = pdev->dev.of_node; struct device_node *dn = pdev->dev.of_node;
struct device_node *phy_node; struct device_node *phy_node;
u32 phy_addr; u32 phy_addr;
@ -2838,9 +2815,15 @@ static int mvneta_probe(struct platform_device *pdev)
clk_prepare_enable(pp->clk); clk_prepare_enable(pp->clk);
pp->base = of_iomap(dn, 0); res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res) {
err = -ENODEV;
goto err_clk;
}
pp->base = devm_ioremap_resource(&pdev->dev, res);
if (pp->base == NULL) { if (pp->base == NULL) {
err = -ENOMEM; err = PTR_ERR(pp->base);
goto err_clk; goto err_clk;
} }
@ -2848,7 +2831,7 @@ static int mvneta_probe(struct platform_device *pdev)
pp->stats = alloc_percpu(struct mvneta_pcpu_stats); pp->stats = alloc_percpu(struct mvneta_pcpu_stats);
if (!pp->stats) { if (!pp->stats) {
err = -ENOMEM; err = -ENOMEM;
goto err_unmap; goto err_clk;
} }
for_each_possible_cpu(cpu) { for_each_possible_cpu(cpu) {
@ -2913,8 +2896,6 @@ err_deinit:
mvneta_deinit(pp); mvneta_deinit(pp);
err_free_stats: err_free_stats:
free_percpu(pp->stats); free_percpu(pp->stats);
err_unmap:
iounmap(pp->base);
err_clk: err_clk:
clk_disable_unprepare(pp->clk); clk_disable_unprepare(pp->clk);
err_free_irq: err_free_irq:
@ -2934,7 +2915,6 @@ static int mvneta_remove(struct platform_device *pdev)
mvneta_deinit(pp); mvneta_deinit(pp);
clk_disable_unprepare(pp->clk); clk_disable_unprepare(pp->clk);
free_percpu(pp->stats); free_percpu(pp->stats);
iounmap(pp->base);
irq_dispose_mapping(dev->irq); irq_dispose_mapping(dev->irq);
free_netdev(dev); free_netdev(dev);

View File

@ -2681,7 +2681,11 @@ static pci_ers_result_t mlx4_pci_err_detected(struct pci_dev *pdev,
static pci_ers_result_t mlx4_pci_slot_reset(struct pci_dev *pdev) static pci_ers_result_t mlx4_pci_slot_reset(struct pci_dev *pdev)
{ {
int ret = __mlx4_init_one(pdev, 0); const struct pci_device_id *id;
int ret;
id = pci_match_id(mlx4_pci_table, pdev);
ret = __mlx4_init_one(pdev, id->driver_data);
return ret ? PCI_ERS_RESULT_DISCONNECT : PCI_ERS_RESULT_RECOVERED; return ret ? PCI_ERS_RESULT_DISCONNECT : PCI_ERS_RESULT_RECOVERED;
} }

View File

@ -23,6 +23,7 @@
#include <linux/crc32.h> #include <linux/crc32.h>
#include <linux/mii.h> #include <linux/mii.h>
#include <linux/eeprom_93cx6.h> #include <linux/eeprom_93cx6.h>
#include <linux/regulator/consumer.h>
#include <linux/spi/spi.h> #include <linux/spi/spi.h>
@ -83,6 +84,7 @@ union ks8851_tx_hdr {
* @rc_rxqcr: Cached copy of KS_RXQCR. * @rc_rxqcr: Cached copy of KS_RXQCR.
* @eeprom_size: Companion eeprom size in Bytes, 0 if no eeprom * @eeprom_size: Companion eeprom size in Bytes, 0 if no eeprom
* @eeprom: 93CX6 EEPROM state for accessing on-board EEPROM. * @eeprom: 93CX6 EEPROM state for accessing on-board EEPROM.
* @vdd_reg: Optional regulator supplying the chip
* *
* The @lock ensures that the chip is protected when certain operations are * The @lock ensures that the chip is protected when certain operations are
* in progress. When the read or write packet transfer is in progress, most * in progress. When the read or write packet transfer is in progress, most
@ -130,6 +132,7 @@ struct ks8851_net {
struct spi_transfer spi_xfer2[2]; struct spi_transfer spi_xfer2[2];
struct eeprom_93cx6 eeprom; struct eeprom_93cx6 eeprom;
struct regulator *vdd_reg;
}; };
static int msg_enable; static int msg_enable;
@ -1414,6 +1417,21 @@ static int ks8851_probe(struct spi_device *spi)
ks->spidev = spi; ks->spidev = spi;
ks->tx_space = 6144; ks->tx_space = 6144;
ks->vdd_reg = regulator_get_optional(&spi->dev, "vdd");
if (IS_ERR(ks->vdd_reg)) {
ret = PTR_ERR(ks->vdd_reg);
if (ret == -EPROBE_DEFER)
goto err_reg;
} else {
ret = regulator_enable(ks->vdd_reg);
if (ret) {
dev_err(&spi->dev, "regulator enable fail: %d\n",
ret);
goto err_reg_en;
}
}
mutex_init(&ks->lock); mutex_init(&ks->lock);
spin_lock_init(&ks->statelock); spin_lock_init(&ks->statelock);
@ -1508,8 +1526,14 @@ static int ks8851_probe(struct spi_device *spi)
err_netdev: err_netdev:
free_irq(ndev->irq, ks); free_irq(ndev->irq, ks);
err_id:
err_irq: err_irq:
err_id:
if (!IS_ERR(ks->vdd_reg))
regulator_disable(ks->vdd_reg);
err_reg_en:
if (!IS_ERR(ks->vdd_reg))
regulator_put(ks->vdd_reg);
err_reg:
free_netdev(ndev); free_netdev(ndev);
return ret; return ret;
} }
@ -1523,6 +1547,10 @@ static int ks8851_remove(struct spi_device *spi)
unregister_netdev(priv->netdev); unregister_netdev(priv->netdev);
free_irq(spi->irq, priv); free_irq(spi->irq, priv);
if (!IS_ERR(priv->vdd_reg)) {
regulator_disable(priv->vdd_reg);
regulator_put(priv->vdd_reg);
}
free_netdev(priv->netdev); free_netdev(priv->netdev);
return 0; return 0;

View File

@ -4765,7 +4765,9 @@ static int qlge_probe(struct pci_dev *pdev,
ndev->features = ndev->hw_features; ndev->features = ndev->hw_features;
ndev->vlan_features = ndev->hw_features; ndev->vlan_features = ndev->hw_features;
/* vlan gets same features (except vlan filter) */ /* vlan gets same features (except vlan filter) */
ndev->vlan_features &= ~NETIF_F_HW_VLAN_CTAG_FILTER; ndev->vlan_features &= ~(NETIF_F_HW_VLAN_CTAG_FILTER |
NETIF_F_HW_VLAN_CTAG_TX |
NETIF_F_HW_VLAN_CTAG_RX);
if (test_bit(QL_DMA64, &qdev->flags)) if (test_bit(QL_DMA64, &qdev->flags))
ndev->features |= NETIF_F_HIGHDMA; ndev->features |= NETIF_F_HIGHDMA;

View File

@ -2229,10 +2229,6 @@ static int cpsw_probe(struct platform_device *pdev)
goto clean_ale_ret; goto clean_ale_ret;
} }
if (cpts_register(&pdev->dev, priv->cpts,
data->cpts_clock_mult, data->cpts_clock_shift))
dev_err(priv->dev, "error registering cpts device\n");
cpsw_notice(priv, probe, "initialized device (regs %pa, irq %d)\n", cpsw_notice(priv, probe, "initialized device (regs %pa, irq %d)\n",
&ss_res->start, ndev->irq); &ss_res->start, ndev->irq);

View File

@ -355,7 +355,7 @@ int cpdma_ctlr_stop(struct cpdma_ctlr *ctlr)
int i; int i;
spin_lock_irqsave(&ctlr->lock, flags); spin_lock_irqsave(&ctlr->lock, flags);
if (ctlr->state != CPDMA_STATE_ACTIVE) { if (ctlr->state == CPDMA_STATE_TEARDOWN) {
spin_unlock_irqrestore(&ctlr->lock, flags); spin_unlock_irqrestore(&ctlr->lock, flags);
return -EINVAL; return -EINVAL;
} }
@ -891,7 +891,7 @@ int cpdma_chan_stop(struct cpdma_chan *chan)
unsigned timeout; unsigned timeout;
spin_lock_irqsave(&chan->lock, flags); spin_lock_irqsave(&chan->lock, flags);
if (chan->state != CPDMA_STATE_ACTIVE) { if (chan->state == CPDMA_STATE_TEARDOWN) {
spin_unlock_irqrestore(&chan->lock, flags); spin_unlock_irqrestore(&chan->lock, flags);
return -EINVAL; return -EINVAL;
} }

View File

@ -1532,9 +1532,9 @@ static int emac_dev_open(struct net_device *ndev)
struct device *emac_dev = &ndev->dev; struct device *emac_dev = &ndev->dev;
u32 cnt; u32 cnt;
struct resource *res; struct resource *res;
int ret; int q, m, ret;
int res_num = 0, irq_num = 0;
int i = 0; int i = 0;
int k = 0;
struct emac_priv *priv = netdev_priv(ndev); struct emac_priv *priv = netdev_priv(ndev);
pm_runtime_get(&priv->pdev->dev); pm_runtime_get(&priv->pdev->dev);
@ -1564,15 +1564,24 @@ static int emac_dev_open(struct net_device *ndev)
} }
/* Request IRQ */ /* Request IRQ */
while ((res = platform_get_resource(priv->pdev, IORESOURCE_IRQ,
res_num))) {
for (irq_num = res->start; irq_num <= res->end; irq_num++) {
dev_err(emac_dev, "Request IRQ %d\n", irq_num);
if (request_irq(irq_num, emac_irq, 0, ndev->name,
ndev)) {
dev_err(emac_dev,
"DaVinci EMAC: request_irq() failed\n");
ret = -EBUSY;
while ((res = platform_get_resource(priv->pdev, IORESOURCE_IRQ, k))) {
for (i = res->start; i <= res->end; i++) {
if (devm_request_irq(&priv->pdev->dev, i, emac_irq,
0, ndev->name, ndev))
goto rollback; goto rollback;
}
} }
k++; res_num++;
} }
/* prepare counters for rollback in case of an error */
res_num--;
irq_num--;
/* Start/Enable EMAC hardware */ /* Start/Enable EMAC hardware */
emac_hw_enable(priv); emac_hw_enable(priv);
@ -1639,11 +1648,23 @@ static int emac_dev_open(struct net_device *ndev)
return 0; return 0;
rollback:
dev_err(emac_dev, "DaVinci EMAC: devm_request_irq() failed");
ret = -EBUSY;
err: err:
emac_int_disable(priv);
napi_disable(&priv->napi);
rollback:
for (q = res_num; q >= 0; q--) {
res = platform_get_resource(priv->pdev, IORESOURCE_IRQ, q);
/* at the first iteration, irq_num is already set to the
* right value
*/
if (q != res_num)
irq_num = res->end;
for (m = irq_num; m >= res->start; m--)
free_irq(m, ndev);
}
cpdma_ctlr_stop(priv->dma);
pm_runtime_put(&priv->pdev->dev); pm_runtime_put(&priv->pdev->dev);
return ret; return ret;
} }
@ -1659,6 +1680,9 @@ err:
*/ */
static int emac_dev_stop(struct net_device *ndev) static int emac_dev_stop(struct net_device *ndev)
{ {
struct resource *res;
int i = 0;
int irq_num;
struct emac_priv *priv = netdev_priv(ndev); struct emac_priv *priv = netdev_priv(ndev);
struct device *emac_dev = &ndev->dev; struct device *emac_dev = &ndev->dev;
@ -1674,6 +1698,13 @@ static int emac_dev_stop(struct net_device *ndev)
if (priv->phydev) if (priv->phydev)
phy_disconnect(priv->phydev); phy_disconnect(priv->phydev);
/* Free IRQ */
while ((res = platform_get_resource(priv->pdev, IORESOURCE_IRQ, i))) {
for (irq_num = res->start; irq_num <= res->end; irq_num++)
free_irq(irq_num, priv->ndev);
i++;
}
if (netif_msg_drv(priv)) if (netif_msg_drv(priv))
dev_notice(emac_dev, "DaVinci EMAC: %s stopped\n", ndev->name); dev_notice(emac_dev, "DaVinci EMAC: %s stopped\n", ndev->name);

View File

@ -923,7 +923,7 @@ static int rhine_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
if (rc) { if (rc) {
dev_err(&pdev->dev, dev_err(&pdev->dev,
"32-bit PCI DMA addresses not supported by the card!?\n"); "32-bit PCI DMA addresses not supported by the card!?\n");
goto err_out; goto err_out_pci_disable;
} }
/* sanity check */ /* sanity check */
@ -931,7 +931,7 @@ static int rhine_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
(pci_resource_len(pdev, 1) < io_size)) { (pci_resource_len(pdev, 1) < io_size)) {
rc = -EIO; rc = -EIO;
dev_err(&pdev->dev, "Insufficient PCI resources, aborting\n"); dev_err(&pdev->dev, "Insufficient PCI resources, aborting\n");
goto err_out; goto err_out_pci_disable;
} }
pioaddr = pci_resource_start(pdev, 0); pioaddr = pci_resource_start(pdev, 0);
@ -942,7 +942,7 @@ static int rhine_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
dev = alloc_etherdev(sizeof(struct rhine_private)); dev = alloc_etherdev(sizeof(struct rhine_private));
if (!dev) { if (!dev) {
rc = -ENOMEM; rc = -ENOMEM;
goto err_out; goto err_out_pci_disable;
} }
SET_NETDEV_DEV(dev, &pdev->dev); SET_NETDEV_DEV(dev, &pdev->dev);
@ -1084,6 +1084,8 @@ err_out_free_res:
pci_release_regions(pdev); pci_release_regions(pdev);
err_out_free_netdev: err_out_free_netdev:
free_netdev(dev); free_netdev(dev);
err_out_pci_disable:
pci_disable_device(pdev);
err_out: err_out:
return rc; return rc;
} }

View File

@ -180,7 +180,8 @@ static void ifb_setup(struct net_device *dev)
dev->tx_queue_len = TX_Q_LIMIT; dev->tx_queue_len = TX_Q_LIMIT;
dev->features |= IFB_FEATURES; dev->features |= IFB_FEATURES;
dev->vlan_features |= IFB_FEATURES; dev->vlan_features |= IFB_FEATURES & ~(NETIF_F_HW_VLAN_CTAG_TX |
NETIF_F_HW_VLAN_STAG_TX);
dev->flags |= IFF_NOARP; dev->flags |= IFF_NOARP;
dev->flags &= ~IFF_MULTICAST; dev->flags &= ~IFF_MULTICAST;

View File

@ -683,10 +683,9 @@ EXPORT_SYMBOL(phy_detach);
int phy_suspend(struct phy_device *phydev) int phy_suspend(struct phy_device *phydev)
{ {
struct phy_driver *phydrv = to_phy_driver(phydev->dev.driver); struct phy_driver *phydrv = to_phy_driver(phydev->dev.driver);
struct ethtool_wolinfo wol; struct ethtool_wolinfo wol = { .cmd = ETHTOOL_GWOL };
/* If the device has WOL enabled, we cannot suspend the PHY */ /* If the device has WOL enabled, we cannot suspend the PHY */
wol.cmd = ETHTOOL_GWOL;
phy_ethtool_get_wol(phydev, &wol); phy_ethtool_get_wol(phydev, &wol);
if (wol.wolopts) if (wol.wolopts)
return -EBUSY; return -EBUSY;

View File

@ -68,7 +68,6 @@ static struct usb_driver cdc_ncm_driver;
static int cdc_ncm_setup(struct usbnet *dev) static int cdc_ncm_setup(struct usbnet *dev)
{ {
struct cdc_ncm_ctx *ctx = (struct cdc_ncm_ctx *)dev->data[0]; struct cdc_ncm_ctx *ctx = (struct cdc_ncm_ctx *)dev->data[0];
struct usb_cdc_ncm_ntb_parameters ncm_parm;
u32 val; u32 val;
u8 flags; u8 flags;
u8 iface_no; u8 iface_no;
@ -82,22 +81,22 @@ static int cdc_ncm_setup(struct usbnet *dev)
err = usbnet_read_cmd(dev, USB_CDC_GET_NTB_PARAMETERS, err = usbnet_read_cmd(dev, USB_CDC_GET_NTB_PARAMETERS,
USB_TYPE_CLASS | USB_DIR_IN USB_TYPE_CLASS | USB_DIR_IN
|USB_RECIP_INTERFACE, |USB_RECIP_INTERFACE,
0, iface_no, &ncm_parm, 0, iface_no, &ctx->ncm_parm,
sizeof(ncm_parm)); sizeof(ctx->ncm_parm));
if (err < 0) { if (err < 0) {
dev_err(&dev->intf->dev, "failed GET_NTB_PARAMETERS\n"); dev_err(&dev->intf->dev, "failed GET_NTB_PARAMETERS\n");
return err; /* GET_NTB_PARAMETERS is required */ return err; /* GET_NTB_PARAMETERS is required */
} }
/* read correct set of parameters according to device mode */ /* read correct set of parameters according to device mode */
ctx->rx_max = le32_to_cpu(ncm_parm.dwNtbInMaxSize); ctx->rx_max = le32_to_cpu(ctx->ncm_parm.dwNtbInMaxSize);
ctx->tx_max = le32_to_cpu(ncm_parm.dwNtbOutMaxSize); ctx->tx_max = le32_to_cpu(ctx->ncm_parm.dwNtbOutMaxSize);
ctx->tx_remainder = le16_to_cpu(ncm_parm.wNdpOutPayloadRemainder); ctx->tx_remainder = le16_to_cpu(ctx->ncm_parm.wNdpOutPayloadRemainder);
ctx->tx_modulus = le16_to_cpu(ncm_parm.wNdpOutDivisor); ctx->tx_modulus = le16_to_cpu(ctx->ncm_parm.wNdpOutDivisor);
ctx->tx_ndp_modulus = le16_to_cpu(ncm_parm.wNdpOutAlignment); ctx->tx_ndp_modulus = le16_to_cpu(ctx->ncm_parm.wNdpOutAlignment);
/* devices prior to NCM Errata shall set this field to zero */ /* devices prior to NCM Errata shall set this field to zero */
ctx->tx_max_datagrams = le16_to_cpu(ncm_parm.wNtbOutMaxDatagrams); ctx->tx_max_datagrams = le16_to_cpu(ctx->ncm_parm.wNtbOutMaxDatagrams);
ntb_fmt_supported = le16_to_cpu(ncm_parm.bmNtbFormatsSupported); ntb_fmt_supported = le16_to_cpu(ctx->ncm_parm.bmNtbFormatsSupported);
/* there are some minor differences in NCM and MBIM defaults */ /* there are some minor differences in NCM and MBIM defaults */
if (cdc_ncm_comm_intf_is_mbim(ctx->control->cur_altsetting)) { if (cdc_ncm_comm_intf_is_mbim(ctx->control->cur_altsetting)) {
@ -146,7 +145,7 @@ static int cdc_ncm_setup(struct usbnet *dev)
} }
/* inform device about NTB input size changes */ /* inform device about NTB input size changes */
if (ctx->rx_max != le32_to_cpu(ncm_parm.dwNtbInMaxSize)) { if (ctx->rx_max != le32_to_cpu(ctx->ncm_parm.dwNtbInMaxSize)) {
__le32 dwNtbInMaxSize = cpu_to_le32(ctx->rx_max); __le32 dwNtbInMaxSize = cpu_to_le32(ctx->rx_max);
err = usbnet_write_cmd(dev, USB_CDC_SET_NTB_INPUT_SIZE, err = usbnet_write_cmd(dev, USB_CDC_SET_NTB_INPUT_SIZE,
@ -162,14 +161,6 @@ static int cdc_ncm_setup(struct usbnet *dev)
dev_dbg(&dev->intf->dev, "Using default maximum transmit length=%d\n", dev_dbg(&dev->intf->dev, "Using default maximum transmit length=%d\n",
CDC_NCM_NTB_MAX_SIZE_TX); CDC_NCM_NTB_MAX_SIZE_TX);
ctx->tx_max = CDC_NCM_NTB_MAX_SIZE_TX; ctx->tx_max = CDC_NCM_NTB_MAX_SIZE_TX;
/* Adding a pad byte here simplifies the handling in
* cdc_ncm_fill_tx_frame, by making tx_max always
* represent the real skb max size.
*/
if (ctx->tx_max % usb_maxpacket(dev->udev, dev->out, 1) == 0)
ctx->tx_max++;
} }
/* /*
@ -439,6 +430,10 @@ advance:
goto error2; goto error2;
} }
/* initialize data interface */
if (cdc_ncm_setup(dev))
goto error2;
/* configure data interface */ /* configure data interface */
temp = usb_set_interface(dev->udev, iface_no, data_altsetting); temp = usb_set_interface(dev->udev, iface_no, data_altsetting);
if (temp) { if (temp) {
@ -453,12 +448,6 @@ advance:
goto error2; goto error2;
} }
/* initialize data interface */
if (cdc_ncm_setup(dev)) {
dev_dbg(&intf->dev, "cdc_ncm_setup() failed\n");
goto error2;
}
usb_set_intfdata(ctx->data, dev); usb_set_intfdata(ctx->data, dev);
usb_set_intfdata(ctx->control, dev); usb_set_intfdata(ctx->control, dev);
@ -475,6 +464,15 @@ advance:
dev->hard_mtu = ctx->tx_max; dev->hard_mtu = ctx->tx_max;
dev->rx_urb_size = ctx->rx_max; dev->rx_urb_size = ctx->rx_max;
/* cdc_ncm_setup will override dwNtbOutMaxSize if it is
* outside the sane range. Adding a pad byte here if necessary
* simplifies the handling in cdc_ncm_fill_tx_frame, making
* tx_max always represent the real skb max size.
*/
if (ctx->tx_max != le32_to_cpu(ctx->ncm_parm.dwNtbOutMaxSize) &&
ctx->tx_max % usb_maxpacket(dev->udev, dev->out, 1) == 0)
ctx->tx_max++;
return 0; return 0;
error2: error2:

View File

@ -752,14 +752,12 @@ EXPORT_SYMBOL_GPL(usbnet_unlink_rx_urbs);
// precondition: never called in_interrupt // precondition: never called in_interrupt
static void usbnet_terminate_urbs(struct usbnet *dev) static void usbnet_terminate_urbs(struct usbnet *dev)
{ {
DECLARE_WAIT_QUEUE_HEAD_ONSTACK(unlink_wakeup);
DECLARE_WAITQUEUE(wait, current); DECLARE_WAITQUEUE(wait, current);
int temp; int temp;
/* ensure there are no more active urbs */ /* ensure there are no more active urbs */
add_wait_queue(&unlink_wakeup, &wait); add_wait_queue(&dev->wait, &wait);
set_current_state(TASK_UNINTERRUPTIBLE); set_current_state(TASK_UNINTERRUPTIBLE);
dev->wait = &unlink_wakeup;
temp = unlink_urbs(dev, &dev->txq) + temp = unlink_urbs(dev, &dev->txq) +
unlink_urbs(dev, &dev->rxq); unlink_urbs(dev, &dev->rxq);
@ -773,15 +771,14 @@ static void usbnet_terminate_urbs(struct usbnet *dev)
"waited for %d urb completions\n", temp); "waited for %d urb completions\n", temp);
} }
set_current_state(TASK_RUNNING); set_current_state(TASK_RUNNING);
dev->wait = NULL; remove_wait_queue(&dev->wait, &wait);
remove_wait_queue(&unlink_wakeup, &wait);
} }
int usbnet_stop (struct net_device *net) int usbnet_stop (struct net_device *net)
{ {
struct usbnet *dev = netdev_priv(net); struct usbnet *dev = netdev_priv(net);
struct driver_info *info = dev->driver_info; struct driver_info *info = dev->driver_info;
int retval; int retval, pm;
clear_bit(EVENT_DEV_OPEN, &dev->flags); clear_bit(EVENT_DEV_OPEN, &dev->flags);
netif_stop_queue (net); netif_stop_queue (net);
@ -791,6 +788,8 @@ int usbnet_stop (struct net_device *net)
net->stats.rx_packets, net->stats.tx_packets, net->stats.rx_packets, net->stats.tx_packets,
net->stats.rx_errors, net->stats.tx_errors); net->stats.rx_errors, net->stats.tx_errors);
/* to not race resume */
pm = usb_autopm_get_interface(dev->intf);
/* allow minidriver to stop correctly (wireless devices to turn off /* allow minidriver to stop correctly (wireless devices to turn off
* radio etc) */ * radio etc) */
if (info->stop) { if (info->stop) {
@ -817,6 +816,9 @@ int usbnet_stop (struct net_device *net)
dev->flags = 0; dev->flags = 0;
del_timer_sync (&dev->delay); del_timer_sync (&dev->delay);
tasklet_kill (&dev->bh); tasklet_kill (&dev->bh);
if (!pm)
usb_autopm_put_interface(dev->intf);
if (info->manage_power && if (info->manage_power &&
!test_and_clear_bit(EVENT_NO_RUNTIME_PM, &dev->flags)) !test_and_clear_bit(EVENT_NO_RUNTIME_PM, &dev->flags))
info->manage_power(dev, 0); info->manage_power(dev, 0);
@ -1437,11 +1439,12 @@ static void usbnet_bh (unsigned long param)
/* restart RX again after disabling due to high error rate */ /* restart RX again after disabling due to high error rate */
clear_bit(EVENT_RX_KILL, &dev->flags); clear_bit(EVENT_RX_KILL, &dev->flags);
// waiting for all pending urbs to complete? /* waiting for all pending urbs to complete?
if (dev->wait) { * only then can we forgo submitting anew
if ((dev->txq.qlen + dev->rxq.qlen + dev->done.qlen) == 0) { */
wake_up (dev->wait); if (waitqueue_active(&dev->wait)) {
} if (dev->txq.qlen + dev->rxq.qlen + dev->done.qlen == 0)
wake_up_all(&dev->wait);
// or are we maybe short a few urbs? // or are we maybe short a few urbs?
} else if (netif_running (dev->net) && } else if (netif_running (dev->net) &&
@ -1580,6 +1583,7 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod)
dev->driver_name = name; dev->driver_name = name;
dev->msg_enable = netif_msg_init (msg_level, NETIF_MSG_DRV dev->msg_enable = netif_msg_init (msg_level, NETIF_MSG_DRV
| NETIF_MSG_PROBE | NETIF_MSG_LINK); | NETIF_MSG_PROBE | NETIF_MSG_LINK);
init_waitqueue_head(&dev->wait);
skb_queue_head_init (&dev->rxq); skb_queue_head_init (&dev->rxq);
skb_queue_head_init (&dev->txq); skb_queue_head_init (&dev->txq);
skb_queue_head_init (&dev->done); skb_queue_head_init (&dev->done);
@ -1791,9 +1795,10 @@ int usbnet_resume (struct usb_interface *intf)
spin_unlock_irq(&dev->txq.lock); spin_unlock_irq(&dev->txq.lock);
if (test_bit(EVENT_DEV_OPEN, &dev->flags)) { if (test_bit(EVENT_DEV_OPEN, &dev->flags)) {
/* handle remote wakeup ASAP */ /* handle remote wakeup ASAP
if (!dev->wait && * we cannot race against stop
netif_device_present(dev->net) && */
if (netif_device_present(dev->net) &&
!timer_pending(&dev->delay) && !timer_pending(&dev->delay) &&
!test_bit(EVENT_RX_HALT, &dev->flags)) !test_bit(EVENT_RX_HALT, &dev->flags))
rx_alloc_submit(dev, GFP_NOIO); rx_alloc_submit(dev, GFP_NOIO);

Some files were not shown because too many files have changed in this diff Show More