aboutsummaryrefslogtreecommitdiffstats
path: root/xen/drivers/acpi
Commit message (Collapse)AuthorAgeFilesLines
* acpi/pmstat: fix check for empty name strings.Tim Deegan2013-09-121-2/+2
| | | | | | | | | | | | These 'name' strings are actually arrays in their structs. So the address is never NULL: instead, we should check the first character to detect cases where the field wasn't initialized. Coverity CID 1055633 Signed-off-by: Tim Deegan <tim@xen.org> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Jan Beulich <jbeulich@suse.com>
* ACPI: use ioremap() in acpi_os_map_memory()Jan Beulich2013-08-211-5/+11
| | | | | | | This drops the post-boot use of __acpi_map_table() here again (together with the somewhat awkward locking), in favor of using ioremap(). Signed-off-by: Jan Beulich <jbeulich@suse.com>
* ACPI: fix acpi_os_map_memory()Jan Beulich2013-08-211-10/+13
| | | | | | | | | | | | | | It using map_domain_page() was entirely wrong. Use __acpi_map_table() instead for the time being, with locking added as the mappings it produces get replaced with subsequent invocations. Using locking in this way is acceptable here since the only two runtime callers are acpi_os_{read,write}_memory(), which don't leave mappings pending upon returning to their callers. Also fix __acpi_map_table()'s first parameter's type - while benign for unstable, backports to pre-4.3 trees will need this. Signed-off-by: Jan Beulich <jbeulich@suse.com>
* ACPI/APEI: revert "accept validly sized ERST on Intel systems only for now"Jan Beulich2013-03-281-13/+0
| | | | | | | | With the recent two fixes to ERST handling, this should no longer be necessary. Signed-off-by: Jan Beulich <jbeulich@suse.com> Tested-by: Andrew Cooper <andrew.cooper3@citrix.com>
* ACPI, APEI: Add apei_exec_run_optionalHuang Ying2013-03-222-4/+16
| | | | | | | | | | | | | | | | | | Some actions in APEI ERST and EINJ tables are optional, for example, ACPI_EINJ_BEGIN_OPERATION action is used to do some preparation for error injection, and firmware may choose to do nothing here. While some other actions are mandatory, for example, firmware must provide ACPI_EINJ_GET_ERROR_TYPE implementation. Original implementation treats all actions as optional (that is, can have no instructions), that may cause issue if firmware does not provide some mandatory actions. To fix this, this patch adds apei_exec_run_optional, which should be used for optional actions. The original apei_exec_run should be used for mandatory actions. Signed-off-by: Huang Ying <ying.huang@intel.com> Signed-off-by: Jan Beulich <jbeulich@suse.com> Tested-by: Andrew Cooper <andrew.cooper3@citrix.com>
* ACPI/APEI: Unlock apei_iomaps_lock on error pathAndrew Cooper2013-03-221-4/+2
| | | | | | | | | | | | | This causes deadlocks during early boot on hardware with broken/buggy APEI implementations, such as a Dell Poweredge 2950 with the latest currently available BIOS. Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> Don't use goto or another special error path, as handling the error case in normal flow is quite simple. Signed-off-by: Jan Beulich <jbeulich@suse.com>
* ACPI/ERST: Name table in otherwise opaque error messagesAndrew Cooper2013-03-201-2/+2
| | | | | | | | Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> Fix spelling and lower severities. Signed-off-by: Jan Beulich <jbeulich@suse.com>
* ACPI: support v5 (reduced HW) sleep interfaceJan Beulich2013-02-221-0/+16
| | | | | | | | | | | | Note that this also fixes a broken input check in acpi_enter_sleep() (previously validating the sleep->pm1[ab]_cnt_val relationship based on acpi_sinfo.pm1b_cnt_val, which however gets set only subsequently). Also adjust a few minor issues with the pre-v5 handling in acpi_fadt_parse_sleep_info(). Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org>
* ACPICA: Update for larger ACPI 5 FADT sizeBob Moore2013-02-221-5/+6
| | | | | | | | | FADT is now larger than 256 bytes, so all FADT offsets must be changed from 8 bits to 16 bits. Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org>
* ACPI 5.0: Implement hardware-reduced optionBob Moore2013-02-221-2/+20
| | | | | | | | | | | | | If HW-reduced flag is set in the FADT, do not attempt to access or initialize any ACPI hardware, including SCI and global lock. No FACS will be present. Signed-off-by: Bob Moore <robert.moore@intel.com> Also adjust acpi_fadt_parse_sleep_info(). Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org>
* ACPI 5.0: Basic support for FADT version 5Bob Moore2013-02-221-2/+3
| | | | | | Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org>
* ACPI: acpi_table_parse() should return handler's error codeBoris Ostrovsky2013-02-051-3/+2
| | | | | | | | | Currently, the error code returned by acpi_table_parse()'s handler is ignored. This patch will propagate handler's return value to acpi_table_parse()'s caller. Signed-off-by: Boris Ostrovsky <boris.ostrovsky@amd.com> Committed-by: Jan Beulich <jbeulich@suse.com>
* fix acpi_dmar_zap/reinstate() (fixes S3 regression)Tomasz Wroblewski2013-01-231-0/+48
| | | | | | | | | | | | | | | | | | | | | | | Fix S3 regression introduced by cs 23013:65d26504e843 (ACPI: large cleanup). The dmar virtual pointer returned from acpi_get_table cannot be safely stored away and used later, as the underlying acpi_os_map_memory / __acpi_map_table functions overwrite the mapping causing it to point to different tables than dmar (last fetched table is used). This subsequently causes acpi_dmar_reinstate() and acpi_dmar_zap() to write data to wrong table, causing its corruption and problems with consecutive s3 resumes. Added a new function to fetch ACPI table physical address, and establishing separate static mapping for dmar_table pointer instead of using acpi_get_table(). Signed-off-by: Tomasz Wroblewski <tomasz.wroblewski@citrix.com> Added call to acpi_tb_verify_table(). Fixed page count passed to map_pages_to_xen(). Cosmetic changes. Signed-off-by: Jan Beulich <jbeulich@suse.com> Committed-by: Jan Beulich <jbeulich@suse.com>
* ACPI: fix return value of XEN_PM_PDC platform opJan Beulich2012-11-281-2/+2
| | | | | | | | | | | Should return -EFAULT when copying to guest memory fails. Once touching this code, also switch to using the more relaxed copy function (copying from the same guest memory already validated the virtual address range). Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org>
* implement vmap()Jan Beulich2012-11-221-31/+0
| | | | | | | ... and use it as basis for a proper ioremap() on x86. Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org>
* ACPI/APEI: accept validly sized ERST on Intel systems only for nowJan Beulich2012-10-181-0/+13
| | | | | | | | | Various AMD systems (but [unfortunately] not mine) hang when the table size check passes. Allow the check to pass on Intel systems only for now (until someone can actually debug the problem). Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org>
* xen: replace XEN_GUEST_HANDLE with XEN_GUEST_HANDLE_PARAM when appropriateStefano Stabellini2012-10-171-1/+1
| | | | | | | | | | | | Note: these changes don't make any difference on x86. Replace XEN_GUEST_HANDLE with XEN_GUEST_HANDLE_PARAM when it is used as an hypercall argument. Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Keir Fraser <keir@xen.org> Committed-by: Ian Campbell <ian.campbell@citrix.com>
* ACPI/APEI: fix ERST MOVE_DATA instruction implementationHuang Ying2012-10-171-4/+53
| | | | | | | | | | | | | | | | | The src_base and dst_base fields in apei_exec_context are physical address, so they should be ioremaped before being used in ERST MOVE_DATA instruction. Reported-by: Javier Martinez Canillas <martinez.javier@gmail.com> Reported-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Huang Ying <ying.huang@intel.com> Replace use of ioremap() by __acpi_map_table()/set_fixmap(). Fix error handling. Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org> Committed-by: Jan Beulich <jbeulich@suse.com>
* ACPI: fix APEI related table size checkingHuang Ying2012-10-161-3/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On Huang Ying's machine: erst_tab->header_length == sizeof(struct acpi_table_einj) but Yinghai reported that on his machine, erst_tab->header_length == sizeof(struct acpi_table_einj) - sizeof(struct acpi_table_header) To make erst table size checking code works on all systems, both testing are treated as PASS. Same situation applies to einj_tab->header_length, so corresponding table size checking is changed in similar way too. Originally-by: Yinghai Lu <yinghai@kernel.org> Signed-off-by: Huang Ying <ying.huang@intel.com> - use switch() for better readability - add comment explaining why a formally invalid size it also being accepted - check erst_tab->header.length before even looking at erst_tab->header_length - prefer sizeof(*erst_tab) over sizeof(struct acpi_table_erst) Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org> Committed-by: Jan Beulich <jbeulich@suse.com>
* printk: prefer %#x et at over 0x%xJan Beulich2012-09-213-11/+11
| | | | | | | | | Performance is not an issue with printk(), so let the function do minimally more work and instead save a byte per affected format specifier. Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org>
* ACPI: move tables.c fully into .init.*Jan Beulich2012-09-203-4/+38
| | | | | | | | The only non-init item was the space reserved for the initial tables, but we can as well dynamically allocate that array. Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org>
* drivers: Remove some CONFIG_X86 ifdef'ery.Keir Fraser2012-09-122-12/+0
| | | | | | | | | | Not quite all, but a great deal was to specifically allow ia64 support to be retrofitted to x86 platform code. Since we no longer support ia64 we can happily remove the ifdefs. Any new platform which wanted to share this code would likely need a different set of ifdefs in any case, making it a brand new porting effort. Signed-off-by: Keir Fraser <keir@xen.org>
* acpi: Make sure valid CPU is passed to do_pm_op()Boris Ostrovsky2012-08-151-19/+2
| | | | | | | | | | | | | | | Passing invalid CPU value to do_pm_op() will cause assertion in cpu_online(). Signed-off-by: Boris Ostrovsky <boris.ostrovsky@amd.com> Such checks would, at a first glance, then also be missing at the top of various helper functions, but these check really were already redundant with the check in do_pm_op(). Remove the redundant checks for clarity and brevity. Signed-off-by: Jan Beulich <jbeulich@suse.com> Committed-by: Jan Beulich <jbeulich@suse.com>
* cpufreq: P state stats aren't available if there is no cpufreq driverDavid Vrabel2012-08-031-0/+2
| | | | | | | | | | If there is no cpufreq driver (e.g., with an AMD Opteron 8212) then reading the P state statistics causes a deadlock as an uninitialized spinlock is locked in do_get_pm_info(). The spinlock is initialized in cpufreq_statistic_init() which is not called if cpufreq_driver == NULL. Signed-off-by: David Vrabel <david.vrabel@citrix.com> Committed-by: Jan Beulich <jbeulich@suse.com>
* x86, cpufreq: Change powernow's CPB status immediatelyBoris Ostrovsky2012-06-181-2/+2
| | | | | | | | | | | | | | When command to modify turbo mode (CPB on AMD processors) comes in the actual change happens later, when P-state transition is requested. There is no time limit on when this transition will occur and therefore change in CPB state may take long time from the moment when command to toggle it is issued. This patch makes CPB mode change happen immediately when request is made. Signed-off-by: Boris Ostrovsky <boris.ostrovsky@amd.com> Committed-by: Keir Fraser <keir@xen.org>
* ACPI: update table interface headersJan Beulich2011-12-131-2/+4
| | | | | | | ... to what is being used on Linux 3.1 (and 3.2-rc). Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org>
* ACPI: eliminate duplicate MADT parsing and unused SBF definitionsJan Beulich2011-12-131-10/+11
| | | | | | | Use their proper counterparts in include/acpi/actbl*.h instead. Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org>
* eliminate first_cpu() etcJan Beulich2011-11-081-1/+1
| | | | | | | | This includes the conversion from for_each_cpu_mask() to for_each-cpu(). Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org> Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
* cpufreq: allocate CPU masks dynamicallyJan Beulich2011-11-071-3/+3
| | | | | | | | | | struct cpufreq_policy, including a cpumask_t member, gets copied in cpufreq_limit_change(), cpufreq_add_cpu(), set_cpufreq_gov(), and set_cpufreq_para(). Make the member a cpumask_var_t, thus reducing the amount of data needing copying (particularly with large NR_CPUS). Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org>
* introduce and use nr_cpu_ids and nr_cpumask_bitsJan Beulich2011-10-211-1/+1
| | | | | | | | | | | | | | | The former is the runtime equivalent of NR_CPUS (and users of NR_CPUS, where necessary, get adjusted accordingly), while the latter is for the sole use of determining the allocation size when dynamically allocating CPU masks (done later in this series). Adjust accessors to use either of the two to bound their bitmap operations - which one gets used depends on whether accessing the bits in the gap between nr_cpu_ids and nr_cpumask_bits is benign but more efficient. Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org>
* use xzalloc in driver codeJan Beulich2011-10-041-8/+3
| | | | | Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org>
* PCI multi-seg: config space accessor adjustmentsJan Beulich2011-09-221-1/+1
| | | | Signed-off-by: Jan Beulich <jbeulich@suse.com>
* ACPI: add _PDC input override mechanismJan Beulich2011-08-221-0/+31
| | | | | | | | | | | | | | In order to have Dom0 call _PDC with input fully representing Xen's capabilities, and in order to avoid building knowledge of Xen implementation details into Dom0, this provides a mechanism by which the Dom0 kernel can, once it filled the _PDC input buffer according to its own knowledge, present the buffer to Xen to apply overrides for the parts of the C-, P-, and T-state management that it controls. This is particularly to address the dependency of Xen using MWAIT to enter certain C-states on the availability of the break-on-interrupt extension (which the Dom0 kernel should have no need to know about). Signed-off-by: Jan Beulich <jbeulich@novell.com>
* ACPI ERST: Revert change to erst_check_table() to be more permissive.Keir Fraser2011-08-091-7/+1
| | | | | | | Permits tables that apparently Xen cannot handle (causes boot failure on many systems). Signed-off-by: Keir Fraser <keir@xen.org>
* acpi: Add support for old and new bios erst, enable mce_apei logicLiu, Jinsong2011-07-231-1/+7
| | | | | | | | | When testing, we found different bios has different understanding about APEI ERST table header, depending on whether it count ACPI standard header or not. This patch add support for both bios version, and enable mce_apei. Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
* x86-64: EFI boot codeJan Beulich2011-06-281-7/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Besides introducing the relevant code paralleling parts of what is under xen/arch/x86/boot/, this adjusts the build logic so that with a single compilation two images (gzip-compressed ELF and EFI application) can get created. The EFI part of this depends on a new enough compiler (supposedly gcc 4.4.x and above, but so far only tested to work with 4.5.x) and a properly configured linker (must support the i386pep emulation). If either functionality is found to not be available, the EFI part of the build will simply be skipped. The patch adds all code to allow Xen and the (accordingly enabled) Dom0 kernel to boot, but doesn't allow Dom0 to make use of EFI runtime calls (this will be the subject of the next patch). Parts of the code were lifted from an earlier never published OS project of ours - whether respective license information needs to be added to the respective source file is unclear to me (I was told internally that adding a GPLv2 license header can be done if needed by the community). Open issues (not preventing this from being committed imo): The trampoline allocation and initialization isn't really nice. This is due to the trampoline needing to be placed at a fixed address, and hence making the trampoline relocatable would seem desirable here (as well as for BIOS-based booting, where the trampoline location needed to be adjusted a number of time already in the past, due to it colliding with firmware data). By excluding mem.S, edd.S, and video.S from copied trampoline (i.e. moving up wakeup.S? and making sure none of the symbols are used from EFI code), the effective trampoline size could at least be reduced. Should the mappings of [__XEN_VIRT_START, mbi.mem_upper) and [_end, __XEN_VIRT_START+BOOTSTRAP_MAP_BASE) be destroyed, despite non-EFI code also keeping them? Signed-off-by: Jan Beulich <jbeulich@novell.com>
* xen: remove more declarations from C files.Tim Deegan2011-05-271-2/+0
| | | | | | | | | | This patch moves some more, mostly data, extern declarations into header files. I haven't been as strict as I was with functions; in particular there are a number of declarations of assembler labels that are only used in one place. I've also left a few compat-mode tricks, and all the magic in symbols.c Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
* Remove "uninitialized_var" macro, which doesn't work with clang.Tim Deegan2011-04-131-1/+1
| | | | | | | Since its only user is in ACPI parsing code, the extra overhead of initializing to 0 is not worth fighting over. Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
* xen/acpi: disentangle ACPI enumerations.Tim Deegan2011-04-071-1/+1
| | | | | | | | | | There are two sets of ACPI table enums and structs, and clang complains about implicit casts between them. It would be much better to remove one entire set of ACPI definitions but for now just use the right enum for each interface. Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com> Acked-by: Keir Fraser <keir@xen.org>
* x86/ACPI: __init-annotateJan Beulich2011-04-024-9/+10
| | | | | | | | | xen/arch/x86/acpi/boot.c consists of almost only code/data in .init.*, so move the few bits that aren't into a new file and then use the recently introduced .init.o mechanism to move all the literal strings into .init.rodata. Signed-off-by: Jan Beulich <jbeulich@novell.com>
* ACPI: large cleanupJan Beulich2011-03-0910-710/+25
| | | | | | | | In some cases, entire files turned out unnecessary. Of what remains, move whatever possible into .init.*, and some data items into .data.read_mostly. Signed-off-by: Jan Beulich <jbeulich@novell.com>
* x86_64: don't use weak symbols on x86-64Keir Fraser2011-01-101-2/+3
| | | | | | | | | | | | | | | | | | Various gcc versions inline functions that are both weak and hidden, without even giving a warning. Certainly the risk exists that we'll see the problem again when another weak function gets introduced, but I don't see a way to protect us from that. Signed-off-by: Jan Beulich <jbeulich@novell.com> Just remove the weak attribute altogether. It's the only one in non-ia64-specific code. We can get teh same effect with ifdefs which although a bit unsightly is better than using compiler/linker features we cannot trust. Signed-off-by: Keir Fraser <keir@xen.org>
* ACPI: __init-annotate APEI codeKeir Fraser2010-12-243-19/+20
| | | | Signed-off-by: Jan Beulich <jbeulich@novell.com>
* Use bool_t for various boolean variablesKeir Fraser2010-12-242-5/+2
| | | | | | | | | | | ... decreasing cache footprint. As a prerequisite this requires making cmdline_parse() a little more flexible. Also remove a few variables altogether, and adjust sections annotations for several others. Signed-off-by: Jan Beulich <jbeulich@novell.com> Signed-off-by: Keir Fraser <keir@xen.org>
* x86 acpi: Follow Windows behaviour more closely during reset.Keir Fraser2010-12-101-3/+4
| | | | | | | | | | | This follows some changes proposed for upstream Linux: 1. Do not check the FADT reset register size/offset 2. Try ACPI poking twice during our reset attempt sequence Hopefully this will help us reset reliably on a wider range of platforms. Signed-off-by: Keir Fraser <keir@xen.org>
* ACPI: fix typoKeir Fraser2010-10-291-1/+1
| | | | Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
* Disable ACPI APEI feature for ia64Keir Fraser2010-09-021-1/+1
| | | | | | The apei-io.c cannot be built on ia64. Signed-off-by: KUWAMURA Shin'ya <kuwa@jp.fujitsu.com>
* Implement ACPI APEI ERST featureKeir Fraser2010-08-226-0/+1470
| | | | | | | | | | | | | | | | | APEI are ACPI4.0 new features. It consists of ERST, BERT, HEST, and EINJ. ERST is used to save fault error log to a platform persistent storage, so that when reboot os can retrieve the error log and handle it. This patch is used to implement ERST feature to Xen. It consists of 3-level hierarchy: operation level, action level, and instru= ction level. Instruction do basic io; Action done by sequential instructions parsed from ACPI ERST table; Operation done by sequential actions defined by ACPI spec, providing erst_write/ erst_read/ erst_clear interfaces to MCE/ NMI/ PCIe error handling mechanism, etc. Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
* kexec: Clean up shutdown logic. Reinstate ACPI DMAR during kexec.Keir Fraser2010-07-291-2/+2
| | | | Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* ACPI: add support for x2APIC ACPI extensionsKeir Fraser2010-07-162-0/+74
| | | | | | | | | | | | | | | | | | | | | | All logical processors with APIC ID values of 255 and greater will have their APIC reported through Processor X2APIC structure (type-9 entry type) and all logical processors with APIC ID less than 255 will have their APIC reported through legacy Processor Local APIC (type-0 entry type) only. This is the same case even for NMI structure reporting. The Processor X2APIC Affinity structure provides the association between the X2APIC ID of a logical processor and the proximity domain to which the logical processor belongs. This patch adds 2 new subtables to MADT and one new subtable to SRAT. This patch also changes x86_acpiid_to_apicid from u8 to u32 for x2APIC ID, and changes mp_register_lapic to accept 32-bit id. But there are still some 8-bit apic id hardcode and assumptions in Xen code, it needs to be fixed in future. Signed-off-by: Weidong Han <weidong.han@intel.com>