summaryrefslogtreecommitdiff
path: root/sys/dev/ipmi
AgeCommit message (Collapse)Author
2025-10-20ipmi: Migrate to use macro LINUX_IOCTL_SET to register linux ioctl handlerZhenlei Huang
Reviewed by: markj MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D53158
2025-06-21newbus: replace leftover device unit wildcardsAhmad Khalifa
Reviewed by: imp, jhb Approved by: imp (mentor) Differential Revision: https://reviews.freebsd.org/D50913
2025-05-01efi: Use EDK2 EFI_GUID instead of sturct uuidWarner Losh
So, while struct uuid and EFI_GUID are quite similar (they are the same size, they have the same binary representation, etc), they aren not identical. Speciifcally, the UUID and GUID defines are slightly different and can't be swapped one for the other. Start to use EFI_GUID for all EFI tables. This will allow increased sharing with the boot laoder that already uses EDK2 variants as well as using the possibility to use the EDK2 headers we've already imported more easily. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D50037
2025-03-27ipmi: fix runtime on powerpc64lePiotr Kubaj
Summary: OPAL runs in big-endian mode, so we need to byteswap msg_len on little-endian. MFC after: 1 week Test Plan: ipmitool lan print Reviewers: #powerpc Subscribers: imp Differential Revision: https://reviews.freebsd.org/D49530
2024-10-18ipmi: fix powerpc buildGleb Smirnoff
Fixes: 366d6a424e1faad9c151c5794978e218a79fbed8
2024-10-18ipmi: remove timeout from the ipmi_driver_request methodGleb Smirnoff
Driver requests are done with stack allocated request. The request is put on the tailq and then we msleep(9) until kernel process processes it. If we timeout from this sleep, the kernel process may still read the request from our stack, which may already be reused by some other code. Make this sleep unbound and rely on the kernel process that does all its I/O with timouts and will eventually wake us up. Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D47179
2024-07-24smbios: Add length sanity checkingWarner Losh
D28743 was commited, reverted and then f689cb23b2782 landed before it was recommitted. However, D28743 included an extra length check. Redo that functionality so we check both the number of entries as well as the length checks for wacky data. Sponsored by: Netflix Reviewed by: gallatin Differential Revision: https://reviews.freebsd.org/D45763
2024-07-24ipmi_smbios: Only search for the BIOS signature on x86Warner Losh
Sponsored by: Netflix
2024-07-24newbus: replace -1 in BUS_ADD_CHILD(...-1) with DEVICE_UNIT_ANYWarner Losh
Sponsored by: Netflix
2024-01-28change ipmi watchdog to awlays stop when system is haltedAndriy Gapon
That is, wd_shutdown_countdown value is ignored when halting. A halted system should remain halted for as long as needed until a power cycle, so the watchdog should not reset the system.
2024-01-28fix signature of ipmi_shutdown_eventAndriy Gapon
The function had a signature of watchdog_fn while in fact it is used as shutdown_fn.
2023-11-29pci_cfgreg: Add a PCI domain argument to the low-level register APIJohn Baldwin
This commit changes the API of pci_cfgreg(read|write) to add a domain argument (referred to as a segment in ACPI parlance) (note that this is not the same as a NUMA domain, but something PCI-specific). This does not yet enable access to domains other than 0, but updates the API to support domains. Places that use hard-coded bus/slot/function addresses have been updated to hardcode a domain of 0. A few places that have the PCI domain (segment) available such as the acpi_pcib_acpi.c Host-PCI bridge driver pass the PCI domain. The hpt27xx(4) and hptnr(4) drivers fail to attach to a device not on domain 0 since they provide APIs to their binary blobs that only permit bus/slot/function addressing. The x86 non-ACPI PCI bus drivers all hardcode a domain of 0 as they do not support multiple domains. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D42827
2023-11-26sys: Automated cleanup of cdefs and other formattingWarner Losh
Apply the following automated changes to try to eliminate no-longer-needed sys/cdefs.h includes as well as now-empty blank lines in a row. Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/ Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/ Remove /\n+#if.*\n#endif.*\n+/ Remove /^#if.*\n#endif.*\n/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/ Sponsored by: Netflix
2023-11-13ipmi_ssif: Fix typo in debug printAndrew Gallatin
Fix a typo in a debug print that prevents compilation. Sponsored by: Netflix
2023-08-16sys: Remove $FreeBSD$: one-line .c patternWarner Losh
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
2023-08-16sys: Remove $FreeBSD$: two-line .h patternWarner Losh
Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
2023-06-07ipmi: add Block Transfer interface supportAndrey V. Elsukov
Reviewed by: ambrisko Obtained from: Yandex LLC MFC after: 2 weeks Sponsored by: Yandex LLC Differential Revision: https://reviews.freebsd.org/D40421
2023-05-12spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDWarner Losh
The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of BSD-2-Clause. Discussed with: pfg MFC After: 3 days Sponsored by: Netflix
2023-04-10ipmi: Remove some dead code for unsupported BMCs.John Baldwin
Reviewed by: emaste Reported by: GCC Differential Revision: https://reviews.freebsd.org/D39351
2022-11-01ipmi: use a queue for kcs driver requests when possibleChuck Silvers
The ipmi watchdog pretimeout action can trigger unintentionally in certain rare, complicated situations. What we have seen at Netflix is that the BMC can sometimes be sent a continuous stream of writes to port 0x80, and due to what is a bug or misconfiguration in the BMC software, this results in the BMC running out of memory, becoming very slow to respond to KCS requests, and eventually being rebooted by its own internal watchdog. While that is going on in the BMC, back in the host OS, a number of requests are pending in the ipmi request queue, and the kcs_loop thread is working on processing these requests. All of the KCS accesses to process those requests are timing out and eventually failing because the BMC is responding very slowly or not at all, and the kcs_loop thread is holding the IPMI_IO_LOCK the whole time that is going on. Meanwhile the watchdogd process in the host is trying to pat the BMC watchdog, and this process is sleeping waiting to get the IPMI_IO_LOCK. It's not entirely clear why the watchdogd process is sleeping for this lock, because the intention is that a thread holding the IPMI_IO_LOCK should not sleep and thus any thread that wants the lock should just spin to wait for it. My best guess is that the kcs_loop thread is spinning waiting for the BMC to respond for so long that it is eventually preempted, and during the brief interval when the kcs_loop thread is not running, the watchdogd thread notices that the lock holder is not running and sleeps. When the kcs_loop thread eventually finishes processing one request, it drops the IPMI_IO_LOCK and then immediately takes the lock again so it can process the next request in the queue. Because the watchdogd thread is sleeping at this point, the kcs_loop always wins the race to acquire the IPMI_IO_LOCK, thus starving the watchdogd thread. The callout for the watchdog pretimeout would be reset by the watchdogd thread after its request to the BMC watchdog completes, but since that request never processed, the pretimeout callout eventually fires, even though there is nothing actually wrong with the host. To prevent this saga from unfolding: - when kcs_driver_request() is called in a context where it can sleep, queue the request and let the worker thread process it rather than trying to process in the original thread. - add a new high-priority queue for driver requests, so that the watchdog patting requests will be processed as quickly as possible even if lots of application requests have already been queued. With these two changes, the watchdog pretimeout action does not trigger even if the BMC is completely out to lunch for long periods of time (as long as the watchdogd check command does not also get stuck). Sponsored by: Netflix Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D36555
2022-09-22pmap_unmapdev/bios: Accept a pointer instead of a vm_offset_t.John Baldwin
This matches the return type of pmap_mapdev/bios. Reviewed by: kib, markj Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D36548
2022-09-03impi(4): Fix two typos in source code commentsGordon Bergling
- s/overriden/overridden/ MFC after: 3 days
2022-07-20ipmi(4): spelling fix cyle_wait -> cycle_waitEugene Grosbein
There are no consumers of hw.ipmi.cyle_wait in our tree. Also the knob is undocumented, so it should be safe to fix its name. No MFC planned, though.
2022-07-08ipmi: fix a use-after-free bug in error handlingPhilip Paeps
18db96dbfd4a09063a0abcefd51fa8d2aeb115d6 introduced a use-after-free bug in the error handling of the IPMICTL_RECEIVE_MSG ioctl. Reported by: Coverity (CID 1490456) (via vangyzen) Differential Revision: https://reviews.freebsd.org/D35605
2022-07-04ipmi: do not omit lun in BMC addressesYuri
Some systems put sensors on non-0 lun, so we should not omit it. This was the only difference with the Linux driver, where DIMM sensors could be queried, but not on FreeBSD. See this report[1] on the FreeBSD forums: https://forums.freebsd.org/threads/freebsd-cannot-get-dimm-temperature-sensor-value.85166/ Reviewed by: philip Tested by: Andrey Lanin[1] MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D35612
2022-07-04ipmi: correctly handle ipmb requestsYuri
Handle IPMB requests using SEND_MSG (sent as driver request as we do not need to return anything back to userland for this) and GET_MSG (sent as usual request so we can return the data for RECEIVE_MSG ioctl) pair. This fixes fetching complete sensor data from boards (e.g. HP ProLiant DL380 Gen10). Reviewed by: philip MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D35605
2022-05-09ipmi: Remove unused devclass arguments to DRIVER_MODULE.John Baldwin
2022-05-05ipmi: Use devclass_find to lookup ipmi devclass in ipmi_unload.John Baldwin
Differential Revision: https://reviews.freebsd.org/D35061
2022-04-05ipmi: Remove write only variables used to read form hardwareWarner Losh
Sponsored by: Netflix
2022-03-17ipmi: Make all sysctls also tunables.Alexander Motin
MFC after: 1 week
2021-09-14ipmi(4): Limit maximum watchdog pre-timeout interval.Alexander Motin
Previous code by default setting pre-timeout interval to 120 seconds made impossible to set timeout interval below that, resulting in error 0xcc (Invalid data field in Request) at least on Supermicro boards. To fix that limit maximum pre-timeout interval to ~1/4 of the timeout interval, that sounds like a reasonable default: not too short to fire too late, but also not too long to give many false reports. MFC after: 2 weeks
2021-08-18ipmi: fix negative logic in watchdog control flagWojciech Macek
Use wd_enable instead of wd_disable
2021-08-17ipmi: New tunable to deactivate IPMI watchdogWojciech Macek
In case we want to use other WD than IPMI-provided, add sysctl to disable initialization. Obtained from: Semihalf Sponsored by: Stormshield Differential revision: https://reviews.freebsd.org/D31548
2021-07-29ipmi(4): Add more watchdog error checks.Alexander Motin
Add request submission status checks before checking req->ir_compcode, otherwise it may be zero just because of initialization. Add checks for req->ir_compcode errors in ipmi_reset_watchdog() and ipmi_set_watchdog(). In first case explicitly check for 0x80, which means timer was not previously set, that I found happening after BMC cold reset. This change makes watchdog timer to recover instead of permanently ignoring reset errors after BMC reset or upgraded. MFC after: 2 weeks Sponsored by: iXsystems, Inc.
2021-04-29ipmi: support getting address from EFIYinlong Lu
The original implementation only supports getting the address from legacy BIOS (by searching for the SMBIOS_SIG pattern in a fixed address space). Try to get the SMBIOS table from EFI through efirt (EFI Runtime Services) firstly. Continue to search in the legacy BIOS if a NULL address is returned from EFI. By this way the ipmi function supports both legacy BIOS and UEFI systems. Reviewed by: dab, vangyzen MFC after: 1 week Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D30007
2021-04-07ipmi,smbios: move smbios_walk_table to smbios.hGreg V
This function will be used for exposing DMI info as sysctls in the smbios module (in an upcoming review). While here, add __packed to the structs. Reviewed by: dab MFC after: 1 week Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D29270
2021-02-23Revert "ipmi_smbios: Deduplicate smbios entry point discovery logic"Allan Jude
This depends on another commit that has not landed yet, and broke the build This reverts commit ba6e37e47f41484fc61cc034619267b82ddd056c.
2021-02-23Revert "ipmi_smbios: remove unused smbios_cksum function"Allan Jude
This reverts commit d2589dc3d56ce063b28b54df11c950c3758d9578.
2021-02-23ipmi_smbios: remove unused smbios_cksum functionAllan Jude
Sponsored By: Ampere Computing LLC Submitted By: Klara Inc. Differential Revision: https://reviews.freebsd.org/D28751
2021-02-23ipmi_smbios: Deduplicate smbios entry point discovery logicAllan Jude
Sponsored by: Ampere Computing LLC Submitted by: Klara Inc. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D28743
2021-02-23smbios: Move smbios driver out from x86 machdep codeAllan Jude
Add it to the x86 GENERIC and MINIMAL kernels Sponsored by: Ampere Computing LLC Submitted by: Klara Inc. Reviewed by: rpokala Differential Revision: https://reviews.freebsd.org/D28738
2021-02-18ipmi_ssif: Fix inverted for the end of multi-part readsAllan Jude
As per Intelligent Platform Management Interface Specification v2.0 rev. 1.1, section 12.5: SSIF Multi-part Read Transactions Sponsored by: Ampere Computing LLC Submitted by: Klara Inc. Reviewed by: manu Differential Revision: https://reviews.freebsd.org/D28749
2021-01-12Convert remaining cap_rights_init users to cap_rights_init_oneMateusz Guzik
semantic patch: @@ expression rights, r; @@ - cap_rights_init(&rights, r) + cap_rights_init_one(&rights, r)
2020-04-14Centralize compatability translation macros.Brooks Davis
Copy the CP, PTRIN, etc macros from freebsd32.h into a sys/abi_compat.h and replace existing definitation with includes where required. This eliminates duplicate code and allows Linux and FreeBSD compatability headers to be included in the same files. Input from: cem, jhb Obtained from: CheriBSD MFC after: 2 weeks Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D24275 Notes: svn path=/head/; revision=359937
2020-03-26[PowerPC64] Fix OPAL IPMI driverLeandro Lupori
This change fixes a couple of issues with OPAL IPMI driver and implements a mechanism to detect timeouts and discard old messages left in receive queue, to avoid old messages from being confused with the reply of new ones. Reviewed by: jhibbits Sponsored by: Eldorado Research Institute (eldorado.org.br) Differential Revision: https://reviews.freebsd.org/D24185 Notes: svn path=/head/; revision=359329
2020-02-26Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (17 of many)Pawel Biernacki
r357614 added CTLFLAG_NEEDGIANT to make it easier to find nodes that are still not MPSAFE (or already are but aren’t properly marked). Use it in preparation for a general review of all nodes. This is non-functional change that adds annotations to SYSCTL_NODE and SYSCTL_PROC nodes using one of the soon-to-be-required flags. Mark all obvious cases as MPSAFE. All entries that haven't been marked as MPSAFE before are by default marked as NEEDGIANT Approved by: kib (mentor, blanket) Commented by: kib, gallatin, melifaro Differential Revision: https://reviews.freebsd.org/D23718 Notes: svn path=/head/; revision=358333
2019-06-12The current IPMI KCS code is waiting 100us for all transitions (roughlyJonathan T. Looney
between each byte either sent or received). However, most transitions actually complete in 2-3 microseconds. By polling the status register with a delay of 4us with exponential backoff, the performance of most IPMI operations is significantly improved: - A BMC update on a Supermicro x9 or x11 motherboard goes from ~1 hour to ~6-8 minutes. - An ipmitool sensor list time improves by a factor of 4. Testing showed no significant improvements on a modern server by using a lower delay. The changes should also generally reduce the total amount of CPU or I/O bandwidth used for a given IPMI operation. Submitted by: Loic Prylli <lprylli@netflix.com> Reviewed by: jhb MFC after: 2 weeks Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D20527 Notes: svn path=/head/; revision=348996
2019-05-20Extract eventfilter declarations to sys/_eventfilter.hConrad Meyer
This allows replacing "sys/eventfilter.h" includes with "sys/_eventfilter.h" in other header files (e.g., sys/{bus,conf,cpu}.h) and reduces header pollution substantially. EVENTHANDLER_DECLARE and EVENTHANDLER_LIST_DECLAREs were moved out of .c files into appropriate headers (e.g., sys/proc.h, powernv/opal.h). As a side effect of reduced header pollution, many .c files and headers no longer contain needed definitions. The remainder of the patch addresses adding appropriate includes to fix those files. LOCK_DEBUG and LOCK_FILE_LINE_ARG are moved to sys/_lock.h, as required by sys/mutex.h since r326106 (but silently protected by header pollution prior to this change). No functional change (intended). Of course, any out of tree modules that relied on header pollution for sys/eventhandler.h, sys/lock.h, or sys/mutex.h inclusion need to be fixed. __FreeBSD_version has been bumped. Notes: svn path=/head/; revision=347984
2019-04-02ipmi: Fixes for ipmi_opal(powernv)Justin Hibbits
* Crank the OPAL state machine during the receive loop, to make sure the pollers are executed * Add a proper detach function, so the module can be unloaded and reloaded at runtime. It still doesn't reliably work 100% of the time on POWER9, and it appears timing and/or cache related. It may work on POWER8 now. MFC after: 2 weeks Notes: svn path=/head/; revision=345791
2018-12-15efirt: When present, attempt to use EFI runtime services to shutdownConrad Meyer
PR: maybe related to 233998 (inconclusive at this time) Submitted by: byuu <byuu AT tutanota.com> (previous version) Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D18506 Notes: svn path=/head/; revision=342108