1
0
Fork 0
Commit Graph

5263 Commits (d548ca43d0333a0c4af0c79e9e6aafc29cd5a854)

Author SHA1 Message Date
Linus Torvalds d70b3ef54c Merge branch 'x86-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 core updates from Ingo Molnar:
 "There were so many changes in the x86/asm, x86/apic and x86/mm topics
  in this cycle that the topical separation of -tip broke down somewhat -
  so the result is a more traditional architecture pull request,
  collected into the 'x86/core' topic.

  The topics were still maintained separately as far as possible, so
  bisectability and conceptual separation should still be pretty good -
  but there were a handful of merge points to avoid excessive
  dependencies (and conflicts) that would have been poorly tested in the
  end.

  The next cycle will hopefully be much more quiet (or at least will
  have fewer dependencies).

  The main changes in this cycle were:

   * x86/apic changes, with related IRQ core changes: (Jiang Liu, Thomas
     Gleixner)

     - This is the second and most intrusive part of changes to the x86
       interrupt handling - full conversion to hierarchical interrupt
       domains:

          [IOAPIC domain]   -----
                                 |
          [MSI domain]      --------[Remapping domain] ----- [ Vector domain ]
                                 |   (optional)          |
          [HPET MSI domain] -----                        |
                                                         |
          [DMAR domain]     -----------------------------
                                                         |
          [Legacy domain]   -----------------------------

       This now reflects the actual hardware and allowed us to distangle
       the domain specific code from the underlying parent domain, which
       can be optional in the case of interrupt remapping.  It's a clear
       separation of functionality and removes quite some duct tape
       constructs which plugged the remap code between ioapic/msi/hpet
       and the vector management.

     - Intel IOMMU IRQ remapping enhancements, to allow direct interrupt
       injection into guests (Feng Wu)

   * x86/asm changes:

     - Tons of cleanups and small speedups, micro-optimizations.  This
       is in preparation to move a good chunk of the low level entry
       code from assembly to C code (Denys Vlasenko, Andy Lutomirski,
       Brian Gerst)

     - Moved all system entry related code to a new home under
       arch/x86/entry/ (Ingo Molnar)

     - Removal of the fragile and ugly CFI dwarf debuginfo annotations.
       Conversion to C will reintroduce many of them - but meanwhile
       they are only getting in the way, and the upstream kernel does
       not rely on them (Ingo Molnar)

     - NOP handling refinements. (Borislav Petkov)

   * x86/mm changes:

     - Big PAT and MTRR rework: making the code more robust and
       preparing to phase out exposing direct MTRR interfaces to drivers -
       in favor of using PAT driven interfaces (Toshi Kani, Luis R
       Rodriguez, Borislav Petkov)

     - New ioremap_wt()/set_memory_wt() interfaces to support
       Write-Through cached memory mappings.  This is especially
       important for good performance on NVDIMM hardware (Toshi Kani)

   * x86/ras changes:

     - Add support for deferred errors on AMD (Aravind Gopalakrishnan)

       This is an important RAS feature which adds hardware support for
       poisoned data.  That means roughly that the hardware marks data
       which it has detected as corrupted but wasn't able to correct, as
       poisoned data and raises an APIC interrupt to signal that in the
       form of a deferred error.  It is the OS's responsibility then to
       take proper recovery action and thus prolonge system lifetime as
       far as possible.

     - Add support for Intel "Local MCE"s: upcoming CPUs will support
       CPU-local MCE interrupts, as opposed to the traditional system-
       wide broadcasted MCE interrupts (Ashok Raj)

     - Misc cleanups (Borislav Petkov)

   * x86/platform changes:

     - Intel Atom SoC updates

  ... and lots of other cleanups, fixlets and other changes - see the
  shortlog and the Git log for details"

* 'x86-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (222 commits)
  x86/hpet: Use proper hpet device number for MSI allocation
  x86/hpet: Check for irq==0 when allocating hpet MSI interrupts
  x86/mm/pat, drivers/infiniband/ipath: Use arch_phys_wc_add() and require PAT disabled
  x86/mm/pat, drivers/media/ivtv: Use arch_phys_wc_add() and require PAT disabled
  x86/platform/intel/baytrail: Add comments about why we disabled HPET on Baytrail
  genirq: Prevent crash in irq_move_irq()
  genirq: Enhance irq_data_to_desc() to support hierarchy irqdomain
  iommu, x86: Properly handle posted interrupts for IOMMU hotplug
  iommu, x86: Provide irq_remapping_cap() interface
  iommu, x86: Setup Posted-Interrupts capability for Intel iommu
  iommu, x86: Add cap_pi_support() to detect VT-d PI capability
  iommu, x86: Avoid migrating VT-d posted interrupts
  iommu, x86: Save the mode (posted or remapped) of an IRTE
  iommu, x86: Implement irq_set_vcpu_affinity for intel_ir_chip
  iommu: dmar: Provide helper to copy shared irte fields
  iommu: dmar: Extend struct irte for VT-d Posted-Interrupts
  iommu: Add new member capability to struct irq_remap_ops
  x86/asm/entry/64: Disentangle error_entry/exit gsbase/ebx/usermode code
  x86/asm/entry/32: Shorten __audit_syscall_entry() args preparation
  x86/asm/entry/32: Explain reloading of registers after __audit_syscall_entry()
  ...
2015-06-22 17:59:09 -07:00
Rafael J. Wysocki e193cd15ae Merge branch 'acpi-cca'
* acpi-cca:
  ufs: fix TRUE and FALSE re-define build error
  megaraid_sas: fix TRUE and FALSE re-define build error
  amd-xgbe: Unify coherency checking logic with device_dma_is_coherent()
  crypto: ccp - Unify coherency checking logic with device_dma_is_coherent()
  device property: Introduces device_dma_is_coherent()
  arm64 : Introduce support for ACPI _CCA object
  ACPI / scan: Parse _CCA and setup device coherency
2015-06-19 01:17:35 +02:00
Rafael J. Wysocki 4def8a360f Merge branch 'acpi-video'
* acpi-video: (38 commits)
  ACPI / video: Make acpi_video_unregister_backlight() private
  acpi-video-detect: Remove old API
  toshiba-acpi: Port to new backlight interface selection API
  thinkpad-acpi: Port to new backlight interface selection API
  sony-laptop: Port to new backlight interface selection API
  samsung-laptop: Port to new backlight interface selection API
  msi-wmi: Port to new backlight interface selection API
  msi-laptop: Port to new backlight interface selection API
  intel-oaktrail: Port to new backlight interface selection API
  ideapad-laptop: Port to new backlight interface selection API
  fujitsu-laptop: Port to new backlight interface selection API
  eeepc-laptop: Port to new backlight interface selection API
  dell-wmi: Port to new backlight interface selection API
  dell-laptop: Port to new backlight interface selection API
  compal-laptop: Port to new backlight interface selection API
  asus-wmi: Port to new backlight interface selection API
  asus-laptop: Port to new backlight interface selection API
  apple-gmux: Port to new backlight interface selection API
  acer-wmi: Port to new backlight interface selection API
  ACPI / video: Fix acpi_video _register vs _unregister_backlight race
  ...
2015-06-19 01:17:26 +02:00
Rafael J. Wysocki 763d949581 Merge branches 'acpi-battery' and 'acpi-processor'
* acpi-battery:
  ACPI / battery: mark DMI table as __initconst
  ACPI / battery: minor tweaks to acpi_battery_units()
  ACPI / battery: constify the offset tables
  ACPI / battery: ensure acpi_battery_init() has finish
  ACPI / battery: drop useless return statements
  ACPI / battery: abort initialization earlier if acpi_disabled

* acpi-processor:
  ACPI / processor: constify DMI system id table
  ACPI / processor: Introduce invalid_phys_cpuid()
  ACPI / processor: return specific error instead of -1
  ACPI / processor: remove phys_id in acpi_processor_get_info()
  ACPI / processor: remove cpu_index in acpi_processor_get_info()
  Xen / ACPI / processor: Remove unneeded NULL check
  Xen / ACPI / processor: use invalid_logical_cpuid()
  ACPI / processor: Introduce invalid_logical_cpuid()
2015-06-19 01:17:18 +02:00
Rafael J. Wysocki 0cddc580d4 Merge branches 'acpi-ac', 'acpi-soc' and 'acpi-assorted'
* acpi-ac:
  ACPI / AC: constify DMI system id table

* acpi-soc:
  ACPI / LPSS: constify device descriptors

* acpi-assorted:
  ACPI / HED: constify ACPI device ids
2015-06-19 01:17:03 +02:00
Rafael J. Wysocki feabe392ed Merge branch 'acpi-ec'
* acpi-ec:
  ACPI / EC: Fix a code coverity issue when QR_EC transactions are failed.
  ACPI / EC: Fix EC_FLAGS_QUERY_HANDSHAKE platforms using new event clearing timing.
  ACPI / EC: Add event clearing variation support.
  ACPI / EC: Convert event handling work queue into loop style.
  ACPI / EC: Cleanup transaction state transition.
  ACPI / EC: Remove non-root-caused busy polling quirks.
  ACPI / EC: Add module params for polling modes.
  ACPI / EC: Fix and clean up register access guarding logics.
  ACPI / EC: Remove irqs_disabled() check.
  ACPI / EC: Remove storming threashold enlarging quirk.
  ACPI / EC: Update acpi_ec_is_gpe_raised() with new GPE status flag.
2015-06-19 01:16:45 +02:00
Rafael J. Wysocki 4f1fd900c2 Merge branches 'acpi-pm', 'acpi-apei', 'acpi-osl' and 'acpi-pci'
* acpi-pm:
  ACPI / PM: Add missing pm_generic_complete() invocation
  ACPI / PM: Turn power resources on and off in the right order during resume
  ACPI / PM: Rework device power management to follow ACPI 6
  ACPI / PM: Drop stale comment from acpi_power_transition()

* acpi-apei:
  GHES: Make NMI handler have a single reader
  GHES: Elliminate double-loop in the NMI handler
  GHES: Panic right after detection
  GHES: Carve out the panic functionality
  GHES: Carve out error queueing in a separate function

* acpi-osl:
  ACPI / osl: use same type for acpi_predefined_names values as in definition

* acpi-pci:
  ACPI / PCI: remove stale list_head in struct acpi_prt_entry
2015-06-19 01:16:21 +02:00
Rafael J. Wysocki 3a5cf05adf Merge branches 'acpi-init', 'acpi-pnp', 'acpi-scan', 'acpi-proc' and 'acpi-doc'
* acpi-init:
  ACPI / init: Switch over platform to the ACPI mode later

* acpi-pnp:
  ACPI / PNP: Avoid conflicting resource reservations

* acpi-scan:
  ACPI / scan: constify ACPI device ids
  ACPI / property: Define a symbol for PRP0001
  ACPI / property: Refine consistency check for PRP0001

* acpi-proc:
  ACPI / proc: make ACPI_PROCFS_POWER X86 only

* acpi-doc:
  ACPI: Constify ACPI device IDs in documentation
  ACPI / enumeration: Document the rules regarding the PRP0001 device ID
  ACPI: fix kernel-parameters ordering in Documentation
2015-06-19 01:15:49 +02:00
Rafael J. Wysocki 9695a98052 Merge branch 'acpica'
* acpica: (22 commits)
  ACPICA: Fix for ill-formed GUID strings for NFIT tables.
  ACPICA: acpihelp: Update for new NFIT table GUIDs.
  ACPICA: Update version to 20150515.
  ACPICA: ACPI 6.0: Add support for NFIT table.
  ACPICA: acpi_help: Add option to display all known/supported ACPI tables.
  ACPICA: iASL/disassembler - fix possible fault for -e option.
  ACPICA: ACPI 6.0: Add changes for DRTM table.
  ACPICA: ACPI 6.0: Add support for IORT table.
  ACPICA: ACPI 6.0: Add ACPI_SUB_PTR().
  ACPICA: ACPI 6.0: Add changes for MADT table.
  ACPICA: Hardware: Fix a resource leak issue in acpi_hw_build_pci_list().
  ACPICA: Dispatcher: Fix a resource leak issue in acpi_ds_auto_serialize_method().
  ACPICA: ACPI 6.0: Add changes for LPIT table.
  ACPICA: ACPI 6.0: Add changes for FADT table.
  ACPICA: ACPI 6.0: Add support for WPBT table.
  ACPICA: iASL: Enhance detection of non-ascii or corrupted input files.
  ACPICA: Parser: Move a couple externals to the proper header.
  ACPICA: ACPI 6.0: Add support for XENV table.
  ACPICA: ACPI 6.0: Add support for new predefined names.
  ACPICA: ACPI 6.0: Add support for STAO table.
  ...
2015-06-19 01:15:19 +02:00
Hans de Goede e7d024c00a ACPI / video: Make acpi_video_unregister_backlight() private
acpi_video_unregister_backlight() is now only used by video_detect.c
which is part of the same acpi_video module as video.c, make
acpi_video_unregister_backlight() private to this module.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Darren Hart <dvhart@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-06-19 01:12:50 +02:00
Hans de Goede d0a530ba42 acpi-video-detect: Remove old API
Remove the old backlight interface selection API now that all drivers
have been ported to the new API.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Darren Hart <dvhart@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-06-19 01:12:45 +02:00
Hans de Goede 2a8b18e9fb ACPI / video: Fix acpi_video _register vs _unregister_backlight race
It is possible for a native backlight driver to load while
acpi_video_register is running, which may lead to
acpi_video_unregister_backlight being called while acpi_video_register
is running and the 2 racing against eachother.

The register_count variable protects against this, but not in a thread
safe manner, this commit adds locking to make this thread safe.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Darren Hart <dvhart@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-06-19 01:11:14 +02:00
Hans de Goede 7ee33baabc ACPI / video: Move dmi_check_system from module_init to acpi_video_register
When builtin there is no guarantee in which order module_init functions
are run, so acpi_video_register() may get called from the i915 driver
(if it is also builtin) before acpi_video_init() gets called, resulting
in the dmi quirks not yet being parsed.

This commit moves the dmi_check_system() call to acpi_video_register(),
so that we can be sure the dmi quirks have always been applied before
probing.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Darren Hart <dvhart@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-06-19 01:11:09 +02:00
Hans de Goede 93a291dfaf ACPI / video: Move backlight notifier to video_detect.c
Move the unregistering of the acpi backlight interface on registering of a
native backlight from video.c to video_detect.c where it belongs.

Note this removes support for re-registering the acpi backlight interface
when the native interface goes away. In practice this never happens and
it needlessly complicates the code.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Darren Hart <dvhart@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-06-19 01:11:04 +02:00
Hans de Goede 3bd6bce369 ACPI / video: Port to new backlight interface selection API
Most of the patch is moving the dmi quirks for forcing use of the
acpi-video / the native backlight interface to video_detect.c.

What remains is a nice cleanup.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Darren Hart <dvhart@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-06-19 01:10:59 +02:00
Hans de Goede 5fd677b75d acpi-video-detect: Unregister acpi_video backlight when dmi quirks are added
Make acpi_video_set_dmi_backlight_type() call
acpi_video_unregister_backlight() when the new dmi quirk results in
the desired backlight interface being of a type other then
acpi_backlight_video.

This avoid the need for the second if in the following construction
which is currently found in many platform/x86 drivers:

	if (prefer_vendor_quirk)
		acpi_video_dmi_promote_vendor();

	if (!acpi_video_backlight_support())
		acpi_video_unregister_backlight()

This second if-block will be removed from the platform drivers as part
of their conversion to the new backlight interface selection API.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Darren Hart <dvhart@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-06-19 01:10:49 +02:00
Hans de Goede 87521e16a7 acpi-video-detect: Rewrite backlight interface selection logic
Currently we have 2 kernel commandline options + dmi-quirks in 3 places all
interacting (in interesting ways) to select which which backlight interface
to use. On the commandline we've acpi_backlight=[video|vendor] and
video.use_native_backlight=[0|1]. DMI quirks we have in
acpi/video-detect.c, acpi/video.c and drivers/platform/x86/*.c .

This commit is the first step to cleaning this up, replacing the 2 cmdline
options with just acpi_backlight=[video|vendor|native|none], and adds a
new API to video_detect.c to reflect this.

Follow up commits will also move other related code, like unregistering the
acpi_video backlight interface if it was registered before other drivers
which take priority over it are loaded, to video_detect.c where this
logic really belongs.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Darren Hart <dvhart@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-06-19 01:10:44 +02:00
Hans de Goede 14ca7a47d0 acpi-video-detect: video: Make video_detect code part of the video module
This is a preparation patch for the backlight interface selection logic
cleanup, there are 2 reasons to not always build the video_detect code
into the kernel:

1) In order for the video_detect.c to also deal with / select native
backlight interfaces on win8 systems, instead of doing this in video.c
where it does not belong, video_detect.c needs to call into the backlight
class code. Which cannot be done if it is builtin and the blacklight class
is not.

2) Currently all the platform/x86 drivers which have quirks to prefer
the vendor driver over acpi-video call acpi_video_unregister_backlight()
to remove the acpi-video backlight interface, this logic really belongs
in video_detect.c, which will cause video_detect.c to depend on symbols of
video.c and video.c already depends on video_detect.c symbols, so they
really need to be a single module.

Note that this commits make 2 changes so as to maintain 100% kernel
commandline compatibility:

1) The __setup call for the acpi_backlight= handling is moved to
   acpi/util.c as __setup may only be used by code which is alwasy builtin
2) video.c is renamed to acpi_video.c so that it can be combined with
   video_detect.c into video.ko

This commit also makes changes to drivers/platform/x86/Kconfig to ensure
that drivers which use acpi_video_backlight_support() from video_detect.c,
will not be built-in when acpi_video is not built in. This also changes
some "select" uses to "depends on" to avoid dependency loops.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Darren Hart <dvhart@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-06-19 01:10:36 +02:00
Hans de Goede a87878bafa acpi-video-detect: Move acpi_osi_is_win8 to osl.c
acpi_osi_is_win8 needs access to acpi_gbl_osi_data which is not exported,
so move it to osl.c. Alternatively we could export acpi_gbl_osi_data but
that seems undesirable.

This allows video_detect.c to be build as a module, besides that
acpi_osi_is_win8() is something which does not really belong in
video_detect.c in the first place.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Darren Hart <dvhart@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-06-19 01:10:31 +02:00
Hans de Goede adc8bb8e0f acpi-video-detect: Move acpi_is_video_device() to acpi/scan.c
This allows video_detect.c to be build as a module, this is a preparation
patch for the backlight interface selection logic cleanup.

Note this commit also causes acpi_is_video_device() to always be build
indepedent of CONFIG_ACPI_VIDEO, as there is no reason to make its
building depend on CONFIG_ACPI_VIDEO.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Darren Hart <dvhart@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-06-19 01:10:26 +02:00
Hans de Goede fb105d9642 acpi-video-detect: Make acpi_video_get_capabilities a private function
acpi_video_get_capabilities() is only used inside video_detect.c so make
it static. While at it also remove the prototype for the non existent
acpi_video_display_switch_support function from acpi.h

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Darren Hart <dvhart@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-06-19 01:10:21 +02:00
Hans de Goede 7f3b62cf94 acpi-video-detect: Remove the unused acpi_video_dmi_demote_vendor() function
Remove the now unused acpi_video_dmi_demote_vendor() function, this was
never a proper counter part of acpi_video_dmi_promote_vendor() since
the calls to acpi_video_dmi_promote_vendor() are not counted.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Darren Hart <dvhart@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-06-19 01:10:15 +02:00
Rafael J. Wysocki 0f1b414d19 ACPI / PNP: Avoid conflicting resource reservations
Commit b9a5e5e18f "ACPI / init: Fix the ordering of
acpi_reserve_resources()" overlooked the fact that the memory
and/or I/O regions reserved by acpi_reserve_resources() may
conflict with those reserved by the PNP "system" driver.

If that conflict actually takes place, it causes the reservations
made by the "system" driver to fail while before commit b9a5e5e18f
all reservations made by it and by acpi_reserve_resources() would be
successful.  In turn, that allows the resources that haven't been
reserved by the "system" driver to be used by others (e.g. PCI) which
sometimes leads to functional problems (up to and including boot
failures).

To fix that issue, introduce a common resource reservation routine,
acpi_reserve_region(), to be used by both acpi_reserve_resources()
and the "system" driver, that will track all resources reserved by
it and avoid making conflicting requests.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=99831
Link: http://marc.info/?t=143389402600001&r=1&w=2
Fixes: b9a5e5e18f "ACPI / init: Fix the ordering of acpi_reserve_resources()"
Reported-by: Roland Dreier <roland@purestorage.com>
Cc: All applicable <stable@vger.kernel.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-06-18 18:32:02 +02:00
Rafael J. Wysocki e08f84e877 Merge branch 'acpi-scan' into acpi-video 2015-06-16 19:59:09 +02:00
Suthikulpanit, Suravee d056267483 ACPI / scan: Parse _CCA and setup device coherency
This patch implements support for ACPI _CCA object, which is introduced in
ACPIv5.1, can be used for specifying device DMA coherency attribute.

The parsing logic traverses device namespace to parse coherency
information, and stores it in acpi_device_flags. Then uses it to call
arch_setup_dma_ops() when creating each device enumerated in DSDT
during ACPI scan.

This patch also introduces acpi_dma_is_coherent(), which provides
an interface for device drivers to check the coherency information
similarly to the of_dma_is_coherent().

Signed-off-by: Mark Salter <msalter@redhat.com>
Signed-off-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-06-15 14:40:48 +02:00
Rafael J. Wysocki faacd5ad83 Merge branch 'acpi-scan' into acpi-cca 2015-06-15 14:38:55 +02:00
Lv Zheng 66db383439 ACPI / EC: Fix a code coverity issue when QR_EC transactions are failed.
When the QR_EC transaction fails, the EC_FLAGS_QUERY_PENDING flag prevents
the event handling work queue from being scheduled again.

Though there shouldn't be failed QR_EC transactions, and this gap was
efficiently used for catching and learning the SCI_EVT clearing timing
compliance issues, we need to fix this as we are not fully compatible
with all platforms/Windows to handle SCI_EVT clearing timing correctly.
Fixing this gives the EC driver the chances to recover from a state machine
failure.

So this patch fixes this issue. When nr_pending_queries drops to 0, it
clears EC_FLAGS_QUERY_PENDING at the proper position for different modes in
order to ensure that the SCI_EVT handling can proceed.

In order to be clearer for future ec_event_clearing modes, all checks in
this patch are written in the inclusive style, not the exclusive style.

Cc: 3.16+ <stable@vger.kernel.org> # 3.16+
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-06-15 14:35:59 +02:00
Lv Zheng 3cb02aeb28 ACPI / EC: Fix EC_FLAGS_QUERY_HANDSHAKE platforms using new event clearing timing.
It is reported that on several platforms, EC firmware will not respond
non-expected QR_EC (see EC_FLAGS_QUERY_HANDSHAKE, only write QR_EC when
SCI_EVT is set).

Unfortunately, ACPI specification doesn't define when the SCI_EVT should be
cleared by the firmware, thus the original implementation queued up second
QR_EC right after writing QR_EC command and before reading the returned
event value as at that time the SCI_EVT is ensured not cleared. This
behavior is also based on the assumption that the firmware should be able
to return 0x00 to indicate "no outstanding event". This behavior did fix
issues on Samsung platforms where the spurious query value of 0x00 is
supported and didn't break platforms in my test queue.

But recently, specific Acer, Asus, Lenovo platforms keep on blaming this
change.

This patch changes the behavior to re-check the SCI_EVT a bit later and
removes EC_FLAGS_QUERY_HANDSHAKE quirks, hoping this is the Windows
compliant EC driver behavior.

In order to be robust to the possible regressions, instead of removing the
quirk directly, this patch keeps the quirk code, removes the quirk users
and keeps old behavior for Samsung platforms.

Cc: 3.16+ <stable@vger.kernel.org> # 3.16+
Link: https://bugzilla.kernel.org/show_bug.cgi?id=94411
Link: https://bugzilla.kernel.org/show_bug.cgi?id=97381
Link: https://bugzilla.kernel.org/show_bug.cgi?id=98111
Reported-and-tested-by: Gabriele Mazzotta <gabriele.mzt@gmail.com>
Reported-and-tested-by: Tigran Gabrielyan <tigrangab@gmail.com>
Reported-and-tested-by: Adrien D <ghbdtn@openmailbox.org>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-06-15 14:35:59 +02:00
Lv Zheng 1d68d2612c ACPI / EC: Add event clearing variation support.
We've been suffering from the uncertainty of the SCI_EVT clearing timing.
This patch implements 3 of 4 possible modes to handle SCI_EVT clearing
variations. The old behavior is kept in this patch.

Status: QR_EC is re-checked as early as possible after checking previous
        SCI_EVT. This always leads to 2 QR_EC transactions per SCI_EVT
        indication and the target may implement event queue which returns
        0x00 indicating "no outstanding event".
        This is proven to be a conflict against Windows behavior, but is
        still kept in this patch to make the EC driver robust to the
        possible regressions that may occur on Samsung platforms.
Query: QR_EC is re-checked after the target has handled the QR_EC query
       request command pushed by the host.
Event: QR_EC is re-checked after the target has noticed the query event
       response data pulled by the host.
       This timing is not determined by any IRQs, so we may need to use a
       guard period in this mode, which may explain the existence of the
       ec_guard() code used by the old EC driver where the re-check timing
       is implemented in the similar way as this mode.
Method: QR_EC is re-checked as late as possible after completing the _Qxx
        evaluation. The target may implement SCI_EVT like a level triggered
        interrupt.
        It is proven on kernel bugzilla 94411 that, Windows will have all
        _Qxx evaluations parallelized. Thus unless required by further
        evidences, we needn't implement this mode as it is a conflict of
        the _Qxx parallelism requirement.

Note that, according to the reports, there are platforms that cannot be
handled using the "Status" mode without enabling the
EC_FLAGS_QUERY_HANDSHAKE quirk. But they can be handled with the other
modes according to the tests (kernel bugzilla 97381).

The following log entry can be used to confirm the differences of the 3
modes as it should appear at the different positions for the 3 modes:
  Command(QR_EC) unblocked
Status: appearing after
         EC_SC(W) = 0x84
Query: appearing after
         EC_DATA(R) = 0xXX
       where XX is the event number used to determine _QXX
Event: appearing after first
         EC_SC(R) = 0xX0 SCI_EVT=x BURST=0 CMD=0 IBF=0 OBF=0
       that is next to the following log entry:
         Command(QR_EC) completed by hardware

Link: https://bugzilla.kernel.org/show_bug.cgi?id=94411
Link: https://bugzilla.kernel.org/show_bug.cgi?id=97381
Link: https://bugzilla.kernel.org/show_bug.cgi?id=98111
Reported-and-tested-by: Gabriele Mazzotta <gabriele.mzt@gmail.com>
Reported-and-tested-by: Tigran Gabrielyan <tigrangab@gmail.com>
Reported-and-tested-by: Adrien D <ghbdtn@openmailbox.org>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-06-15 14:35:59 +02:00
Lv Zheng 9d8993be2d ACPI / EC: Convert event handling work queue into loop style.
During the period that a work queue is scheduled (queued up for run) but
hasn't been run, second schedule_work() could fail. This may not lead to
the loss of queries because QR_EC is always ensured to be submitted after
the work queue has been in the running state.

The event handling work queue can be changed into the loop style to allow
us to control the code in a more flexible way:
1. Makes it possible to add event=0x00 termination condition in the loop.
2. Increases the thoughput of the QR_EC transactions as the 2nd+ QR_EC
   transactions may be handled in the same work item used for the 1st QR_EC
   transaction, thus the delay caused by the 2nd+ work item scheduling can
   be eliminated.

Except the logging message changes and the throughput improvement, this
patch is just a funcitonal no-op.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Tested-by: Gabriele Mazzotta <gabriele.mzt@gmail.com>
Tested-by: Tigran Gabrielyan <tigrangab@gmail.com>
Tested-by: Adrien D <ghbdtn@openmailbox.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-06-15 14:35:59 +02:00
Lv Zheng f8b8eb7153 ACPI / EC: Cleanup transaction state transition.
This patch collects transaction state transition code into one function. We
then could have a single function to maintain transaction transition
related behaviors. No functional changes.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Tested-by: Gabriele Mazzotta <gabriele.mzt@gmail.com>
Tested-by: Tigran Gabrielyan <tigrangab@gmail.com>
Tested-by: Adrien D <ghbdtn@openmailbox.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-06-15 14:35:58 +02:00
Mathias Krause 0519ade718 ACPI / scan: constify ACPI device ids
Make the button ACPI device ID array static const. Safes us a little bit
of code.

Signed-off-by: Mathias Krause <minipli@googlemail.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-06-15 14:31:02 +02:00
Mathias Krause b03466883e ACPI / processor: constify DMI system id table
There is no need to have processor_power_dmi_table[] writeable, constify
it.

Signed-off-by: Mathias Krause <minipli@googlemail.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-06-15 14:29:48 +02:00
Mathias Krause 69cda6e0f0 ACPI / HED: constify ACPI device ids
Constify the acpi_hed_ids[] ACPI device IDs array -- no need to have it
writeable.

Signed-off-by: Mathias Krause <minipli@googlemail.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-06-15 14:28:32 +02:00
Mathias Krause b2687cd7d5 ACPI / LPSS: constify device descriptors
The device descriptors are never written to -- even pointed to as
'const' from struct lpss_private_data. Make them r/o for real.

Signed-off-by: Mathias Krause <minipli@googlemail.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-06-15 14:26:25 +02:00
Mathias Krause 048d16da75 ACPI / battery: mark DMI table as __initconst
The bat_dmi_table[] DMI table is referenced from the __init function
acpi_battery_init_async() only. It and its referenced functions can
therefore be marked __initconst to free up ~1kB of runtime memory after
initialization is done.

Signed-off-by: Mathias Krause <minipli@googlemail.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-06-15 14:23:44 +02:00
Mathias Krause 27059b9132 ACPI / battery: minor tweaks to acpi_battery_units()
Make the acpi_battery_units() function take a const argument and return
a const char*, too. Also make it static. It probably doesn't matter, as
gcc will be clever enough to optimize and inline the code even without
these hints. However, we also get rid of a #ifdef block by moving the
function closer to its usage location, so it's at least a small gain in
code readability.

Signed-off-by: Mathias Krause <minipli@googlemail.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-06-15 14:23:06 +02:00
Mathias Krause a465878455 ACPI / battery: constify the offset tables
The offset tables are only read, not modified. Make them const.

Signed-off-by: Mathias Krause <minipli@googlemail.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-06-15 14:21:22 +02:00
Mathias Krause 44f610cdfb ACPI / AC: constify DMI system id table
There is no need to have ac_dmi_table[] writeable, constify it.

Signed-off-by: Mathias Krause <minipli@googlemail.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-06-15 14:14:49 +02:00
Mathias Krause 4a4f01a6af ACPI / video: constify ACPI and DMI id tables
Make the video ACPI device ID array static and constify the DMI system
IDs array.  Saves us a little bit of code.

Signed-off-by: Mathias Krause <minipli@googlemail.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-06-15 14:12:17 +02:00
Hans de Goede 654a182d85 ACPI / video: Add a parameter to not register the backlight sysfs interface
On some systems acpi-video backlight is broken in the sense that it cannot
control the brightness of the backlight, but it must still be called on
resume to power-up the backlight after resume.

This commit allows these systems to work by going through all the usual
backlight control moves, while not registering a sysfs backlight
interface.

This commit also adds a quirk enabling this parameter on Toshiba Portege
R830 systems which are known to be affected by this.

I wish there was a better way to deal with this, but we've been unable to
find one.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=21012
Link: https://bugs.freedesktop.org/show_bug.cgi?id=82634
Reported-and-tested-by: Sylvain Pasche <sylvain.pasche@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Aaron Lu <aaron.lu@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-06-15 13:55:00 +02:00
Hans de Goede 7f5c1882ad ACPI / video: Add enable_native_backlight quirk for MacbookPro12,1
It seems that the latest generation of MacbookPro needs to use the
native backlight driver, just like most modern laptops do, but it does
not automatically get enabled as the Apple BIOS does not advertise
Windows 8 compatibility. So add a quirk for this.

Reported-by: Christopher Beland <beland@alum.mit.edu>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-06-15 13:53:16 +02:00
Zhang Rui 53daf9383f Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/evalenti/linux-soc-thermal into thermal-soc 2015-06-11 10:55:42 +08:00
Rafael J. Wysocki b064a8fa77 ACPI / init: Switch over platform to the ACPI mode later
Commit 73f7d1ca32 "ACPI / init: Run acpi_early_init() before
timekeeping_init()" moved the ACPI subsystem initialization,
including the ACPI mode enabling, to an earlier point in the
initialization sequence, to allow the timekeeping subsystem
use ACPI early.  Unfortunately, that resulted in boot regressions
on some systems and the early ACPI initialization was moved toward
its original position in the kernel initialization code by commit
c4e1acbb35 "ACPI / init: Invoke early ACPI initialization later".

However, that turns out to be insufficient, as boot is still broken
on the Tyan S8812 mainboard.

To fix that issue, split the ACPI early initialization code into
two pieces so the majority of it still located in acpi_early_init()
and the part switching over the platform into the ACPI mode goes into
a new function, acpi_subsystem_init(), executed at the original early
ACPI initialization spot.

That fixes the Tyan S8812 boot problem, but still allows ACPI
tables to be loaded earlier which is useful to the EFI code in
efi_enter_virtual_mode().

Link: https://bugzilla.kernel.org/show_bug.cgi?id=97141
Fixes: 73f7d1ca32 "ACPI / init: Run acpi_early_init() before timekeeping_init()"
Reported-and-tested-by: Marius Tolzmann <tolzmann@molgen.mpg.de>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Toshi Kani <toshi.kani@hp.com>
Reviewed-by: Hanjun Guo <hanjun.guo@linaro.org>
Reviewed-by: Lee, Chun-Yi <jlee@suse.com>
2015-06-10 23:51:27 +02:00
Rafael J. Wysocki 3d56402d3f ACPI / PM: Add missing pm_generic_complete() invocation
Add missing invocation of pm_generic_complete() to
acpi_subsys_complete() to allow ->complete callbacks provided
by the drivers of devices using the ACPI PM domain to be executed
during system resume.

Fixes: f25c0ae2b4 (ACPI / PM: Avoid resuming devices in ACPI PM domain during system suspend)
Cc: 3.16+ <stable@vger.kernel.org> # 3.16+
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-06-10 01:32:38 +02:00
Stephen Rothwell d6472302f2 x86/mm: Decouple <linux/vmalloc.h> from <asm/io.h>
Nothing in <asm/io.h> uses anything from <linux/vmalloc.h>, so
remove it from there and fix up the resulting build problems
triggered on x86 {64|32}-bit {def|allmod|allno}configs.

The breakages were triggering in places where x86 builds relied
on vmalloc() facilities but did not include <linux/vmalloc.h>
explicitly and relied on the implicit inclusion via <asm/io.h>.

Also add:

  - <linux/init.h> to <linux/io.h>
  - <asm/pgtable_types> to <asm/io.h>

... which were two other implicit header file dependencies.

Suggested-by: David Miller <davem@davemloft.net>
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
[ Tidied up the changelog. ]
Acked-by: David Miller <davem@davemloft.net>
Acked-by: Takashi Iwai <tiwai@suse.de>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Acked-by: Vinod Koul <vinod.koul@intel.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Anton Vorontsov <anton@enomsg.org>
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Cc: Colin Cross <ccross@android.com>
Cc: David Vrabel <david.vrabel@citrix.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Haiyang Zhang <haiyangz@microsoft.com>
Cc: James E.J. Bottomley <JBottomley@odin.com>
Cc: Jaroslav Kysela <perex@perex.cz>
Cc: K. Y. Srinivasan <kys@microsoft.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Kristen Carlson Accardi <kristen@linux.intel.com>
Cc: Len Brown <lenb@kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
Cc: Suma Ramars <sramars@cisco.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Tony Luck <tony.luck@intel.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2015-06-03 12:02:00 +02:00
Alex Williamson 917bfd93d3 ACPI / PCI: Account for ARI in _PRT lookups
The PCIe specification, rev 3.0, section 2.2.8.1, contains the following
implementation note:

  Virtual Wire Mapping for INTx Interrupts From ARI Devices

  The implied Device Number for an ARI Device is 0.  When ARI-aware
  software (including BIOS and operating system) enables ARI Forwarding in
  the Downstream Port immediately above an ARI Device in order to access
  its Extended Functions, software must comprehend that the Downstream Port
  will use Device Number 0 for the virtual wire mappings of INTx interrupts
  coming from all Functions of the ARI Device.  If non-ARI-aware software
  attempts to determine the virtual wire mappings for Extended Functions,
  it can come up with incorrect mappings by examining the traditional
  Device Number field and finding it to be non-0.

We account for this in pci_swizzle_interrupt_pin(), but it looks like we
miss it here, looking for a _PRT entry with a slot matching the ARI device
slot number.  This can cause errors like:

  pcieport 0000:80:03.0: can't derive routing for PCI INT B
  sfc 0000:82:01.1: PCI INT B: no GSI

pci_dev.irq is then invalid, resulting in errors for drivers that attempt
to enable INTx on the device.  Fix by using slot 0 for ARI enabled devices.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Don Dutile <ddutile@redhat.com>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-05-30 20:47:35 -05:00
Bartosz Golaszewski 06931e6224 sched/topology: Rename topology_thread_cpumask() to topology_sibling_cpumask()
Rename topology_thread_cpumask() to topology_sibling_cpumask()
for more consistency with scheduler code.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Russell King <rmk+kernel@arm.linux.org.uk>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Cc: Benoit Cousson <bcousson@baylibre.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: Jean Delvare <jdelvare@suse.de>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Oleg Drokin <oleg.drokin@intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Viresh Kumar <viresh.kumar@linaro.org>
Link: http://lkml.kernel.org/r/1432645896-12588-2-git-send-email-bgolaszewski@baylibre.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2015-05-27 15:22:15 +02:00
Rafael J. Wysocki d5eefa8280 ACPI / PM: Turn power resources on and off in the right order during resume
According to Section 7.2 of ACPI 6.0, power resources should
always be enabled and disabled in order given by the "resourceorder"
field of the corresponding Power Resource objects: "Power Resource
levels are enabled from low values to high values and are disabled
from high values to low values."

However, this is not what happens during system resume, because
in that case the enabling/disabling is carried out in the power
resource registration order which may not reflect the ordering
required by the platform.

For this reason, make the ordering of the global list of all
power resources in the system (used by the system resume code)
reflect the one given by the "resourceorder" attributes of the
Power Resource objects in the ACPI namespace and modify
acpi_resume_power_resources() to walk the list in the reverse
order when turning off the power resources that had been off
before the system was suspended.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-05-25 23:59:54 +02:00
Rafael J. Wysocki ee89209402 ACPI / property: Define a symbol for PRP0001
Use a #defined symbol ACPI_DT_NAMESPACE_HID instead of the PRP0001
string.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Reviewed-by: Hanjun Guo <hanjun.guo@linaro.org>
2015-05-22 23:57:14 +02:00
Hanjun Guo cae756fbaa ACPI / PCI: remove stale list_head in struct acpi_prt_entry
list_head "list" in struct acpi_prt_entry was used to connect
_PRT entries for PCI irq, but after commit 181380b702 ("PCI/ACPI:
Don't cache _PRT, and don't associate them with bus numbers"),
the list head for _PRT entries was removed, but left "list" in
struct acpi_prt_entry which is useless and stale, remove it now.

Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-05-22 03:36:24 +02:00
Bob Moore 04f8e38497 ACPICA: ACPI 6.0: Add support for NFIT table.
ACPICA commit e4e17ca361373e9b81494bb4ca697a12cef3cba6

NVDIMM Firmware Interface Table.

Link: https://github.com/acpica/acpica/commit/e4e17ca3
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-05-22 03:22:21 +02:00
Bob Moore 0bb346cca1 ACPICA: acpi_help: Add option to display all known/supported ACPI tables.
ACPICA commit d6d003556c6fc22e067d5d511577128a661266c3

-t option displays all ACPI tables.

Link: https://github.com/acpica/acpica/commit/d6d00355
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-05-22 03:22:21 +02:00
Bob Moore 5b0bbfbd56 ACPICA: iASL/disassembler - fix possible fault for -e option.
ACPICA commit 403b8b0023fd7549b2f9bf818fcc1ba481047b69

If non-AML files are used with the -e option, the disassembler
can fault. The fix is to ensure that all -e files are either
SSDTs or a DSDT. ACPICA BZ 1158.

Link: https://github.com/acpica/acpica/commit/403b8b00
Reference: https://bugs.acpica.org/show_bug.cgi?id=1158
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-05-22 03:22:21 +02:00
Lv Zheng 2900d56ffb ACPICA: Hardware: Fix a resource leak issue in acpi_hw_build_pci_list().
ACPICA commit e4f0b73c107680841d7dd01cc04ec108df6580bd

There is code in acpi_hw_build_pci_list() destructing returned object
(return_list_head) before touching it while the allocated new object
(list_head) is not tracked correctly to be destructed on the error case,
which is detected as unsecure code by the "Coverity" tool.

This patch fixes this issue by always intializing the returned object in
acpi_hw_build_pci_list() so that the caller of acpi_hw_build_pci_list() needn't
initialize it and always using the returned object to track the new
allocated objects. Lv Zheng.

Link: https://github.com/acpica/acpica/commit/e4f0b73c
Link: https://jira01.devtools.intel.com/browse/LCK-2143
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-05-22 03:22:20 +02:00
Lv Zheng c8dec7459d ACPICA: Dispatcher: Fix a resource leak issue in acpi_ds_auto_serialize_method().
ACPICA commit 29d03840cbab435e8ea82e9339ff9d84535c647d

This patch fixes a resource leak issue in acpi_ds_auto_serialize_method().
It is reported by the "Coverity" tool as unsecure code. Lv Zheng.

Link: https://github.com/acpica/acpica/commit/29d03840
Link: https://jira01.devtools.intel.com/browse/LCK-2142
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-05-22 03:22:20 +02:00
Bob Moore a737222240 ACPICA: iASL: Enhance detection of non-ascii or corrupted input files.
ACPICA commit 08170904011f1e8f817d9e3a9f2bb2438aeacf60

For the compiler part (not disassembler).
- Characters not within a comment must be be ASCII (0-0x7F), and
now either printable or a "space" character.
Provides better detection of files that cannot be compiled.

This patch only affects iASL which is not in the Linux upstream.

Link: https://github.com/acpica/acpica/commit/08170904
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-05-22 03:22:19 +02:00
Bob Moore b0e01c7241 ACPICA: Parser: Move a couple externals to the proper header.
ACPICA commit 7325b59c8b5d1522ded51ae6a76b804f6e8da5d2

Moved from a C module.

Link: https://github.com/acpica/acpica/commit/7325b59c
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-05-22 03:22:19 +02:00
Bob Moore e34a7813cf ACPICA: ACPI 6.0: Add support for new predefined names.
ACPICA commit 7ba68f2eafa12fe75ee7aa0df7543d5ea2443051

Compiler, Interpreter, acpi_help.

_BTH, _CR3, _DSD, _LPI, _MTL, _PRR, _RDI,
_RST, _TFP, _TSN.

Link: https://github.com/acpica/acpica/commit/7ba68f2e
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-05-22 03:22:19 +02:00
Rafael J. Wysocki 20dacb71ad ACPI / PM: Rework device power management to follow ACPI 6
The ACPI 6 specification has made some changes in the device power
management area.  In particular:

 * The D3hot power state is now supposed to be always available
   (instead of D3cold) and D3cold is only regarded as valid if the
   _PR3 object is present for the given device.

 * The required ordering of transitions into power states deeper than
   D0 is now such that for a transition into state Dx the _PSx method
   is supposed to be executed first, if present, and the states of
   the power resources the device depends on are supposed to be
   changed after that.

 * It is now explicitly forbidden to transition devices from
   lower-power (deeper) into higher-power (shallower) power states
   other than D0.

Those changes have been made so the specification reflects the
Windows' device power management code that the vast majority of
systems using ACPI is validated against.

To avoid artificial differences in ACPI device power management
between Windows and Linux, modify the ACPI device power management
code to follow the new specification.  Add comments explaining the
code flow in some unclear places.

This only may affect some real corner cases in which the OS behavior
expected by the firmware is different from the Windows one, but that's
quite unlikely.  The transition ordering change affects transitions
to D1 and D2 which are rarely used (if at all) and into D3hot and
D3cold for devices actually having _PR3, but those are likely to
be validated against Windows anyway.  The other changes may affect
code calling acpi_device_get_power() or acpi_device_update_power()
where ACPI_STATE_D3_HOT may be returned instead of ACPI_STATE_D3_COLD
(that's why the ACPI fan driver needs to be updated too) and since
transitions into ACPI_STATE_D3_HOT may remove power now, it is better
to avoid this one in acpi_pm_device_sleep_state() if the "no power
off" PM QoS flag is set.

The only existing user of acpi_device_can_poweroff() really cares
about the case when _PR3 is present, so the change in that function
should not cause any problems to happen too.

A plus is that PCI_D3hot can be mapped to ACPI_STATE_D3_HOT
now and the compatibility with older systems should be covered
automatically.

In any case, if any real problems result from this, it still will
be better to follow the Windows' behavior (which now is reflected
by the specification too) in general and handle the cases when it
doesn't work via quirks.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-05-16 01:55:35 +02:00
Lv Zheng 3174abcfea ACPI / EC: Remove non-root-caused busy polling quirks.
{ Update to correct 1 patch subject in the description }

We have fixed a lot of race issues in the EC driver recently.

The following commit introduces MSI udelay()/msleep() quirk to MSI laptops
to make EC firmware working for bug 12011 without root causing any EC
driver race issues:
  Commit: 5423a0cb3f
  Subject: ACPI: EC: Add delay for slow MSI controller
  Commit: 34ff4dbccc
  Subject: ACPI: EC: Separate delays for MSI hardware

The following commit extends ECDT validation quirk to MSI laptops to make
EC driver locating EC registers properly for bug 12461:
  Commit: a5032bfdd9
  Subject: ACPI: EC: Always parse EC device
This is a different quirk than the MSI udelay()/msleep() quirk. This patch
keeps validating ECDT for only "Micro-Star MS-171F" as reported.

The following commit extends MSI udelay()/msleep() quirk to Quanta laptops
to make EC firmware working for bug 20242, there is no requirement to
validate ECDT for Quanta laptops:
  Commit: 534bc4e3d2 Mon Sep 17 00:00:00 2001
  Subject: ACPI EC: enable MSI workaround for Quanta laptops

The following commit extends MSI udelay()/msleep() quirk to Clevo laptops
to make EC firmware working for bug 77431, there is no requirement to
validate ECDT for Clevo laptops:
  Commit: 777cb38295
  Subject: ACPI / EC: Add msi quirk for Clevo W350etq

All udelay()/msleep() quirks for MSI/Quanta/Clevo seem to be the wrong
fixes generated without fixing the EC driver race issues.
And even if it is not wrong, the guarding can be covered by the following
commits in wait polling mode:
  Commit: 9e295ac14d
  Subject: ACPI / EC: Reduce ec_poll() by referencing the last register access timestamp.
  Commit: commit in the same series
  Subject: ACPI / EC: Fix and clean up register access guarding logics.
The only case that is not covered is the inter-transaction guarding. And
there is no evidence that we need the inter-transaction guarding upon
reading the noted bug entries.

So it is time to remove the quirks and let the users to try again. If there
is a regression, the only thing we need to do is to restore the
inter-transaction guarding for the reported platforms.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=12011
Link: https://bugzilla.kernel.org/show_bug.cgi?id=12461
Link: https://bugzilla.kernel.org/show_bug.cgi?id=20242
Link: https://bugzilla.kernel.org/show_bug.cgi?id=77431
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-05-16 01:53:03 +02:00
Lv Zheng 15de603b04 ACPI / EC: Add module params for polling modes.
We have 2 polling modes in the EC driver:
1. busy polling: originally used for the MSI quirks. udelay() is used to
   perform register access guarding.
2. wait polling: normal code path uses wait_event_timeout() and it can be
   woken up as soon as the transaction is completed in the interrupt mode.
   It also contains the register acces guarding logic in case the interrupt
   doesn't arrive and the EC driver is about to advance the transaction in
   task context (the polling mode).
The wait polling is useful for interrupt mode to allow other tasks to use
the CPU during the wait.
But for the polling mode, the busy polling takes less time than the wait
polling, because if no interrupt arrives, the wait polling has to wait the
minimal HZ interval.

We have a new use case for using the busy polling mode. Some GPIO drivers
initialize PIN configuration which cause a GPIO multiplexed EC GPE to be
disabled out of the GPE register's control. Busy polling mode is useful
here as it takes less time than the wait polling. But the guarding logic
prevents it from responding even faster. We should spinning around the EC
status rather than spinning around the nop execution lasted a determined
period.

This patch introduces 2 module params for the polling mode switch and the
guard time, so that users can use the busy polling mode without the
guarding in case the guarding is not necessary. This is an example to use
the 2 module params for this purpose:
  acpi.ec_busy_polling acpi.ec_polling_guard=0

We've tested the patch on a test platform. The platform suffers from such
kind of the GPIO PIN issue. The GPIO driver resets all PIN configuration
and after that, EC interrupt cannot arrive because of the multiplexing.
Then the platform suffers from a long delay carried out by the
wait_event_timeout() as all further EC transactions will run in the polling
mode. We switched the EC driver to use the busy polling mechanism instead
of the wait timeout polling mechanism and the delay is still high:
[   44.283005] calling  PNP0C0B:00+ @ 1305, parent: platform
[   44.417548] call PNP0C0B:00+ returned 0 after 131323 usecs
And this patch can significantly reduce the delay:
[   44.502625] calling  PNP0C0B:00+ @ 1308, parent: platform
[   44.503760] call PNP0C0B:00+ returned 0 after 1103 usecs

Tested-by: Chen Yu <yu.c.chen@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-05-16 01:51:18 +02:00
Lv Zheng d8d031a605 ACPI / EC: Fix and clean up register access guarding logics.
In the polling mode, EC driver shouldn't access the EC registers too
frequently. Though this statement is concluded from the non-root caused
bugs (see links below), we've maintained the register access guarding
logics in the current EC driver. The guarding logics can be found here and
there, makes it hard to root cause real timing issues. This patch collects
the guarding logics into one single function so that all hidden logics
related to this can be seen clearly.

The current guarding related code also has several issues:
1. Per-transaction timestamp prevents inter-transaction guarding from being
   implemented in the same place. We have an inter-transaction udelay() in
   acpi_ec_transaction_unblocked(), this logic can be merged into ec_poll()
   if we can use per-device timestamp. This patch completes such merge to
   form a new ec_guard() function and collects all guarding related hidden
   logics in it.
   One hidden logic is: there is no inter-transaction guarding performed
   for non MSI quirk (wait polling mode), this patch skips
   inter-transaction guarding before wait_event_timeout() for the wait
   polling mode to reveal the hidden logic.
   The other hidden logic is: there is msleep() inter-transaction guarding
   performed when the GPE storming is observed. As after merging this
   commit:
     Commit: e1d4d90fc0
     Subject: ACPI / EC: Refine command storm prevention support
   EC_FLAGS_COMMAND_STORM is ensured to be cleared after invoking
   acpi_ec_transaction_unlocked(), the msleep() guard logic will never
   happen now. Since no one complains such change, this logic is likely
   added during the old times where the EC race issues are not fixed and
   the bugs are false root-caused to the timing issue. This patch simply
   removes the out-dated logic. We can restore it by stop skipping
   inter-transaction guarding for wait polling mode.
   Two different delay values are defined for msleep() and udelay() while
   they are merged in this patch to 550us.
2. time_after() causes additional delay in the polling mode (can only be
   observed in noirq suspend/resume processes where polling mode is always
   used) before advance_transaction() is invoked ("wait polling" log is
   added before wait_event_timeout()). We can see 2 wait_event_timeout()
   invocations. This is because time_after() ensures a ">" validation while
   we only need a ">=" validation here:
   [   86.739909] ACPI: Waking up from system sleep state S3
   [   86.742857] ACPI : EC: 2: Increase command
   [   86.742859] ACPI : EC: ***** Command(RD_EC) started *****
   [   86.742861] ACPI : EC: ===== TASK (0) =====
   [   86.742871] ACPI : EC: EC_SC(R) = 0x20 SCI_EVT=1 BURST=0 CMD=0 IBF=0 OBF=0
   [   86.742873] ACPI : EC: EC_SC(W) = 0x80
   [   86.742876] ACPI : EC: ***** Event started *****
   [   86.742880] ACPI : EC: ~~~~~ wait polling ~~~~~
   [   86.743972] ACPI : EC: ~~~~~ wait polling ~~~~~
   [   86.747966] ACPI : EC: ===== TASK (0) =====
   [   86.747977] ACPI : EC: EC_SC(R) = 0x20 SCI_EVT=1 BURST=0 CMD=0 IBF=0 OBF=0
   [   86.747978] ACPI : EC: EC_DATA(W) = 0x06
   [   86.747981] ACPI : EC: ~~~~~ wait polling ~~~~~
   [   86.751971] ACPI : EC: ~~~~~ wait polling ~~~~~
   [   86.755969] ACPI : EC: ===== TASK (0) =====
   [   86.755991] ACPI : EC: EC_SC(R) = 0x21 SCI_EVT=1 BURST=0 CMD=0 IBF=0 OBF=1
   [   86.755993] ACPI : EC: EC_DATA(R) = 0x03
   [   86.755994] ACPI : EC: ~~~~~ wait polling ~~~~~
   [   86.755995] ACPI : EC: ***** Command(RD_EC) stopped *****
   [   86.755996] ACPI : EC: 1: Decrease command
   This patch corrects this by using time_before() instead in ec_guard():
   [   54.283146] ACPI: Waking up from system sleep state S3
   [   54.285414] ACPI : EC: 2: Increase command
   [   54.285415] ACPI : EC: ***** Command(RD_EC) started *****
   [   54.285416] ACPI : EC: ~~~~~ wait polling ~~~~~
   [   54.285417] ACPI : EC: ===== TASK (0) =====
   [   54.285424] ACPI : EC: EC_SC(R) = 0x20 SCI_EVT=1 BURST=0 CMD=0 IBF=0 OBF=0
   [   54.285425] ACPI : EC: EC_SC(W) = 0x80
   [   54.285427] ACPI : EC: ***** Event started *****
   [   54.285429] ACPI : EC: ~~~~~ wait polling ~~~~~
   [   54.287209] ACPI : EC: ===== TASK (0) =====
   [   54.287218] ACPI : EC: EC_SC(R) = 0x20 SCI_EVT=1 BURST=0 CMD=0 IBF=0 OBF=0
   [   54.287219] ACPI : EC: EC_DATA(W) = 0x06
   [   54.287222] ACPI : EC: ~~~~~ wait polling ~~~~~
   [   54.291190] ACPI : EC: ===== TASK (0) =====
   [   54.291210] ACPI : EC: EC_SC(R) = 0x21 SCI_EVT=1 BURST=0 CMD=0 IBF=0 OBF=1
   [   54.291213] ACPI : EC: EC_DATA(R) = 0x03
   [   54.291214] ACPI : EC: ~~~~~ wait polling ~~~~~
   [   54.291215] ACPI : EC: ***** Command(RD_EC) stopped *****
   [   54.291216] ACPI : EC: 1: Decrease command

After cleaning up all guarding logics, we have one single function
ec_guard() collecting all old, non-root-caused, hidden logics. Then we can
easily tune the logics in one place to respond to the bug reports.

Except the time_before() change, all other changes do not change the
behavior of the EC driver.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=12011
Link: https://bugzilla.kernel.org/show_bug.cgi?id=20242
Link: https://bugzilla.kernel.org/show_bug.cgi?id=77431
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-05-16 01:51:18 +02:00
Lv Zheng 373783e6e9 ACPI / EC: Remove irqs_disabled() check.
The following commit merges polling and interrupt modes for EC driver:
  Commit: 2a84cb9852 Mon Sep 17 00:00:00 2001
  Subject: ACPI: EC: Merge IRQ and POLL modes
The irqs_disabled() check introduced in it tries to fall into busy polling
mode when the context of ec_poll() cannot sleep.

Actually ec_poll() is ensured to be invoked in the contexts that can sleep
(from a sysfs /sys/kernel/debug/ec/ec0/io access, or from
acpi_evaluate_object(), or from acpi_ec_gpe_poller()). Without the MSI
quirk, we never saw the udelay() logic invoked. Thus this check is useless
and can be removed.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-05-16 01:51:17 +02:00
Lv Zheng 5ab82a11e5 ACPI / EC: Remove storming threashold enlarging quirk.
This patch removes the storming threashold enlarging quirk.

After applying the following commit, we can notice that there is no no-op
GPE handling invocation can be observed, thus it is unlikely that the
no-op counts can exceed the storming threashold:
  Commit: ca37bfdfbc
  Subject: ACPI / EC: Fix several GPE handling issues by deploying ACPI_GPE_DISPATCH_RAW_HANDLER mode.
Even when the storming happens, we have already limited its affection to
the only transaction and no further transactions will be affected. This is
done by this commit:
  Commit: e1d4d90fc0
  Subject: ACPI / EC: Refine command storm prevention support

So it's time to remove this quirk.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=45151
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-05-16 01:51:17 +02:00
Lv Zheng 7c0b2595da ACPI / EC: Update acpi_ec_is_gpe_raised() with new GPE status flag.
This patch updates acpi_ec_is_gpe_raised() according to the following
commit:
  Commit: 09af8e8290
  Subject: ACPICA: Events: Add support to return both enable/status register values for GPE and fixed event.
This is actually a no-op change as both the flags are defined to a same
value.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-05-16 01:51:17 +02:00
Rafael J. Wysocki 4de5167ee0 Merge branches 'acpi-init' and 'acpica'
* acpi-init:
  ACPI / init: Fix the ordering of acpi_reserve_resources()

* acpica:
  Revert "ACPICA: Permanently set _REV to the value '2'."
2015-05-15 00:31:23 +02:00
Dominik Brodowski 2bad7e27e0 ACPI / osl: use same type for acpi_predefined_names values as in definition
In the definition of struct acpi_predefined_names, value is of
type char *. Make the OSL override function also work with type
char * (or, more precisely, with a pointer to it).

Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-05-14 22:16:38 +02:00
Luis Henriques eca21d9167 ACPI / battery: ensure acpi_battery_init() has finish
Make sure that async function scheduled with async_schedule() has already
been executed.

Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-05-14 00:58:40 +02:00
Luis Henriques 479faaf00f ACPI / battery: drop useless return statements
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-05-14 00:58:40 +02:00
Luis Henriques e234b074c8 ACPI / battery: abort initialization earlier if acpi_disabled
If ACPI is disabled there's no need to schedule an async function call,
the driver initialization can be aborted earlier in acpi_battery_init().

Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-05-14 00:58:39 +02:00
Hanjun Guo ddcc18f5bd ACPI / processor: Introduce invalid_phys_cpuid()
Introduce invalid_phys_cpuid() to identify cpu with invalid
physical ID, then used it as replacement of the direct comparisons
with PHYS_CPUID_INVALID.

Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-05-13 23:28:16 +02:00
Hanjun Guo d3da7cb9d2 ACPI / processor: return specific error instead of -1
Since invalid_logical_cpuid() can check error values, so
return specific error instead of -1 for acpi_map_cpuid().

Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-05-13 23:28:16 +02:00
Hanjun Guo 8416c5bda1 ACPI / processor: remove phys_id in acpi_processor_get_info()
Use pr->phys_id to replace phys_id to simplify the code.

Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-05-13 23:28:15 +02:00
Hanjun Guo 05eb3cd8b4 ACPI / processor: remove cpu_index in acpi_processor_get_info()
Just use pr->id instead of cpu_index to simplify the code.

Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-05-13 23:28:15 +02:00
Hanjun Guo 25956b6612 ACPI / processor: Introduce invalid_logical_cpuid()
In ACPI processor drivers, we use direct comparisons of cpu logical
id with -1 which are error prone in case logical cpuid is accidentally
assinged an error code and prevents us from returning an error-encoding
cpuid directly in some cases.

So introduce invalid_logical_cpuid() to identify cpu with invalid
logical cpu num, then it will be used to replace the direct comparisons
with -1.

Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-05-13 23:28:14 +02:00
Rafael J. Wysocki ff284f37fc Revert "ACPICA: Permanently set _REV to the value '2'."
Revert commit b1ef297258 (ACPICA: Permanently set _REV to the value
'2'.) as it causes a sound regression to happen on Dell XPS 13 (2015).

Reported-by: Dominik Brodowski <linux@dominikbrodowski.net>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-05-13 00:44:14 +02:00
Rafael J. Wysocki 6656bde5ec ACPI / PM: Drop stale comment from acpi_power_transition()
An old comment in acpi_power_transition() indicates that support
for ordering power resources needs to be added, but the current
code handles that already.

Drop the comment to avoid confusion.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-05-08 22:41:05 +02:00
Rafael J. Wysocki 9a5d9315e4 Merge branches 'acpi-resources', 'acpi-battery', 'acpi-doc' and 'acpi-pnp'
* acpi-resources:
  x86/PCI/ACPI: Make all resources except [io 0xcf8-0xcff] available on PCI bus

* acpi-battery:
  ACPI / SBS: Add 5 us delay to fix SBS hangs on MacBook

* acpi-doc:
  ACPI / documentation: Fix ambiguity in the GPIO properties document
  ACPI / documentation: fix a sentence about GPIO resources

* acpi-pnp:
  ACPI / PNP: add two IDs to list for PNPACPI device enumeration
2015-05-07 21:24:34 +02:00
Rafael J. Wysocki b9a5e5e18f ACPI / init: Fix the ordering of acpi_reserve_resources()
Since acpi_reserve_resources() is defined as a device_initcall(),
there's no guarantee that it will be executed in the right order
with respect to the rest of the ACPI initialization code.  On some
systems this leads to breakage if, for example, the address range
that should be reserved for the ACPI fixed registers is given to
the PCI host bridge instead if the race is won by the wrong code
path.

Fix this by turning acpi_reserve_resources() into a void function
and calling it directly from within the ACPI initialization sequence.

Reported-and-tested-by: George McCollister <george.mccollister@gmail.com>
Link: http://marc.info/?t=143092384600002&r=1&w=2
Cc: All applicable <stable@vger.kernel.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-05-07 21:19:39 +02:00
Lorenzo Pieralisi bbf55ae19f ACPI / proc: make ACPI_PROCFS_POWER X86 only
The ACPI procfs power interface is initialized by compilation units
that are only selectable on X86 platforms. Since its usage is
deprecated and it cannot even be used on platforms other than X86
it should be compiled in only on X86 platforms.

This patch makes CONFIG_ACPI_PROCFS_POWER dependent on X86, so
that other architectures are prevented from compiling it in for
no purpose.

Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Acked-by: Hanjun Guo <hanjun.guo@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-05-05 22:34:44 +02:00
Rafael J. Wysocki 5c53b262c8 ACPI / property: Refine consistency check for PRP0001
Refine the check for the presence of the "compatible" property
if the PRP0001 device ID is present in the device's list of
ACPI/PNP IDs to also print the message if _DSD is missing
entirely or the format of it is incorrect.

One special case to take into accout is that the "compatible"
property need not be provided for devices having the PRP0001
device ID in their lists of ACPI/PNP IDs if they are ancestors
of PRP0001 devices with the "compatible" property present.
This is to cover heriarchies of device objects where the kernel
is only supposed to use a struct device representation for the
topmost one and the others represent, for example, functional
blocks of a composite device.

While at it, reduce the log level of the message to "info"
and reduce the log level of the "broken _DSD" message to
"debug" (noise reduction).

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2015-05-05 15:43:07 +02:00
Kapileshwar Singh 6cd9e9f629 thermal: of: fix cooling device weights in device tree
Currently you can specify the weight of the cooling device in the device
tree but that information is not populated to the
thermal_bind_params where the fair share governor expects it to
be.  The of thermal zone device doesn't have a thermal_bind_params
structure and arguably it's better to pass the weight inside the
thermal_instance as it is specific to the bind of a cooling device to a
thermal zone parameter.

Core thermal code is fixed to populate the weight in the instance from
the thermal_bind_params, so platform code that was passing the weight
inside the thermal_bind_params continue to work seamlessly.

While we are at it, create a default value for the weight parameter for
those thermal zones that currently don't define it and remove the
hardcoded default in of-thermal.

Cc: Zhang Rui <rui.zhang@intel.com>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Len Brown <lenb@kernel.org>
Cc: Peter Feuerer <peter@piie.net>
Cc: Darren Hart <dvhart@infradead.org>
Cc: Eduardo Valentin <edubezval@gmail.com>
Cc: Kukjin Kim <kgene@kernel.org>
Cc: Durgadoss R <durgadoss.r@intel.com>
Signed-off-by: Kapileshwar Singh <kapileshwar.singh@arm.com>
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2015-05-04 21:27:50 -07:00
Rafael J. Wysocki 20f34165a9 GHES: Seriously speedup and cleanup NMI handler (Jiri Kosina and Borislav Petkov)
This is the result of us seeing this during boot
 
 [   24.332560] INFO: NMI handler (ghes_notify_nmi) took too long to run: 3.265 msecs
 [   24.332567] INFO: NMI handler (ghes_notify_nmi) took too long to run: 5.946 msecs
 [   24.332568] INFO: NMI handler (ghes_notify_nmi) took too long to run: 5.948 msecs
 
 and a report of people running perf stat and the machine softlocking.
 "hest_disable" was helping in this case, which made us look at that
 particular NMI handler. It was grabbing a lock each time it is run and
 on each CPU. But this is not needed as the GHES sources are global and
 they need only a single reader.
 
 This patchset does that and cleans up the handler in the process.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJVRzqjAAoJEBLB8Bhh3lVKFQUQAKmPPaWp2qPUkRHtrdFfae0n
 Um9PSAHlvO8oHPrr+5j+CEVX1gQ1qUFMuxSVuBYYhmMZnsAVCwKX8gOi3slZmElo
 L0MoqxygP2v3Rc79Jk8KEkov+80zzp46VoB5Yh0mTfzSejeS+c1owwS0RzVIpda3
 Zp1cAThTVsCdDmmWGhnWfc8T/wniPc2zbbVhtjivO/wwSu7ArWUR5/03pbxzex8M
 3xnJY29USB62xO5OJf0mxAIhTqv4a7NSQ6NziBrI2Mt4inHj0oSR7KLVFpeSx4mX
 LLo8dWfDpMIbwd2sZYg5fG6Kz2i3Cc5I252V4j7MI+srvvZzZPBr1aB8qNyQVGPF
 grrQKQuD2Az0WZRo2gK2LvxvlHfmJyOJMaFPW+RMnARbtKMmmAIwaN4+zmPGHoH8
 aQK7cKUyb1JxICpy9iAZjXMvqxc5zbhYra0G+zuLKruhEvmLrwibphjI82BNdaBZ
 rhkK+cw47lPgwKVNRWKjpNGGziwqU2cBlmc50k9OyQhhv5HF2TeYyBRryykOVmLV
 DpsUxO4rCj0YEioyoJEruBO1Ks167HGrg5sbSemO/YeM7wLgr7hMfVNlGM4DI68X
 b3Ie81/7qD8d3nQZ/gkk8ex1D0QhS0FWZthbNKpvkX+Zc/ELbGhfgHxX55HmfGuD
 DUmvP2oXlALAIPiJAYVP
 =Qj+0
 -----END PGP SIGNATURE-----

Merge tag 'ras_for_4.2' of git://git.kernel.org/pub/scm/linux/kernel/git/ras/ras into acpi-apei

Pull GHES changes for 4.2 from Borislav Petkov:

"GHES: Seriously speedup and cleanup NMI handler (Jiri Kosina and Borislav Petkov)

This is the result of us seeing this during boot

[   24.332560] INFO: NMI handler (ghes_notify_nmi) took too long to run: 3.265 msecs
[   24.332567] INFO: NMI handler (ghes_notify_nmi) took too long to run: 5.946 msecs
[   24.332568] INFO: NMI handler (ghes_notify_nmi) took too long to run: 5.948 msecs

and a report of people running perf stat and the machine softlocking.
"hest_disable" was helping in this case, which made us look at that
particular NMI handler. It was grabbing a lock each time it is run and
on each CPU. But this is not needed as the GHES sources are global and
they need only a single reader.

This patchset does that and cleans up the handler in the process."

* tag 'ras_for_4.2' of git://git.kernel.org/pub/scm/linux/kernel/git/ras/ras:
  GHES: Make NMI handler have a single reader
  GHES: Elliminate double-loop in the NMI handler
  GHES: Panic right after detection
  GHES: Carve out the panic functionality
  GHES: Carve out error queueing in a separate function
2015-05-04 22:34:58 +02:00
Witold Szczeponik 622532bb2f ACPI / PNP: add two IDs to list for PNPACPI device enumeration
Commit eec15edbb0 (ACPI / PNP: use device ID list for PNPACPI device
enumeration) changed the way how ACPI devices are enumerated and when
they are added to the PNP bus.

However, it broke the sound card support on (at least) a vintage
IBM ThinkPad 600E: with said commit applied, two of the necessary
"CSC01xx" devices are not added to the PNP bus and hence can not be
found during the initialization of the "snd-cs4236" module.  As a
consequence, loading "snd-cs4236" causes null pointer exceptions.
The attached patch fixes the problem end re-enables sound on the
IBM ThinkPad 600E.

Fixes: eec15edbb0 (ACPI / PNP: use device ID list for PNPACPI device enumeration)
Signed-off-by: Witold Szczeponik <Witold.Szczeponik@gmx.net>
Cc: 3.16+ <stable@vger.kernel.org> # 3.16+
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-05-04 16:03:12 +02:00
Chris Bainbridge 3349fb64b2 ACPI / SBS: Add 5 us delay to fix SBS hangs on MacBook
Commit 7bc5a2bad0 'ACPI: Support _OSI("Darwin") correctly' caused
the MacBook firmware to expose the SBS, resulting in intermittent
hangs of several minutes on boot, and failure to detect or report
the battery.  Fix this by adding a 5 us delay to the start of each
SMBUS transaction.  This timing is the result of experimentation -
hangs were observed with 3 us but never with 5 us.

Fixes: 7bc5a2bad0 'ACPI: Support _OSI("Darwin") correctly'
Link: https://bugzilla.kernel.org/show_bug.cgi?id=94651
Signed-off-by: Chris Bainbridge <chris.bainbridge@gmail.com>
Cc: 3.18+ <stable@vger.kernel.org> # 3.18+
[ rjw: Subject and changelog ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-04-30 23:18:11 +02:00
Jiang Liu 2c62e8492e x86/PCI/ACPI: Make all resources except [io 0xcf8-0xcff] available on PCI bus
An IO port or MMIO resource assigned to a PCI host bridge may be
consumed by the host bridge itself or available to its child
bus/devices. The ACPI specification defines a bit (Producer/Consumer)
to tell whether the resource is consumed by the host bridge itself,
but firmware hasn't used that bit consistently, so we can't rely on it.

Before commit 593669c2ac ("x86/PCI/ACPI: Use common ACPI resource
interfaces to simplify implementation"), arch/x86/pci/acpi.c ignored
all IO port resources defined by acpi_resource_io and
acpi_resource_fixed_io to filter out IO ports consumed by the host
bridge itself.

Commit 593669c2ac ("x86/PCI/ACPI: Use common ACPI resource interfaces
to simplify implementation") started accepting all IO port and MMIO
resources, which caused a regression that IO port resources consumed
by the host bridge itself became available to its child devices.

Then commit 63f1789ec7 ("x86/PCI/ACPI: Ignore resources consumed by
host bridge itself") ignored resources consumed by the host bridge
itself by checking the IORESOURCE_WINDOW flag, which accidently removed
MMIO resources defined by acpi_resource_memory24, acpi_resource_memory32
and acpi_resource_fixed_memory32.

On x86 and IA64 platforms, all IO port and MMIO resources are assumed
to be available to child bus/devices except one special case:
    IO port [0xCF8-0xCFF] is consumed by the host bridge itself
    to access PCI configuration space.

So explicitly filter out PCI CFG IO ports[0xCF8-0xCFF]. This solution
will also ease the way to consolidate ACPI PCI host bridge common code
from x86, ia64 and ARM64.

Related ACPI table are archived at:
https://bugzilla.kernel.org/show_bug.cgi?id=94221

Related discussions at:
http://patchwork.ozlabs.org/patch/461633/
https://lkml.org/lkml/2015/3/29/304

Fixes: 63f1789ec7 (Ignore resources consumed by host bridge itself)
Reported-by: Bernhard Thaler <bernhard.thaler@wvnet.at>
Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com>
Cc: 4.0+ <stable@vger.kernel.org> # 4.0+
Reviewed-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-04-30 22:17:34 +02:00
Chris Bainbridge 61f8ff6939 ACPI / SBS: Enable battery manager when present
Commit 9faf6136ff (ACPI / SBS: Disable smart battery manager on
Apple) introduced a regression disabling the SBS battery manager.
The battery manager should be marked as present when
acpi_manager_get_info() returns 0.

Fixes: 9faf6136ff (ACPI / SBS: Disable smart battery manager on Apple)
Signed-off-by: Chris Bainbridge <chris.bainbridge@gmail.com>
Cc: 3.18+ <stable@vger.kernel.org> # 3.18+
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-04-29 00:04:29 +02:00
Jiri Kosina 6fe9e7c26a GHES: Make NMI handler have a single reader
Since GHES sources are global, we theoretically need only a single CPU
reading them per NMI instead of a thundering herd of CPUs waiting on a
spinlock in NMI context for no reason at all.

Do that.

Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Borislav Petkov <bp@suse.de>
2015-04-27 21:35:33 +02:00
Borislav Petkov 2383844d48 GHES: Elliminate double-loop in the NMI handler
There's no real need to iterate twice over the HW error sources in the
NMI handler. With the previous cleanups, elliminating the second loop is
almost trivial.

Signed-off-by: Borislav Petkov <bp@suse.de>
2015-04-27 21:27:35 +02:00
Borislav Petkov 6169ddf846 GHES: Panic right after detection
The moment we log an error of panic severity, there's no need to noodle
through the ghes_nmi list anymore. So panic instead right then and
there.

Signed-off-by: Borislav Petkov <bp@suse.de>
2015-04-27 21:23:44 +02:00
Borislav Petkov e10be03f60 GHES: Carve out the panic functionality
... into another function for more clarity. No functionality change.

Signed-off-by: Borislav Petkov <bp@suse.de>
2015-04-27 21:21:46 +02:00
Borislav Petkov 115684961a GHES: Carve out error queueing in a separate function
Make the handler more readable.

No functionality change.

Signed-off-by: Borislav Petkov <bp@suse.de>
2015-04-27 21:16:06 +02:00
Linus Torvalds c8b3fd0ce3 More power management and ACPI updates for v4.1-rc1
- Fix a build warning in the intel_pstate driver showing up in non-SMP
    builds (Borislav Petkov).
 
  - Change one of the intel_pstate's P-state selection parameters for
    Baytrail and Cherrytrail CPUs to significantly improve performance
    at the cost of a small increase in energy consumption (Kristen
    Carlson Accardi).
 
  - Fix a NULL pointer dereference in the ACPI EC driver due to an unsafe
    list walk in the query handler removal routine (Chris Bainbridge).
 
  - Get rid of a false-positive lockdep warning in the ACPI container
    hot-remove code (Rafael J Wysocki).
 
  - Prevent the ACPI device enumeration code from creating device
    objects of a wrong type in some cases (Rafael J Wysocki).
 
  - Add Skylake processors support to the Intel RAPL power capping
    driver (Brian Bian).
 
  - Drop the stale MAINTAINERS entry for the ACPI dock driver that is
    regarded as part of the ACPI core and maintained along with it now
    (Chao Yu).
 
  - Fix cpupower tool breakage caused by a library API change in libpci
    3.3.0 (Lucas Stach).
 
 /
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABCAAGBQJVOoMNAAoJEILEb/54YlRxx+QP/A/gaX9GgB6rv627Khlaw2AK
 PpE1SrJoU9jAEwPqXtRnYc/6nducDzO5XaHOdWaV02YCpKLL5vIyia6wcy7cf4kr
 6vJUnBz0OiHjp4e4sYrvIGt7RrLnlodayKAzNgtjDjF2JE3gzOOldD0klcfisiUP
 Uc7Y3bpFndS8fwpcJO0tGm73aA9kNC5N8sYxgtuv/OAeMmJgi0fIi2V227XIurJU
 48nMJ1v7M3OChmhdfxEtUSR9TM8J0Ck3yJwPYORNFItRCGqHJb3WY6lo1kbNcv1g
 SLwbw+nCaq+E4k2PtDAsg68Ni0uGGnytcBTzhtPeUOdPRulp4CHCnZEyMUBwFVV8
 gZlgL2S3CxcBlZ52hVB9tAhAyRcxmaWrp1v/hNsTh1xX9v9JFUFdpjYvk1RlHKwD
 aT30G1mV8icU9lrYzhNOnh9gMrZVv6wy4sp4Uk1NLa17WXu+p0LMrCX8HJEb3PT3
 rYZ8jbzo422lTksopiLTLhY4ipgX+kysa7NhTtw/J5Hb9xctho0uTsIhP6sSkh2e
 eHO8WthEpF36228n6qiGGTBMcs4xPD8goxXCeBmgsBeVAQDaVR1IcArVTS+HAaJX
 KOhemws+ThpEpjqB8jbpa42OEmY1Um3UUufHwnJIX54vGkSlXBxXE9r3hCwK7Mgu
 hQhnM9hargHcy9Z8vd91
 =0bKD
 -----END PGP SIGNATURE-----

Merge tag 'pm+acpi-4.1-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull more power management and ACPI updates from Rafael Wysocki:
 "These are fixes mostly (intel_pstate, ACPI core, ACPI EC driver,
  cpupower tool), a new CPU ID for the Intel RAPL driver and one
  intel_pstate driver improvement that didn't make it to my previous
  pull requests due to timing.

  Specifics:

   - Fix a build warning in the intel_pstate driver showing up in
     non-SMP builds (Borislav Petkov)

   - Change one of the intel_pstate's P-state selection parameters for
     Baytrail and Cherrytrail CPUs to significantly improve performance
     at the cost of a small increase in energy consumption (Kristen
     Carlson Accardi)

   - Fix a NULL pointer dereference in the ACPI EC driver due to an
     unsafe list walk in the query handler removal routine (Chris
     Bainbridge)

   - Get rid of a false-positive lockdep warning in the ACPI container
     hot-remove code (Rafael J Wysocki)

   - Prevent the ACPI device enumeration code from creating device
     objects of a wrong type in some cases (Rafael J Wysocki)

   - Add Skylake processors support to the Intel RAPL power capping
     driver (Brian Bian)

   - Drop the stale MAINTAINERS entry for the ACPI dock driver that is
     regarded as part of the ACPI core and maintained along with it now
     (Chao Yu)

   - Fix cpupower tool breakage caused by a library API change in libpci
     3.3.0 (Lucas Stach)"

* tag 'pm+acpi-4.1-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
  ACPI / scan: Add a scan handler for PRP0001
  ACPI / scan: Annotate physical_node_lock in acpi_scan_is_offline()
  ACPI / EC: fix NULL pointer dereference in acpi_ec_remove_query_handler()
  MAINTAINERS: remove maintainship entry of docking station driver
  powercap / RAPL: Add support for Intel Skylake processors
  cpufreq: intel_pstate: Fix an annoying !CONFIG_SMP warning
  intel_pstate: Change the setpoint for Atom params
  cpupower: fix breakage from libpci API change
2015-04-26 13:56:35 -07:00
Linus Torvalds 836ee4874e Initial ACPI support for arm64:
This series introduces preliminary ACPI 5.1 support to the arm64 kernel
 using the "hardware reduced" profile. We don't support any peripherals
 yet, so it's fairly limited in scope:
 
 - Memory init (UEFI)
 - ACPI discovery (RSDP via UEFI)
 - CPU init (FADT)
 - GIC init (MADT)
 - SMP boot (MADT + PSCI)
 - ACPI Kconfig options (dependent on EXPERT)
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQEcBAABCgAGBQJVNOC2AAoJELescNyEwWM08dIH/1Pn5xa04wwNDn0MOpbuQMk2
 kHM7hx69fbXflTJpnZRVyFBjRxxr5qilA7rljAFLnFeF8Fcll/s5VNy7ElHKLISq
 CB0ywgUfOd/sFJH57rcc67pC1b/XuqTbE1u1NFwvp2R3j1kGAEJWNA6SyxIP4bbc
 NO5jScx0lQOJ3rrPAXBW8qlGkeUk7TPOQJtMrpftNXlFLFrR63rPaEmMZ9dWepBF
 aRE4GXPvyUhpyv5o9RvlN5l8bQttiRJ3f9QjyG7NYhX0PXH3DyvGUzYlk2IoZtID
 v3ssCQH3uRsAZHIBhaTyNqFnUIaDR825bvGqyG/tj2Dt3kQZiF+QrfnU5D9TuMw=
 =zLJn
 -----END PGP SIGNATURE-----

Merge tag 'arm64-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux

Pull initial ACPI support for arm64 from Will Deacon:
 "This series introduces preliminary ACPI 5.1 support to the arm64
  kernel using the "hardware reduced" profile.  We don't support any
  peripherals yet, so it's fairly limited in scope:

   - MEMORY init (UEFI)

   - ACPI discovery (RSDP via UEFI)

   - CPU init (FADT)

   - GIC init (MADT)

   - SMP boot (MADT + PSCI)

   - ACPI Kconfig options (dependent on EXPERT)

  ACPI for arm64 has been in development for a while now and hardware
  has been available that can boot with either FDT or ACPI tables.  This
  has been made possible by both changes to the ACPI spec to cater for
  ARM-based machines (known as "hardware-reduced" in ACPI parlance) but
  also a Linaro-driven effort to get this supported on top of the Linux
  kernel.  This pull request is the result of that work.

  These changes allow us to initialise the CPUs, interrupt controller,
  and timers via ACPI tables, with memory information and cmdline coming
  from EFI.  We don't support a hybrid ACPI/FDT scheme.  Of course,
  there is still plenty of work to do (a serial console would be nice!)
  but I expect that to happen on a per-driver basis after this core
  series has been merged.

  Anyway, the diff stat here is fairly horrible, but splitting this up
  and merging it via all the different subsystems would have been
  extremely painful.  Instead, we've got all the relevant Acks in place
  and I've not seen anything other than trivial (Kconfig) conflicts in
  -next (for completeness, I've included my resolution below).  Nearly
  half of the insertions fall under Documentation/.

  So, we'll see how this goes.  Right now, it all depends on EXPERT and
  I fully expect people to use FDT by default for the immediate future"

* tag 'arm64-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux: (31 commits)
  ARM64 / ACPI: make acpi_map_gic_cpu_interface() as void function
  ARM64 / ACPI: Ignore the return error value of acpi_map_gic_cpu_interface()
  ARM64 / ACPI: fix usage of acpi_map_gic_cpu_interface
  ARM64: kernel: acpi: honour acpi=force command line parameter
  ARM64: kernel: acpi: refactor ACPI tables init and checks
  ARM64: kernel: psci: let ACPI probe PSCI version
  ARM64: kernel: psci: factor out probe function
  ACPI: move arm64 GSI IRQ model to generic GSI IRQ layer
  ARM64 / ACPI: Don't unflatten device tree if acpi=force is passed
  ARM64 / ACPI: additions of ACPI documentation for arm64
  Documentation: ACPI for ARM64
  ARM64 / ACPI: Enable ARM64 in Kconfig
  XEN / ACPI: Make XEN ACPI depend on X86
  ARM64 / ACPI: Select ACPI_REDUCED_HARDWARE_ONLY if ACPI is enabled on ARM64
  clocksource / arch_timer: Parse GTDT to initialize arch timer
  irqchip: Add GICv2 specific ACPI boot support
  ARM64 / ACPI: Introduce ACPI_IRQ_MODEL_GIC and register device's gsi
  ACPI / processor: Make it possible to get CPU hardware ID via GICC
  ACPI / processor: Introduce phys_cpuid_t for CPU hardware ID
  ARM64 / ACPI: Parse MADT for SMP initialization
  ...
2015-04-24 08:23:45 -07:00
Rafael J. Wysocki e0155a99b2 Merge branches 'acpi-dock', 'acpi-ec' and 'acpi-scan'
* acpi-dock:
  MAINTAINERS: remove maintainship entry of docking station driver

* acpi-ec:
  ACPI / EC: fix NULL pointer dereference in acpi_ec_remove_query_handler()

* acpi-scan:
  ACPI / scan: Add a scan handler for PRP0001
  ACPI / scan: Annotate physical_node_lock in acpi_scan_is_offline()
2015-04-24 02:18:52 +02:00
Rafael J. Wysocki 7d284352f9 ACPI / scan: Add a scan handler for PRP0001
If the special PRP0001 device ID is present in the given device's list
of ACPI/PNP IDs and the device has a valid "compatible" property in
the _DSD, it should be enumerated using the default mechanism,
unless some scan handlers match the IDs preceding PRP0001 in the
device's list of ACPI/PNP IDs.  In addition to that, no scan handlers
matching the IDs following PRP0001 in that list should be attached
to the device.

To make that happen, define a scan handler that will match PRP0001
and trigger the default enumeration for the matching devices if the
"compatible" property is present for them.

Since that requires the check for platform_id and device->handler
to be removed from acpi_default_enumeration(), move the fallback
invocation of acpi_default_enumeration() to acpi_bus_attach()
(after it's checked if there's a matching ACPI driver for the
device), which is a better place to call it, and do the platform_id
check in there too (device->handler is guaranteed to be unset at
the point where the function is looking for a matching ACPI driver).

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Darren Hart <dvhart@linux.intel.com>
2015-04-24 02:18:01 +02:00
Rafael J. Wysocki 4c533c801d ACPI / scan: Annotate physical_node_lock in acpi_scan_is_offline()
acpi_scan_is_offline() may be called under the physical_node_lock
lock of the given device object's parent, so prevent lockdep from
complaining about that by annotating that instance with
SINGLE_DEPTH_NESTING.

Fixes: caa73ea158 (ACPI / hotplug / driver core: Handle containers in a special way)
Reported-and-tested-by: Xie XiuQi <xiexiuqi@huawei.com>
Reviewed-by: Toshi Kani <toshi.kani@hp.com>
Cc: 3.14+ <stable@vger.kernel.org> # 3.14+
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-04-24 02:16:03 +02:00
Chris Bainbridge 6b5eab5469 ACPI / EC: fix NULL pointer dereference in acpi_ec_remove_query_handler()
Use list_for_each_entry_safe for iterating because handler may be freed
in the loop.

BUG: unable to handle kernel NULL pointer dereference at 000000000000002c
IP: [<ffffffff814d69c8>] acpi_ec_put_query_handler+0x7/0x1a
Call Trace:
 acpi_ec_remove_query_handler+0x87/0x97
 acpi_smbus_hc_remove+0x2a/0x44 [sbshc]
 acpi_device_remove+0x7b/0x9a
 __device_release_driver+0x7e/0x110
 driver_detach+0xb0/0xc0
 bus_remove_driver+0x54/0xe0
 driver_unregister+0x2b/0x60
 acpi_bus_unregister_driver+0x10/0x12
 acpi_smb_hc_driver_exit+0x10/0x12 [sbshc]
 SyS_delete_module+0x1b8/0x210
 system_call_fastpath+0x12/0x6a

Signed-off-by: Chris Bainbridge <chris.bainbridge@gmail.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-04-22 04:12:35 +02:00
Linus Torvalds 0f5abd4020 ACPICA updates for v4.1-rc1
- Fix for a GPE handling regression on Dell Latitude D600 that
    caused GPE signaling to stop working on that machine, which
    appears to be due to a hardware glitch, but it used to work
    and it can be made work again in a relativly straightforward
    way (Rafael J Wysocki).
 
  - Fix for a mutex unlock regression related to the handling of ACPI
    tables introduced during the 3.16 development cycle (Octavian Purdila).
 
  - _REV modification to always return 2 which has been done by all
    versions of Windows since NT and the firmware people started to
    use it to distinguish between OSes in their AML and do some silly
    and wrong things on that basis (Bob Moore).
 
  - Fixes and cleanups related to the acpi_physicall_address data type
    including one stable-candidate fix for an issue occasionally occuring
    on 64-bit machines running 32-bit kernels where using offsets provided
    by the firmware may lead to address overflows (Lv Zheng).
 
  - External() opcode support infrastructure needed for recompiling
    disassembled ACPI tables in some cases including interpreter
    modification to ignore that opcode (Bob Moore).
 
  - Support for the "Windows 2015" string in _OSI (Bob Moore).
 
  - GPE debug interface change to return values read from hardware
    registers (Lv Zheng).
 
  - Removal of the __DATE__ macro usage in tools (Rasmus Villemoes).
 
  - Assorted minor fixes and cleanups (Lv Zheng, Rickard Strandqvist,
    Bob Moore).
 
 /
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABCAAGBQJVMFyLAAoJEILEb/54YlRxCdgQAK5C0mkWOYgvNr5/Mur3bhgJ
 kwa/IDRWKFB6EU4vIEK5sVR4IHGknbRo4XskVt5aHTLgSHWY/ArvACs0nruCR9+s
 hvlwqtWuZlqlDNQrP9XuP10CjDvbhEijWo05TmfeI52Rt50aUa+4yrHtO/F5he6l
 DtrPZDzW+N3sEt4gBbqVp4nHNVo2O8JGvoaYAM+ASGW7xxQgNNjt+HTqFarDdVCq
 MCalceHgzlxWSMY5sCs2xsdJzbc9P0n6dZisByuFZvujMv8QvQ5LZv0s4Ty/XZMK
 deU5ziY5SoYlzruHll8UtSbXP4RW9V7hTly01i5zbKxy8gPvDDhjliulYJoVGg5T
 DiAOUp7qpbksdrR3fXn8C1LF1+0UcW2yD9mOb3WVAoMj4r9ngxxi0btA1OurZI/Y
 BGBeUxQSoAb0tzPUU1FQin0wwTBUC+o/ZGlf1ECkezCPr7CRlpi1e64Ws46/8vt9
 sA78u7fLnTl/H4EIeg2qAT98J9AnQxbXncwuoZ5inr/tDxl5ER5zpQK4EfO/H+nC
 8j7x3j8kQ/AEs4wEleQYAG6HXFu6GLw2cuhcKGnqW9cEI9xjiqDBfWWC1Vigkvou
 ScolTguT0u0d5d0wNQqPtcEyaGcYYDMZfpzO81bU/fFqtg++/i1gKXKPy77KdpV1
 s9/RkrCv7tx2Dy5kcXpi
 =xUhi
 -----END PGP SIGNATURE-----

Merge tag 'acpica-4.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull ACPICA updates from Rafael Wysocki:
 "This updates the kernel's ACPICA code to upstream revision 20150410
  and adds a fix for a GPE handling regression introduced during the
  3.19 cycle on top of that.

  Included are two stable-candidate bug fixes (one of them fixing a 3.16
  regression), multiple other fixes and a bunch of cleanups.

  Specifics:

   - Fix for a GPE handling regression on Dell Latitude D600 that caused
     GPE signaling to stop working on that machine, which appears to be
     due to a hardware glitch, but it used to work and it can be made
     work again in a relativly straightforward way (Rafael J Wysocki).

   - Fix for a mutex unlock regression related to the handling of ACPI
     tables introduced during the 3.16 development cycle (Octavian
     Purdila).

   - _REV modification to always return 2 which has been done by all
     versions of Windows since NT and the firmware people started to use
     it to distinguish between OSes in their AML and do some silly and
     wrong things on that basis (Bob Moore).

   - Fixes and cleanups related to the acpi_physicall_address data type
     including one stable-candidate fix for an issue occasionally
     occuring on 64-bit machines running 32-bit kernels where using
     offsets provided by the firmware may lead to address overflows (Lv
     Zheng).

   - External() opcode support infrastructure needed for recompiling
     disassembled ACPI tables in some cases including interpreter
     modification to ignore that opcode (Bob Moore).

   - Support for the "Windows 2015" string in _OSI (Bob Moore).

   - GPE debug interface change to return values read from hardware
     registers (Lv Zheng).

   - Removal of the __DATE__ macro usage in tools (Rasmus Villemoes).

   - Assorted minor fixes and cleanups (Lv Zheng, Rickard Strandqvist,
     Bob Moore)"

* tag 'acpica-4.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (32 commits)
  ACPICA: Store GPE register enable masks upfront
  ACPICA: Update version to 20150410.
  ACPICA: Fix a couple issues with the local printf module.
  ACPICA: Disassembler: Some cleanup of the table dump module.
  ACPICA: iASL: Add support for MSDM ACPI table.
  ACPICA: Update for SLIC ACPI table.
  ACPICA: Add "//" before ascii output of buffers.
  ACPICA: Remove unused internal AML opcode.
  ACPICA: Permanently set _REV to the value '2'.
  ACPICA: Add "Windows 2015" string to _OSI support.
  ACPICA: Add infrastructure for External() opcode.
  ACPICA: iASL: Enhancement for constant folding.
  ACPICA: iASL/Disassembler: Add option to assume table contains valid AML.
  ACPICA: Update AML Debugger global variables.
  ACPICA: Update Resource descriptor dump module.
  ACPICA: Fix a sscanf format string.
  ACPICA: Casting changes around acpi_physical_address/acpi_size.
  ACPICA: Resources: Correct conditional compilation definitions.
  ACPICA: Utilities: Correct conditional compilation definitions.
  ACPICA: Tables: Move an iasl specific table function to iasl source file.
  ...
2015-04-17 15:01:29 -04:00