2014-01-21 11:24:25 +02:00
/*
* Copyright © 2014 Intel Corporation
*
* Permission is hereby granted , free of charge , to any person obtaining a
* copy of this software and associated documentation files ( the
* " Software " ) , to deal in the Software without restriction , including
* without limitation the rights to use , copy , modify , merge , publish ,
* distribute , sub license , and / or sell copies of the Software , and to
* permit persons to whom the Software is furnished to do so , subject to
* the following conditions :
*
* The above copyright notice and this permission notice ( including the
* next paragraph ) shall be included in all copies or substantial portions
* of the Software .
*
* THE SOFTWARE IS PROVIDED " AS IS " , WITHOUT WARRANTY OF ANY KIND , EXPRESS OR
* IMPLIED , INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY ,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT . IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM , DAMAGES OR OTHER
* LIABILITY , WHETHER IN AN ACTION OF CONTRACT , TORT OR OTHERWISE , ARISING
* FROM , OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE .
*/
2017-12-19 11:43:46 +00:00
# include <drm/drm_print.h>
2015-12-18 13:08:15 +02:00
# include "i915_params.h"
2014-01-21 11:24:25 +02:00
# include "i915_drv.h"
2017-09-14 15:08:03 +00:00
# define i915_param_named(name, T, perm, desc) \
2017-09-19 19:38:44 +00:00
module_param_named ( name , i915_modparams . name , T , perm ) ; \
2017-09-14 15:08:03 +00:00
MODULE_PARM_DESC ( name , desc )
# define i915_param_named_unsafe(name, T, perm, desc) \
2017-09-19 19:38:44 +00:00
module_param_named_unsafe ( name , i915_modparams . name , T , perm ) ; \
2017-09-14 15:08:03 +00:00
MODULE_PARM_DESC ( name , desc )
2017-09-14 15:08:02 +00:00
2017-09-19 19:38:44 +00:00
struct i915_params i915_modparams __read_mostly = {
2019-12-05 17:43:40 +02:00
# define MEMBER(T, member, value, ...) .member = (value),
2017-09-25 10:50:07 +00:00
I915_PARAMS_FOR_EACH ( MEMBER )
# undef MEMBER
2014-01-21 11:24:25 +02:00
} ;
2017-09-14 15:08:03 +00:00
i915_param_named ( modeset , int , 0400 ,
2015-06-23 13:57:47 +02:00
" Use kernel modesetting [KMS] (0=disable, "
2014-01-21 11:24:25 +02:00
" 1=on, -1=force vga console preference [default]) " ) ;
2017-09-14 15:08:03 +00:00
i915_param_named_unsafe ( enable_dc , int , 0400 ,
2015-11-16 15:01:06 +01:00
" Enable power-saving display C-states. "
2019-10-03 13:47:34 +05:30
" (-1=auto [default]; 0=disable; 1=up to DC5; 2=up to DC6; "
" 3=up to DC5 with DC3CO; 4=up to DC6 with DC3CO) " ) ;
2015-11-16 15:01:06 +01:00
2017-09-14 15:08:03 +00:00
i915_param_named_unsafe ( enable_fbc , int , 0600 ,
2014-01-21 11:24:25 +02:00
" Enable frame buffer compression for power savings "
" (default: -1 (use per-chip default)) " ) ;
2017-09-14 15:08:03 +00:00
i915_param_named_unsafe ( lvds_channel_mode , int , 0400 ,
2014-01-21 11:24:25 +02:00
" Specify LVDS channel mode "
" (0=probe BIOS [default], 1=single-channel, 2=dual-channel) " ) ;
2017-09-14 15:08:03 +00:00
i915_param_named_unsafe ( panel_use_ssc , int , 0600 ,
2014-01-21 11:24:25 +02:00
" Use Spread Spectrum Clock with panels [LVDS/eDP] "
" (default: auto from VBT) " ) ;
2017-09-14 15:08:03 +00:00
i915_param_named_unsafe ( vbt_sdvo_panel_type , int , 0400 ,
2014-01-21 11:24:25 +02:00
" Override/Ignore selection of SDVO panel mode in the VBT "
" (-2=ignore, -1=auto [default], index in VBT BIOS table) " ) ;
2017-09-14 15:08:03 +00:00
i915_param_named_unsafe ( reset , int , 0600 ,
" Attempt GPU resets (0=disabled, 1=full gpu reset, 2=engine reset [default]) " ) ;
2014-01-21 11:24:25 +02:00
2017-09-14 15:08:03 +00:00
i915_param_named_unsafe ( vbt_firmware , charp , 0400 ,
" Load VBT from specified file under /lib/firmware " ) ;
2017-08-17 14:52:09 +03:00
2016-10-12 10:05:18 +01:00
# if IS_ENABLED(CONFIG_DRM_I915_CAPTURE_ERROR)
2017-09-14 15:08:03 +00:00
i915_param_named ( error_capture , bool , 0600 ,
2016-10-12 10:05:18 +01:00
" Record the GPU state following a hang. "
" This information in /sys/class/drm/card<N>/error is vital for "
" triaging and debugging hangs. " ) ;
# endif
2018-12-27 16:33:40 +02:00
i915_param_named_unsafe ( enable_hangcheck , bool , 0600 ,
2014-01-21 11:24:25 +02:00
" Periodically check GPU activity for detecting hangs. "
" WARNING: Disabling this can cause system wide hangs. "
" (default: true) " ) ;
2017-09-14 15:08:03 +00:00
i915_param_named_unsafe ( enable_psr , int , 0600 ,
" Enable PSR "
2018-07-11 22:27:15 -07:00
" (0=disabled, 1=enabled) "
2017-09-14 15:08:03 +00:00
" Default: -1 (use per-chip default) " ) ;
2014-01-21 11:24:25 +02:00
2019-05-06 16:48:01 +03:00
i915_param_named_unsafe ( force_probe , charp , 0400 ,
" Force probe the driver for specified devices. "
" See CONFIG_DRM_I915_FORCE_PROBE for details. " ) ;
2017-09-14 15:08:03 +00:00
i915_param_named_unsafe ( disable_power_well , int , 0400 ,
2015-11-05 23:04:11 +02:00
" Disable display power wells when possible "
" (-1=auto [default], 0=power wells always on, 1=power wells disabled when possible) " ) ;
2014-01-21 11:24:25 +02:00
2017-09-14 15:08:03 +00:00
i915_param_named_unsafe ( enable_ips , int , 0600 , " Enable IPS (default: true) " ) ;
2014-01-21 11:24:25 +02:00
2019-01-24 14:01:14 +01:00
i915_param_named ( fastboot , int , 0600 ,
" Try to skip unnecessary mode sets at boot time "
" (0=disabled, 1=enabled) "
" Default: -1 (use per-chip default) " ) ;
2015-11-19 10:26:30 +02:00
2017-09-14 15:08:03 +00:00
i915_param_named_unsafe ( load_detect_test , bool , 0600 ,
2015-03-03 18:03:47 +01:00
" Force-enable the VGA load detect code for testing (default:false). "
" For developers only. " ) ;
2017-09-14 15:08:03 +00:00
i915_param_named_unsafe ( force_reset_modeset_test , bool , 0600 ,
2016-08-05 23:28:28 +03:00
" Force a modeset during gpu reset for testing (default:false). "
" For developers only. " ) ;
2017-09-14 15:08:03 +00:00
i915_param_named_unsafe ( invert_brightness , int , 0600 ,
2014-01-21 11:24:25 +02:00
" Invert backlight brightness "
" (-1 force normal, 0 machine defaults, 1 force inversion), please "
" report PCI device ID, subsystem vendor and subsystem device ID "
" to dri-devel@lists.freedesktop.org, if your machine needs it. "
" It will then be included in an upcoming module version. " ) ;
2014-02-10 17:20:55 +00:00
2017-09-14 15:08:03 +00:00
i915_param_named ( disable_display , bool , 0400 ,
" Disable display (default: false) " ) ;
2014-02-18 10:15:46 -08:00
2017-09-14 15:08:03 +00:00
i915_param_named ( mmio_debug , int , 0600 ,
2014-12-18 10:55:50 +00:00
" Enable the MMIO debug code for the first N failures (default: off). "
" This may negatively affect performance. " ) ;
2014-12-15 13:56:32 -05:00
2017-09-14 15:08:03 +00:00
i915_param_named ( verbose_state_checks , bool , 0600 ,
2014-12-15 13:56:32 -05:00
" Enable verbose logs (ie. WARN_ON()) in case of unexpected hw state conditions. " ) ;
2015-01-22 16:53:12 -08:00
2017-09-14 15:08:03 +00:00
i915_param_named_unsafe ( nuclear_pageflip , bool , 0400 ,
" Force enable atomic functionality on platforms that don't have full support yet. " ) ;
2015-08-26 09:29:56 +02:00
2015-05-06 17:35:48 +05:30
/* WA to get away with the default setting in VBT for early platforms.Will be removed */
2017-09-14 15:08:03 +00:00
i915_param_named_unsafe ( edp_vswing , int , 0400 ,
" Ignore/Override vswing pre-emph table selection from VBT "
" (0=use value from vbt [default], 1=low power swing(200mV), "
" 2=default swing(400mV)) " ) ;
2017-12-06 13:53:15 +00:00
i915_param_named_unsafe ( enable_guc , int , 0400 ,
" Enable GuC load for GuC submission and/or HuC load. "
" Required functionality can be selected using bitmask values. "
2019-07-19 10:48:45 +01:00
" (-1=auto, 0=disable [default], 1=GuC submission, 2=HuC load) " ) ;
2017-09-14 15:08:03 +00:00
i915_param_named ( guc_log_level , int , 0400 ,
2018-01-11 15:24:40 +00:00
" GuC firmware logging level. Requires GuC to be loaded. "
" (-1=auto [default], 0=disable, 1..4=enable with verbosity min..max) " ) ;
2016-03-15 10:14:05 -05:00
2017-09-14 15:08:03 +00:00
i915_param_named_unsafe ( guc_firmware_path , charp , 0400 ,
2017-03-14 15:28:14 +01:00
" GuC firmware path to use instead of the default one " ) ;
2017-09-14 15:08:03 +00:00
i915_param_named_unsafe ( huc_firmware_path , charp , 0400 ,
2017-03-14 15:28:14 +01:00
" HuC firmware path to use instead of the default one " ) ;
2018-04-24 15:20:16 +03:00
i915_param_named_unsafe ( dmc_firmware_path , charp , 0400 ,
" DMC firmware path to use instead of the default one " ) ;
2017-09-14 15:08:03 +00:00
i915_param_named_unsafe ( enable_dp_mst , bool , 0600 ,
2016-03-15 10:14:05 -05:00
" Enable multi-stream transport (MST) for new DisplayPort sinks. (default: true) " ) ;
2017-09-14 15:08:03 +00:00
2018-02-01 17:32:48 +00:00
# if IS_ENABLED(CONFIG_DRM_I915_DEBUG)
2019-10-29 11:20:36 +01:00
i915_param_named_unsafe ( inject_probe_failure , uint , 0400 ,
2016-03-16 13:39:08 +02:00
" Force an error after a number of failure check points (0:disabled (default), N:force failure at the Nth failure check point) " ) ;
2018-02-01 17:32:48 +00:00
# endif
2017-09-14 15:08:03 +00:00
2019-06-20 08:44:16 -07:00
i915_param_named ( enable_dpcd_backlight , int , 0600 ,
" Enable support for DPCD backlight control "
2020-01-16 16:16:12 -05:00
" (-1=use per-VBT LFP backlight type setting [default], 0=disabled, 1=enabled) " ) ;
drm/i915: gvt: Introduce the basic architecture of GVT-g
This patch introduces the very basic framework of GVT-g device model,
includes basic prototypes, definitions, initialization.
v12:
- Call intel_gvt_init() in driver early initialization stage. (Chris)
v8:
- Remove the GVT idr and mutex in intel_gvt_host. (Joonas)
v7:
- Refine the URL link in Kconfig. (Joonas)
- Refine the introduction of GVT-g host support in Kconfig. (Joonas)
- Remove the macro GVT_ALIGN(), use round_down() instead. (Joonas)
- Make "struct intel_gvt" a data member in struct drm_i915_private.(Joonas)
- Remove {alloc, free}_gvt_device()
- Rename intel_gvt_{create, destroy}_gvt_device()
- Expost intel_gvt_init_host()
- Remove the dummy "struct intel_gvt" declaration in intel_gvt.h (Joonas)
v6:
- Refine introduction in Kconfig. (Chris)
- The exposed API functions will take struct intel_gvt * instead of
void *. (Chris/Tvrtko)
- Remove most memebers of strct intel_gvt_device_info. Will add them
in the device model patches.(Chris)
- Remove gvt_info() and gvt_err() in debug.h. (Chris)
- Move GVT kernel parameter into i915_params. (Chris)
- Remove include/drm/i915_gvt.h, as GVT-g will be built within i915.
- Remove the redundant struct i915_gvt *, as the functions in i915
will directly take struct intel_gvt *.
- Add more comments for reviewer.
v5:
Take Tvrtko's comments:
- Fix the misspelled words in Kconfig
- Let functions take drm_i915_private * instead of struct drm_device *
- Remove redundant prints/local varible initialization
v3:
Take Joonas' comments:
- Change file name i915_gvt.* to intel_gvt.*
- Move GVT kernel parameter into intel_gvt.c
- Remove redundant debug macros
- Change error handling style
- Add introductions for some stub functions
- Introduce drm/i915_gvt.h.
Take Kevin's comments:
- Move GVT-g host/guest check into intel_vgt_balloon in i915_gem_gtt.c
v2:
- Introduce i915_gvt.c.
It's necessary to introduce the stubs between i915 driver and GVT-g host,
as GVT-g components is configurable in kernel config. When disabled, the
stubs here do nothing.
Take Joonas' comments:
- Replace boolean return value with int.
- Replace customized info/warn/debug macros with DRM macros.
- Document all non-static functions like i915.
- Remove empty and unused functions.
- Replace magic number with marcos.
- Set GVT-g in kernel config to "n" by default.
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
Cc: Kevin Tian <kevin.tian@intel.com>
Signed-off-by: Zhi Wang <zhi.a.wang@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1466078825-6662-5-git-send-email-zhi.a.wang@intel.com
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-06-16 08:07:00 -04:00
2018-11-16 16:44:47 +02:00
# if IS_ENABLED(CONFIG_DRM_I915_GVT)
2017-09-14 15:08:03 +00:00
i915_param_named ( enable_gvt , bool , 0400 ,
drm/i915: gvt: Introduce the basic architecture of GVT-g
This patch introduces the very basic framework of GVT-g device model,
includes basic prototypes, definitions, initialization.
v12:
- Call intel_gvt_init() in driver early initialization stage. (Chris)
v8:
- Remove the GVT idr and mutex in intel_gvt_host. (Joonas)
v7:
- Refine the URL link in Kconfig. (Joonas)
- Refine the introduction of GVT-g host support in Kconfig. (Joonas)
- Remove the macro GVT_ALIGN(), use round_down() instead. (Joonas)
- Make "struct intel_gvt" a data member in struct drm_i915_private.(Joonas)
- Remove {alloc, free}_gvt_device()
- Rename intel_gvt_{create, destroy}_gvt_device()
- Expost intel_gvt_init_host()
- Remove the dummy "struct intel_gvt" declaration in intel_gvt.h (Joonas)
v6:
- Refine introduction in Kconfig. (Chris)
- The exposed API functions will take struct intel_gvt * instead of
void *. (Chris/Tvrtko)
- Remove most memebers of strct intel_gvt_device_info. Will add them
in the device model patches.(Chris)
- Remove gvt_info() and gvt_err() in debug.h. (Chris)
- Move GVT kernel parameter into i915_params. (Chris)
- Remove include/drm/i915_gvt.h, as GVT-g will be built within i915.
- Remove the redundant struct i915_gvt *, as the functions in i915
will directly take struct intel_gvt *.
- Add more comments for reviewer.
v5:
Take Tvrtko's comments:
- Fix the misspelled words in Kconfig
- Let functions take drm_i915_private * instead of struct drm_device *
- Remove redundant prints/local varible initialization
v3:
Take Joonas' comments:
- Change file name i915_gvt.* to intel_gvt.*
- Move GVT kernel parameter into intel_gvt.c
- Remove redundant debug macros
- Change error handling style
- Add introductions for some stub functions
- Introduce drm/i915_gvt.h.
Take Kevin's comments:
- Move GVT-g host/guest check into intel_vgt_balloon in i915_gem_gtt.c
v2:
- Introduce i915_gvt.c.
It's necessary to introduce the stubs between i915 driver and GVT-g host,
as GVT-g components is configurable in kernel config. When disabled, the
stubs here do nothing.
Take Joonas' comments:
- Replace boolean return value with int.
- Replace customized info/warn/debug macros with DRM macros.
- Document all non-static functions like i915.
- Remove empty and unused functions.
- Replace magic number with marcos.
- Set GVT-g in kernel config to "n" by default.
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
Cc: Kevin Tian <kevin.tian@intel.com>
Signed-off-by: Zhi Wang <zhi.a.wang@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1466078825-6662-5-git-send-email-zhi.a.wang@intel.com
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-06-16 08:07:00 -04:00
" Enable support for Intel GVT-g graphics virtualization host support(default:false) " ) ;
2018-11-16 16:44:47 +02:00
# endif
2017-12-19 11:43:46 +00:00
2019-10-30 17:33:20 +00:00
# if IS_ENABLED(CONFIG_DRM_I915_UNSTABLE_FAKE_LMEM)
i915_param_named_unsafe ( fake_lmem_start , ulong , 0600 ,
" Fake LMEM start offset (default: 0) " ) ;
# endif
2017-12-19 11:43:46 +00:00
static __always_inline void _print_param ( struct drm_printer * p ,
const char * name ,
const char * type ,
const void * x )
{
if ( ! __builtin_strcmp ( type , " bool " ) )
drm_printf ( p , " i915.%s=%s \n " , name , yesno ( * ( const bool * ) x ) ) ;
else if ( ! __builtin_strcmp ( type , " int " ) )
drm_printf ( p , " i915.%s=%d \n " , name , * ( const int * ) x ) ;
else if ( ! __builtin_strcmp ( type , " unsigned int " ) )
drm_printf ( p , " i915.%s=%u \n " , name , * ( const unsigned int * ) x ) ;
2019-10-30 17:33:20 +00:00
else if ( ! __builtin_strcmp ( type , " unsigned long " ) )
drm_printf ( p , " i915.%s=%lu \n " , name , * ( const unsigned long * ) x ) ;
2017-12-19 11:43:46 +00:00
else if ( ! __builtin_strcmp ( type , " char * " ) )
drm_printf ( p , " i915.%s=%s \n " , name , * ( const char * * ) x ) ;
else
2018-10-16 15:29:37 +03:00
WARN_ONCE ( 1 , " no printer defined for param type %s (i915.%s) \n " ,
type , name ) ;
2017-12-19 11:43:46 +00:00
}
/**
* i915_params_dump - dump i915 modparams
* @ params : i915 modparams
* @ p : the & drm_printer
*
* Pretty printer for i915 modparams .
*/
void i915_params_dump ( const struct i915_params * params , struct drm_printer * p )
{
# define PRINT(T, x, ...) _print_param(p, #x, #T, ¶ms->x);
I915_PARAMS_FOR_EACH ( PRINT ) ;
# undef PRINT
}
2018-12-27 16:33:37 +02:00
static __always_inline void dup_param ( const char * type , void * x )
{
if ( ! __builtin_strcmp ( type , " char * " ) )
* ( void * * ) x = kstrdup ( * ( void * * ) x , GFP_ATOMIC ) ;
}
void i915_params_copy ( struct i915_params * dest , const struct i915_params * src )
{
* dest = * src ;
# define DUP(T, x, ...) dup_param(#T, &dest->x);
I915_PARAMS_FOR_EACH ( DUP ) ;
# undef DUP
}
2018-12-27 16:33:38 +02:00
static __always_inline void free_param ( const char * type , void * x )
{
if ( ! __builtin_strcmp ( type , " char * " ) ) {
kfree ( * ( void * * ) x ) ;
* ( void * * ) x = NULL ;
}
}
/* free the allocated members, *not* the passed in params itself */
void i915_params_free ( struct i915_params * params )
{
# define FREE(T, x, ...) free_param(#T, ¶ms->x);
I915_PARAMS_FOR_EACH ( FREE ) ;
# undef FREE
}