Skip to content
Snippets Groups Projects
  1. Jun 04, 2015
  2. Sep 15, 2014
  3. Apr 22, 2014
  4. Apr 17, 2014
  5. Feb 27, 2014
  6. Dec 31, 2013
    • Rafael J. Wysocki's avatar
      ACPIPHP / radeon / nouveau: Fix VGA switcheroo problem related to hotplug · f244d8b6
      Rafael J. Wysocki authored
      The changes in the ACPI-based PCI hotplug (ACPIPHP) subsystem made
      during the 3.12 development cycle uncovered a problem with VGA
      switcheroo that on some systems, when the device-specific method
      (ATPX in the radeon case, _DSM in the nouveau case) is used to turn
      off the discrete graphics, the BIOS generates ACPI hotplug events for
      that device and those events cause ACPIPHP to attempt to remove the
      device from the system (they are events for a device that was present
      previously and is not present any more, so that's what should be done
      according to the spec).  Then, the system stops functioning correctly.
      
      Since the hotplug events in question were simply silently ignored
      previously, the least intrusive way to address that problem is to
      make ACPIPHP ignore them again.  For this purpose, introduce a new
      ACPI device flag, no_hotplug, and modify ACPIPHP to ignore hotplug
      events for PCI devices whose ACPI companions have that flag set.
      Next, make the radeon and nouveau switcheroo detection code set the
      no_hotplug flag for the discrete graphics' ACPI companion.
      
      Fixes: bbd34fcd (ACPI / hotplug / PCI: Register all devices under the given bridge)
      References: https://bugzilla.kernel.org/show_bug.cgi?id=61891
      References: https://bugzilla.kernel.org/show_bug.cgi?id=64891
      
      
      Reported-and-tested-by: default avatarMike Lothian <mike@fireburn.co.uk>
      Reported-and-tested-by: default avatar <madcatx@atlas.cz>
      Reported-and-tested-by: default avatarJoaquín Aramendía <samsagax@gmail.com>
      Cc: Alex Deucher <alexdeucher@gmail.com>
      Cc: Dave Airlie <airlied@linux.ie>
      Cc: Takashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Cc: 3.12+ <stable@vger.kernel.org> # 3.12+
      f244d8b6
  7. Nov 14, 2013
    • Rafael J. Wysocki's avatar
      ACPI: Eliminate the DEVICE_ACPI_HANDLE() macro · 3a83f992
      Rafael J. Wysocki authored
      
      Since DEVICE_ACPI_HANDLE() is now literally identical to
      ACPI_HANDLE(), replace it with the latter everywhere and drop its
      definition from include/acpi.h.
      
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3a83f992
    • Rafael J. Wysocki's avatar
      ACPI / driver core: Store an ACPI device pointer in struct acpi_dev_node · 7b199811
      Rafael J. Wysocki authored
      
      Modify struct acpi_dev_node to contain a pointer to struct acpi_device
      associated with the given device object (that is, its ACPI companion
      device) instead of an ACPI handle corresponding to it.  Introduce two
      new macros for manipulating that pointer in a CONFIG_ACPI-safe way,
      ACPI_COMPANION() and ACPI_COMPANION_SET(), and rework the
      ACPI_HANDLE() macro to take the above changes into account.
      Drop the ACPI_HANDLE_SET() macro entirely and rework its users to
      use ACPI_COMPANION_SET() instead.  For some of them who used to
      pass the result of acpi_get_child() directly to ACPI_HANDLE_SET()
      introduce a helper routine acpi_preset_companion() doing an
      equivalent thing.
      
      The main motivation for doing this is that there are things
      represented by struct acpi_device objects that don't have valid
      ACPI handles (so called fixed ACPI hardware features, such as
      power and sleep buttons) and we would like to create platform
      device objects for them and "glue" them to their ACPI companions
      in the usual way (which currently is impossible due to the
      lack of valid ACPI handles).  However, there are more reasons
      why it may be useful.
      
      First, struct acpi_device pointers allow of much better type checking
      than void pointers which are ACPI handles, so it should be more
      difficult to write buggy code using modified struct acpi_dev_node
      and the new macros.  Second, the change should help to reduce (over
      time) the number of places in which the result of ACPI_HANDLE() is
      passed to acpi_bus_get_device() in order to obtain a pointer to the
      struct acpi_device associated with the given "physical" device,
      because now that pointer is returned by ACPI_COMPANION() directly.
      Finally, the change should make it easier to write generic code that
      will build both for CONFIG_ACPI set and unset without adding explicit
      compiler directives to it.
      
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Tested-by: Mika Westerberg <mika.westerberg@linux.intel.com> # on Haswell
      Reviewed-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
      Reviewed-by: Aaron Lu <aaron.lu@intel.com> # for ATA and SDIO part
      7b199811
  8. Nov 01, 2013
  9. Feb 20, 2013
  10. Nov 01, 2012
  11. Oct 24, 2012
  12. Oct 16, 2012
  13. Sep 20, 2012
  14. Aug 20, 2012
  15. Feb 02, 2012
  16. Jan 24, 2012
    • Igor Murzov's avatar
      drm/radeon: finish getting bios earlier · 211fa4fc
      Igor Murzov authored
      
      Return a number of bytes read in radeon_atrm_get_bios_chunk() and
      properly check this value in radeon_atrm_get_bios().
      If radeon_atrm_get_bios_chunk() read less bytes then were requested,
      it means that it finished reading bios data.
      
      Prior to this patch, condition in radeon_atrm_get_bios() was always
      equivalent to "if (ATRM_BIOS_PAGE <= 0)", so it was always false,
      thus radeon_atrm_get_bios() was trying to read past the bios data
      wasting boot time.
      
      On my lenovo ideapad u455 laptop this patch drops bios reading time
      from ~5.5s to ~1.5s.
      
      Signed-off-by: default avatarIgor Murzov <e-mail@date.by>
      Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      211fa4fc
    • Igor Murzov's avatar
      drm/radeon: fix invalid memory access in radeon_atrm_get_bios() · a3f83ab1
      Igor Murzov authored
      
      At a boot time I observed following bug:
      
       BUG: unable to handle kernel paging request at ffff8800a4244000
       IP: [<ffffffff81275b5b>] memcpy+0xb/0x120
       PGD 1816063 PUD 1fe7d067 PMD 1ff9f067 PTE 80000000a4244160
       Oops: 0000 [#1] SMP DEBUG_PAGEALLOC
       CPU 0
       Modules linked in: btusb bluetooth brcmsmac brcmutil crc8 cordic b43 radeon(+)
        mac80211 cfg80211 ttm ohci_hcd drm_kms_helper rfkill drm ssb agpgart mmc_core
        sp5100_tco video battery ac thermal processor rtc_cmos thermal_sys snd_hda_codec_hdmi
        joydev snd_hda_codec_conexant button bcma pcmcia snd_hda_intel snd_hda_codec
        snd_hwdep snd_pcm shpchp pcmcia_core k8temp snd_timer atl1c snd psmouse hwmon
        i2c_piix4 i2c_algo_bit soundcore evdev i2c_core ehci_hcd sg serio_raw snd_page_alloc
        loop btrfs
      
       Pid: 1008, comm: modprobe Not tainted 3.3.0-rc1 #21 LENOVO 20046                           /AMD CRB
       RIP: 0010:[<ffffffff81275b5b>]  [<ffffffff81275b5b>] memcpy+0xb/0x120
       RSP: 0018:ffff8800aa72db00  EFLAGS: 00010246
       RAX: ffff8800a4150000 RBX: 0000000000001000 RCX: 0000000000000087
       RDX: 0000000000000000 RSI: ffff8800a4244000 RDI: ffff8800a4150bc8
       RBP: ffff8800aa72db78 R08: 0000000000000010 R09: ffffffff8174bbec
       R10: ffffffff812ee010 R11: 0000000000000001 R12: 0000000000001000
       R13: 0000000000010000 R14: ffff8800a4140000 R15: ffff8800aaba1800
       FS:  00007ff9a3bd4720(0000) GS:ffff8800afa00000(0000) knlGS:0000000000000000
       CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
       CR2: ffff8800a4244000 CR3: 00000000a9c18000 CR4: 00000000000006f0
       DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
       DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
       Process modprobe (pid: 1008, threadinfo ffff8800aa72c000, task ffff8800aa0e4000)
       Stack:
        ffffffffa04e7c7b 0000000000000001 0000000000010000 ffff8800aa72db28
        ffffffff00000001 0000000000001000 ffffffff8113cbef 0000000000000020
        ffff8800a4243420 ffff880000000002 ffff8800aa72db08 ffff8800a9d42000
       Call Trace:
        [<ffffffffa04e7c7b>] ? radeon_atrm_get_bios_chunk+0x8b/0xd0 [radeon]
        [<ffffffff8113cbef>] ? kmalloc_order_trace+0x3f/0xb0
        [<ffffffffa04a9298>] radeon_get_bios+0x68/0x2f0 [radeon]
        [<ffffffffa04c7a30>] rv770_init+0x40/0x280 [radeon]
        [<ffffffffa047d740>] radeon_device_init+0x560/0x600 [radeon]
        [<ffffffffa047ef4f>] radeon_driver_load_kms+0xaf/0x170 [radeon]
        [<ffffffffa043cdde>] drm_get_pci_dev+0x18e/0x2c0 [drm]
        [<ffffffffa04e7e95>] radeon_pci_probe+0xad/0xb5 [radeon]
        [<ffffffff81296c5f>] local_pci_probe+0x5f/0xd0
        [<ffffffff81297418>] pci_device_probe+0x88/0xb0
        [<ffffffff813417aa>] ? driver_sysfs_add+0x7a/0xb0
        [<ffffffff813418d8>] really_probe+0x68/0x180
        [<ffffffff81341be5>] driver_probe_device+0x45/0x70
        [<ffffffff81341cb3>] __driver_attach+0xa3/0xb0
        [<ffffffff81341c10>] ? driver_probe_device+0x70/0x70
        [<ffffffff813400ce>] bus_for_each_dev+0x5e/0x90
        [<ffffffff8134172e>] driver_attach+0x1e/0x20
        [<ffffffff81341298>] bus_add_driver+0xc8/0x280
        [<ffffffff813422c6>] driver_register+0x76/0x140
        [<ffffffff812976d6>] __pci_register_driver+0x66/0xe0
        [<ffffffffa043d021>] drm_pci_init+0x111/0x120 [drm]
        [<ffffffff8133c67a>] ? vga_switcheroo_register_handler+0x3a/0x60
        [<ffffffffa0229000>] ? 0xffffffffa0228fff
        [<ffffffffa02290ec>] radeon_init+0xec/0xee [radeon]
        [<ffffffff810002f2>] do_one_initcall+0x42/0x180
        [<ffffffff8109d8d2>] sys_init_module+0x92/0x1e0
        [<ffffffff815407a9>] system_call_fastpath+0x16/0x1b
       Code: 58 2a 43 50 88 43 4e 48 83 c4 08 5b c9 c3 66 90 e8 cb fd ff ff eb
        e6 90 90 90 90 90 90 90 90 90 48 89 f8 89 d1 c1 e9 03 83 e2 07 <f3> 48
        a5 89 d1 f3 a4 c3 20 48 83 ea 20 4c 8b 06 4c 8b 4e 08 4c
       RIP  [<ffffffff81275b5b>] memcpy+0xb/0x120
        RSP <ffff8800aa72db00>
       CR2: ffff8800a4244000
       ---[ end trace fcffa1599cf56382 ]---
      
      Call to acpi_evaluate_object() not always returns 4096 bytes chunks,
      on my system it can return 2048 bytes chunk, so pass the length of
      retrieved chunk to memcpy(), not the length of the recieving buffer.
      
      Signed-off-by: default avatarIgor Murzov <e-mail@date.by>
      Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      a3f83ab1
  17. May 08, 2011
  18. Mar 30, 2010
    • Tejun Heo's avatar
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking... · 5a0e3ad6
      Tejun Heo authored
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
      
      percpu.h is included by sched.h and module.h and thus ends up being
      included when building most .c files.  percpu.h includes slab.h which
      in turn includes gfp.h making everything defined by the two files
      universally available and complicating inclusion dependencies.
      
      percpu.h -> slab.h dependency is about to be removed.  Prepare for
      this change by updating users of gfp and slab facilities include those
      headers directly instead of assuming availability.  As this conversion
      needs to touch large number of source files, the following script is
      used as the basis of conversion.
      
        http://userweb.kernel.org/~tj/misc/slabh-sweep.py
      
      
      
      The script does the followings.
      
      * Scan files for gfp and slab usages and update includes such that
        only the necessary includes are there.  ie. if only gfp is used,
        gfp.h, if slab is used, slab.h.
      
      * When the script inserts a new include, it looks at the include
        blocks and try to put the new include such that its order conforms
        to its surrounding.  It's put in the include block which contains
        core kernel includes, in the same order that the rest are ordered -
        alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
        doesn't seem to be any matching order.
      
      * If the script can't find a place to put a new include (mostly
        because the file doesn't have fitting include block), it prints out
        an error message indicating which .h file needs to be added to the
        file.
      
      The conversion was done in the following steps.
      
      1. The initial automatic conversion of all .c files updated slightly
         over 4000 files, deleting around 700 includes and adding ~480 gfp.h
         and ~3000 slab.h inclusions.  The script emitted errors for ~400
         files.
      
      2. Each error was manually checked.  Some didn't need the inclusion,
         some needed manual addition while adding it to implementation .h or
         embedding .c file was more appropriate for others.  This step added
         inclusions to around 150 files.
      
      3. The script was run again and the output was compared to the edits
         from #2 to make sure no file was left behind.
      
      4. Several build tests were done and a couple of problems were fixed.
         e.g. lib/decompress_*.c used malloc/free() wrappers around slab
         APIs requiring slab.h to be added manually.
      
      5. The script was run on all .h files but without automatically
         editing them as sprinkling gfp.h and slab.h inclusions around .h
         files could easily lead to inclusion dependency hell.  Most gfp.h
         inclusion directives were ignored as stuff from gfp.h was usually
         wildly available and often used in preprocessor macros.  Each
         slab.h inclusion directive was examined and added manually as
         necessary.
      
      6. percpu.h was updated not to include slab.h.
      
      7. Build test were done on the following configurations and failures
         were fixed.  CONFIG_GCOV_KERNEL was turned off for all tests (as my
         distributed build env didn't work with gcov compiles) and a few
         more options had to be turned off depending on archs to make things
         build (like ipr on powerpc/64 which failed due to missing writeq).
      
         * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
         * powerpc and powerpc64 SMP allmodconfig
         * sparc and sparc64 SMP allmodconfig
         * ia64 SMP allmodconfig
         * s390 SMP allmodconfig
         * alpha SMP allmodconfig
         * um on x86_64 SMP allmodconfig
      
      8. percpu.h modifications were reverted so that it could be applied as
         a separate patch and serve as bisection point.
      
      Given the fact that I had only a couple of failures from tests on step
      6, I'm fairly confident about the coverage of this conversion patch.
      If there is a breakage, it's likely to be something in one of the arch
      headers which should be easily discoverable easily on most builds of
      the specific arch.
      
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Guess-its-ok-by: default avatarChristoph Lameter <cl@linux-foundation.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
      5a0e3ad6
  19. Mar 01, 2010
    • Dave Airlie's avatar
      vga_switcheroo: fix build on platforms with no ACPI · 8edb381d
      Dave Airlie authored
      
      radeon was always including the atpx code unnecessarily, also core
      switcheroo was including acpi headers.
      
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      8edb381d
    • Dave Airlie's avatar
      vga_switcheroo: initial implementation (v15) · 6a9ee8af
      Dave Airlie authored
      
      Many new laptops now come with 2 gpus, one to be used for low power
      modes and one for gaming/on-ac applications. These GPUs are typically
      wired to the laptop panel and VGA ports via a multiplexer unit which
      is controlled via ACPI methods.
      
      4 combinations of systems typically exist - with 2 ACPI methods.
      Intel/ATI - Lenovo W500/T500 - use ATPX ACPI method
      ATI/ATI - some ASUS - use ATPX ACPI Method
      Intel/Nvidia - - use _DSM ACPI method
      Nvidia/Nvidia -  - use _DSM ACPI method.
      
      TODO:
      This patch adds support for the ATPX method and initial bits
      for the _DSM methods that need to written by someone with
      access to the hardware.
      Add a proper non-debugfs interface - need to get some proper
      testing first.
      
      v2: add power up/down support for both devices
      on W500 puts i915/radeon into D3 and cuts power to radeon.
      
      v3: redo probing methods, no DMI list, drm devices call to
      register with switcheroo, it tries to find an ATPX method on
      any device and once there is two devices + ATPX it inits the
      switcher.
      
      v4: ATPX msg handling using buffers - should work on more machines
      
      v5: rearchitect after more mjg59 discussion - move ATPX handling to
          radeon driver.
      
      v6: add file headers + initial nouveau bits (to be filled out).
      
      v7: merge delayed switcher code.
      
      v8: avoid suspend/resume of gpu that is off
      
      v9: rearchitect - mjg59 is always right. - move all ATPX code to
      radeon, should allow simpler DSM also proper ATRM handling
      
      v10: add ATRM support for radeon BIOS, add mutex to lock vgasr_priv
      
      v11: fix bug in resuming Intel for 2nd time.
      
      v12: start fixing up nvidia code blindly.
      
      v13: blindly guess at finishing nvidia code
      
      v14: remove radeon audio hacks - fix up intel resume more like upstream
      
      v15: clean up printks + remove unnecessary igd/dis pointers
      
      mount debugfs
      
      /sys/kernel/debug/vgaswitcheroo/switch - should exist if ATPX detected
       + 2 cards.
      
      DIS - immediate change to discrete
      IGD - immediate change to IGD
      DDIS - delayed change to discrete
      DIGD - delayed change to IGD
      ON - turn on not in use
      OFF - turn off not in use
      
      Tested on W500 (Intel/ATI) and T500 (Intel/ATI)
      
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      6a9ee8af
Loading