linux/drivers/acpi
Lv Zheng 7f9bef9deb ACPICA / Hardware: Fix old register check in acpi_hw_get_access_bit_width()
The address check in acpi_hw_get_access_bit_width() should be byte width
based, not bit width based. This patch fixes this mistake.

For those who want to review acpi_hw_access_bit_width(), here is the
concerns and the design details of the function:

It is supposed that the GAS Address field should be aligned to the byte
width indicated by the GAS AccessSize field. Similarly, for the old non
GAS register, it is supposed that its Address should be aligned to its
Length.

For the "AccessSize = 0 (meaning ANY)" case, we try to return the maximum
instruction width (64 for MMIO or 32 for PIO) or the user expected access
bit width (64 for acpi_read()/acpi_write() or 32 for acpi_hw_read()/
acpi_hw_write()) and it is supposed that the GAS Address field should
always be aligned to the maximum expected access bit width (otherwise it
can't be accessed using ANY access bit width).

The problem is in acpi_tb_init_generic_address(), where the non GAS
register's Length is converted into the GAS BitWidth field, its Address is
converted into the GAS Address field, and the GAS AccessSize field is left
0 but most of the registers actually cannot be accessed using "ANY"
accesses.

As a conclusion, when AccessSize = 0 (ANY), the Address should either be
aligned to the BitWidth (wrong conversion) or aligned to 32 for PIO or 64
for MMIO (real GAS). Since currently, max_bit_width is 32, then:
1. BitWidth for the wrong conversion is 8,16,32; and
2. The Address of the real GAS should always be aligned to 8,16,32.
The address alignment check to exclude false matched real GAS is not
necessary. Thus this patch fixes the issue by removing the address
alignment check.

On the other hand, we in fact could use a simpler check of
"reg->bit_width < max_bit_width" to exclude the "BitWidth=64 PIO" case that
may be issued from acpi_read()/acpi_write() in the future.

Fixes: b314a172ee (ACPICA: Hardware: Add optimized access bit width support)
Reported-and-tested-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Acked-by: Mike Marshall <hubcap@omnibond.com>
Suggested-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2016-06-01 22:44:22 +02:00
..
acpica ACPICA / Hardware: Fix old register check in acpi_hw_get_access_bit_width() 2016-06-01 22:44:22 +02:00
apei Power management and ACPI material for v4.6-rc1, part 1 2016-03-16 14:10:53 -07:00
pmic drivers/acpi: make pmic/intel_pmic_crc.c explicitly non-modular 2016-03-09 23:46:07 +01:00
ac.c ACPI: Remove FSF mailing addresses 2015-07-08 02:27:32 +02:00
acpi_amba.c ACPI / scan: AMBA bus probing support 2016-02-16 19:58:25 +01:00
acpi_apd.c ACPI / APD: Add device HID for future AMD UART controller 2016-03-17 02:54:39 +01:00
acpi_cmos_rtc.c ACPI / RTC: Fix CMOS RTC opregion handler accesses to wrong addresses 2014-09-08 15:38:41 +02:00
acpi_dbg.c ACPI / debugger: Fix a redundant mutex unlock issue in acpi_aml_open() 2015-12-28 01:29:41 +01:00
acpi_extlog.c ACPI and power management updates for 3.17-rc1 2014-08-06 20:34:19 -07:00
acpi_ipmi.c ACPI: Remove FSF mailing addresses 2015-07-08 02:27:32 +02:00
acpi_lpat.c ACPI / LPAT: Common table processing functions 2015-01-29 21:02:10 +08:00
acpi_lpss.c ACPI / LPSS: set PM domain via helper setter 2016-02-03 01:08:22 +01:00
acpi_memhotplug.c ACPI: Remove FSF mailing addresses 2015-07-08 02:27:32 +02:00
acpi_pad.c ACPI / PAD: power_saving_thread() is not freezable 2015-10-26 04:42:54 +01:00
acpi_platform.c Power management and ACPI material for v4.6-rc1, part 1 2016-03-16 14:10:53 -07:00
acpi_pnp.c ACPI / PNP: constify device IDs 2016-01-04 22:10:30 +01:00
acpi_processor.c ACPI / processor: Request native thermal interrupt handling via _OSC 2016-03-26 02:00:38 +01:00
acpi_video.c ACPI / video: remove unused device_decode array 2016-03-09 23:29:07 +01:00
battery.c ACPI: Remove FSF mailing addresses 2015-07-08 02:27:32 +02:00
battery.h ACPI / battery: move some ACPI_BATTERY_* definitions to header 2014-03-19 01:57:46 +01:00
bgrt.c drivers/acpi: make bgrt driver explicitly non-modular 2016-03-09 23:46:07 +01:00
blacklist.c ACPI: Remove FSF mailing addresses 2015-07-08 02:27:32 +02:00
bus.c Merge branch 'acpi-processor' 2016-04-02 01:17:36 +02:00
button.c ACPI: Remove FSF mailing addresses 2015-07-08 02:27:32 +02:00
cm_sbs.c ACPI: Remove FSF mailing addresses 2015-07-08 02:27:32 +02:00
container.c ACPI: Remove FSF mailing addresses 2015-07-08 02:27:32 +02:00
cppc_acpi.c ACPI / CPPC: use MRTT/MPAR to decide if/when a req can be sent 2016-03-09 23:35:29 +01:00
custom_method.c ACPI: Clean up inclusions of ACPI header files 2013-12-07 01:03:14 +01:00
debugfs.c ACPI: fix acpi_debugfs_init prototype 2015-08-07 02:55:18 +02:00
device_pm.c PM / Domains: add setter for dev.pm_domain 2016-01-08 01:12:06 +01:00
device_sysfs.c ACPI / property: avoid leaking format string into kobject name 2016-01-08 01:01:41 +01:00
dock.c ACPI: Remove FSF mailing addresses 2015-07-08 02:27:32 +02:00
ec_sys.c ACPI / EC: Deny write access unless requested by module param 2016-03-09 23:26:15 +01:00
ec.c ACPI-EC: Drop unnecessary check made before calling acpi_ec_delete_query() 2015-11-16 23:29:44 +01:00
event.c netlink: make nlmsg_end() and genlmsg_end() void 2015-01-18 01:03:45 -05:00
fan.c ACPI / fan: Make struct dev_pm_ops const 2016-03-09 23:23:21 +01:00
glue.c Merge branch 'acpi-pci' 2015-11-07 01:30:10 +01:00
gsi.c ACPI: Rename acpi_gsi_get_irq_type to acpi_dev_get_irq_type and export symbol 2016-01-01 03:20:25 +01:00
hed.c ACPI: Remove FSF mailing addresses 2015-07-08 02:27:32 +02:00
int340x_thermal.c ACPI: Eliminate CONFIG_.*{, _MODULE} #ifdef in favor of IS_ENABLED() 2015-09-15 03:05:45 +02:00
internal.h Merge branch 'acpi-processor' 2016-04-02 01:17:36 +02:00
ioapic.c x86/irq, ACPI: Implement ACPI driver to support IOAPIC hotplug 2015-02-05 15:09:26 +01:00
Kconfig ACPI / debugger: Add module support for ACPI debugger 2015-12-15 00:17:44 +01:00
Makefile ACPI / scan: AMBA bus probing support 2016-02-16 19:58:25 +01:00
nfit.c Merge branch 'for-4.6/pfn' into libnvdimm-for-next 2016-03-09 17:15:43 -08:00
nfit.h nfit: scrub and register regions in a workqueue 2016-03-05 12:24:06 -08:00
numa.c ACPI: Remove FSF mailing addresses 2015-07-08 02:27:32 +02:00
nvs.c ACPI: Clean up acpi_os_map/unmap_memory() to eliminate __iomem. 2014-05-27 18:13:08 +02:00
osl.c ACPICA: Linuxize: reduce divergences for 20160212 release 2016-04-04 17:16:07 +02:00
pci_irq.c x86/ACPI/PCI: Recognize that Interrupt Line 255 means "not connected" 2016-03-09 01:23:35 +01:00
pci_link.c Revert "ACPI, PCI, irq: remove interrupt count restriction" 2016-02-24 13:55:38 +01:00
pci_root.c x86/PCI/ACPI: Fix regression caused by commit 4d6b4e69a2 2015-12-02 02:30:15 +01:00
pci_slot.c ACPI: Remove FSF mailing addresses 2015-07-08 02:27:32 +02:00
power.c Merge branch 'acpi-pm' 2015-09-01 03:38:43 +02:00
proc.c ACPI: change acpi_sleep_proc_init() to return void 2015-09-15 03:03:15 +02:00
processor_core.c ACPI / processor: Introduce invalid_phys_cpuid() 2015-05-13 23:28:16 +02:00
processor_driver.c ACPI / sleep: move acpi_processor_sleep to sleep.c 2016-02-22 00:53:56 +01:00
processor_idle.c Power management and ACPI material for v4.6-rc1, part 1 2016-03-16 14:10:53 -07:00
processor_pdc.c ACPI / processor: Introduce invalid_logical_cpuid() 2015-05-13 23:28:14 +02:00
processor_perflib.c Merge branch 'pm-cpufreq' 2015-09-01 15:52:35 +02:00
processor_thermal.c ACPI: Remove FSF mailing addresses 2015-07-08 02:27:32 +02:00
processor_throttling.c ACPI: Remove FSF mailing addresses 2015-07-08 02:27:32 +02:00
property.c ACPI / property: fix data node parsing in acpi_get_next_subnode() 2016-03-17 03:06:38 +01:00
reboot.c
resource.c PCI: ACPI: IA64: fix IO port generic range check 2016-03-22 23:07:49 +01:00
sbs.c ACPI / SBS: fix inconsistent indenting inside if statement 2016-01-04 22:14:27 +01:00
sbshc.c Revert "ACPI / SBS: Add 5 us delay to fix SBS hangs on MacBook" 2015-11-16 23:26:45 +01:00
sbshc.h
scan.c ACPI / scan: AMBA bus probing support 2016-02-16 19:58:25 +01:00
sleep.c Merge branches 'pm-avs', 'pm-clk', 'pm-devfreq' and 'pm-sleep' 2016-03-25 00:58:18 +01:00
sleep.h ACPICA: Drop Linux-specific waking vector functions 2016-01-04 22:05:20 +01:00
sysfs.c ACPI / sysfs: correctly check failing memory allocation 2015-10-26 04:57:27 +01:00
tables.c Merge branches 'acpi-ec', 'acpi-fan', 'acpi-video' and 'acpi-misc' 2016-03-14 14:21:23 +01:00
thermal.c linux/thermal.h: rename KELVIN_TO_CELSIUS to DECI_KELVIN_TO_CELSIUS 2015-10-10 11:32:30 +08:00
utils.c ACPI / util: cast data to u64 before shifting to fix sign extension 2016-03-22 01:23:00 +01:00
video_detect.c ACPI: Revert "ACPI / video: Add Dell Inspiron 5737 to the blacklist" 2016-01-23 03:04:59 +01:00
wakeup.c ACPI: Clean up inclusions of ACPI header files 2013-12-07 01:03:14 +01:00