aboutsummaryrefslogtreecommitdiff
path: root/sys/x86/include
Commit message (Collapse)AuthorAgeFilesLines
* apic: add ioapic_get_dev() methodKonstantin Belousov39 hours1-0/+1
| | | | | | | | which returns apic device_t by apic_id, if there exists the pci representer Sponsored by: Advanced Micro Devices (AMD) Sponsored by: The FreeBSD Foundation MFC after: 1 week
* Add a new sysctl in order to diffrentiate UEFI architecturesAhmad Khalifa2024-09-201-0/+1
| | | | | | | | With the new 32-bit UEFI loader, it's convenient to have a sysctl to figure out how we booted. Can be accessed at machdep.efi_arch Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/1098
* Revert "mca: Allow for passing ECC error record to memory controller driver"Stephen J. Kiernan2024-09-181-5/+0
| | | | This reverts commit 996a832d2e01fceb5a3bbfd33df585bd778e6288.
* mca: Allow for passing ECC error record to memory controller driverStephen J. Kiernan2024-09-181-0/+5
| | | | | | | | | | Added (de)registration functions for memory controller driver to be notified when ECC errors occur. This allows for decoding of the specific error by the driver. Submitted by: Lakshman Likith Nudurupati <lnlakshman@juniper.net> Sponsored by: Juniper Networks, Inc. Obtained from: Semihalf
* xen/pvh: fix initialization of environmentRoger Pau Monné2024-08-021-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Xen PVH entry point requires to modify the environment provided by the boot loader, so that the ACPI RSDP is re-written to use the Xen generated RSDP instead of the native one. The current logic in the PVH entry point reserves a single page (4K) in order to copy the contents of the environment passed from the boot loader, so that the bootloader provided "acpi.rsdp" is dropped and a Xen specific one is added afterwards. This however doesn't scale well, as it's possible for the environment to be bigger than 4K. Bumping the buffer, or attempting to peek at the size of the metadata all seem to just add more complexity to a sensitive path. Instead introduce a new ACPI hook that allows setting the RSDP address directly, and use it from the PVH entry point to set the position of the Xen generated RSDP. This allows to reduce the logic in the PVH metadata processing, as there's no need to parse and filter the bootloader provided environment. Note that modifying the environment blob in-place is likely to not work. The RSDP address is provided as a string, it's possible the new RSDP location is higher than the current one, and the string with the new location would overrun the space used by the previous one. Sponsored by: Cloud Software Group PR: 277200 MFC: 3 days Reviewed by: markj kib Differential revision: https://reviews.freebsd.org/D46089
* Deprecate contigfree(9) in favour of free(9)Bjoern A. Zeeb2024-07-261-1/+1
| | | | | | | | | | | | | | | As of 9e6544dd6e02c46b805d11ab925c4f3b18ad7a4b contigfree(9) is no longer needed and should not be used anymore. We leave a wrapper for 3rd party code in at least 15.x but remove (almost) all other cases from the tree. This leaves one use of contigfree(9) untouched; that was the original trigger for 9e6544dd6e02 and is handled in D45813 (to be committed seperately later). Sponsored by: The FreeBSD Foundation Reviewed by: markj, kib Tested by: pho (10h stress test run) Differential Revision: https://reviews.freebsd.org/D46099
* Retire non-NEW_PCIB code and remove config optionJessica Clarke2024-07-181-4/+0
| | | | | | | | | | | All architectures enable NEW_PCIB in DEFAULTS (arm being the most recent to do so in 121be555997b (arm: Set NEW_PCIB in DEFAULTS rather than a subset of kernel configs")), so it's time we removed the legacy code that no longer sees much testing and has a significant maintenance burden. Reviewed by: jhb, andrew, emaste Differential Revision: https://reviews.freebsd.org/D32954
* x86/iommu: extract useful utilities into x86_iommu.cKonstantin Belousov2024-05-251-0/+1
| | | | | | | | related to the page tables page allocation and mapping. Sponsored by: The FreeBSD Foundation Sponsored by: Advanced Micro Devices (AMD) MFC after: 1 week
* AMD CPUs: update bits and data from CPUID 0x8000_0008Konstantin Belousov2024-05-142-0/+18
| | | | | | | | | | from AMD APM vol3 doc no 24594 Rev. 3.36 March 2024 Reviewed and tested by: emaste Sponsored by: Advanced Micro Devices (AMD) Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D45188
* x86: Add Intel TD/HFI related MSR/CPUID defines to specialregs.hKoine Yuusuke2024-05-141-0/+30
| | | | | | | for the coredirector driver. MFC after: 1 week Differential revision: https://reviews.freebsd.org/D44453
* Increase IOAPIC_MAX_ID to 255 (from 254)Ed Maste2024-05-101-1/+6
| | | | | | | | | | A test system provided by AMD panicked with "madt_parse_apics: I/O APIC ID 255 too high". I/O APIC ID 255 is acceptable, so increase the limit. Reviewed by: jhb, kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D45157
* intr/x86: replace use of vector in interface with intsrcElliott Mitchell2024-05-092-7/+7
| | | | | | | | | | | | | Several x86 interrupt core functions were already operating on intsrc structures. Now switch the remaining 3 to intsrc for consistency. Swap the order of intr_add_handler()'s first two arguments. This matches INTRNG and is more consistent with other functions in this interface. Differential Revision: https://reviews.freebsd.org/D35386 Reviewed by: imp, markj (previous version) Pull Request: https://github.com/freebsd/freebsd-src/pull/1126
* guestrpc module to handle VMware backdoor port GuestRPC functionalityStephen J. Kiernan2024-05-012-2/+43
| | | | | | | | | | | | | | | | | | | | | | Convert existing FreeBSD vmware_hvcall function to take a channel and parameter arguments. Added vmware_guestrpc_cmd() to send GuestRPC commands to the VMware hypervisor. The sbuf argument is used for both the command to send and to store the data to return to the caller. The following KPIs can be used to get and set FreeBSD-specific guest information in key/value pairs: * vmware_guestrpc_set_guestinfo - set a value into the guestinfo.fbsd.<keyword> key * vmware_guestrpc_get_guestinfo - get the value stored in the guestinfo.fbsd.<keyword> key Add VMware devices to x86 NOTES Reviewed by: jhb Obtained from: Juniper Networks, Inc. Differential Revision: https://reviews.freebsd.org/D44528
* specialreg: Fix typosElyes Haouas2024-04-111-3/+3
| | | | | | Signed-off-by: Elyes Haouas <ehaouas@noos.fr> Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/885
* new-bus: Remove the 'rid' and 'type' arguments from BUS_RELEASE_RESOURCEJohn Baldwin2024-03-131-2/+2
| | | | | | | | | | The public bus_release_resource() API still accepts both forms, but the internal kobj method no longer passes the arguments. Implementations which need the rid or type now use rman_get_rid() or rman_get_type() to fetch the value from the allocated resource. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D44131
* new-bus: Remove the 'rid' and 'type' arguments from BUS_*ACTIVATE_RESOURCEJohn Baldwin2024-03-131-4/+4
| | | | | | | | | | The public bus_activate/deactivate_resource() API still accepts both forms, but the internal kobj methods no longer pass the arguments. Implementations which need the rid or type now use rman_get_rid() or rman_get_type() to fetch the value from the allocated resource. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D44130
* new-bus: Remove the 'type' argument from BUS_ADJUST_RESOURCEJohn Baldwin2024-03-131-1/+1
| | | | | | | | | | The public bus_adjust_resource() API still accepts both forms, but the internal kobj method no longer passes the argument. Implementations which need the type now use rman_get_type() to fetch the value from the allocated resource. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D44128
* x86/ucode: add support for early loading of CPU ucode on AMD.Chuck Silvers2024-02-221-0/+11
| | | | | | Sponsored by: Netflix Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D43318
* x86/xen: implement early init hookRoger Pau Monné2024-02-221-2/+0
| | | | | | | | | | | | | | | | | | Unify the HVM and PVH early setup, byt making both rely on the hypervisor initialization hook part of identify_hypervisor(). The current initialization takes care of the hypercall page, the sahred info page and does any fixup necessary to metadata video console information if FreeBSD is booted as the initial domain (so the video console is handed from Xen into FreeBSD). Note this has the nice side effect of also allowing to use the Xen console on HVM guests, which allows to get rid of the QEMU emulated uart and still get a nice text console. Sponsored by: Cloud Software Group Reviewed by: markj Differential revision: https://reviews.freebsd.org/D43764
* x86/xen: introduce a Xen early init functionRoger Pau Monné2024-02-221-0/+3
| | | | | | | | | | | | Start by moving the hyeprcall setup to such function. The aim is to have a function that does all the required Xen early initialization for both HVM and PVH, instead of having it scattered across different paths. Sponsored by: Cloud Software Group Reviewed by: markj Differential revision: https://reviews.freebsd.org/D43932
* x86/ucode: add const where appropriateChuck Silvers2024-02-131-1/+1
| | | | | | Sponsored by: Netflix Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D43865
* x86: Use pci_domain_[de]activate_bus for PCI_RES_BUS resourcesJohn Baldwin2024-01-231-0/+4
| | | | | Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D43430
* x86: Make cpu_model[] publicMark Johnston2024-01-041-0/+1
| | | | | | | | No functional change intended. Reviewed by: emaste, imp, kib MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D43281
* xen: add atomic #defines to accomodate differing xen_ulong_t sizesElliott Mitchell2023-12-151-0/+10
| | | | | | | | Alas, ARM declared xen_ulong_t to be 64-bits long, unlike i386 where it matches the word size. As a result, compatibility wrappers are needed for Xen atomic operations. Reviewed by: royger
* busdma: tidy bus_dma_run_filter() functionsMitchell Horne2023-12-061-1/+0
| | | | | | | | | | | | | | | | After removing filter functionality, the naming doesn't clearly represent what the function does, so try to address this. Include some code clarity and style improvements. Create a common version in subr_busdma_bounce.c, used by most implementations. powerpc still needs its own version of the function, due to its dmat->iommu == NULL check. No functional change intended. Reviewed by: jhb Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D42896
* busdma: remove parent tag trackingMitchell Horne2023-12-061-2/+0
| | | | | | | | | | Without filter functions, we do not need to keep track of tag ancestry. All inheritance of the parent tag's parameters occurs when creating the new child tag. Reviewed by: jhb Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D42895
* busdma: kill filter functionality internallyMitchell Horne2023-12-061-7/+3
| | | | | | | | | | | | | | Address filter functions are unused, unsupported, and now rejected. Simplify some busdma code by removing filter functionality completely. Note that the chains of parent tags become useless, and will be cleaned up in the next commit. No functional change intended. Reviewed by: jhb Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D42894
* x86: Support multiple PCI MCFG regionsJohn Baldwin2023-11-291-1/+1
| | | | | | | | | | | In particular, this enables support for PCI config access for domains (segments) other than 0. Reported by: cperciva Tested by: cperciva (m7i.metal-48xl AWS instance) Reviewed by: imp Relnotes: yes Differential Revision: https://reviews.freebsd.org/D42828
* pci_cfgreg: Add a PCI domain argument to the low-level register APIJohn Baldwin2023-11-291-2/+2
| | | | | | | | | | | | | | | | | | | | | | | 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
* xen/x86: move x86-only variable out of commonElliott Mitchell2023-11-281-0/+3
| | | | | | | | | Commit 27c36a12f15 is an x86-only feature. As such xen_evtchn_needs_ack should only exist on x86. Differential Revision: https://reviews.freebsd.org/D29913 Reviewed by: royger [royger]: adjust comment.
* sys: Remove ancient SCCS tags.Warner Losh2023-11-2715-31/+0
| | | | | | | | Remove ancient SCCS tags from the tree, automated scripting, with two minor fixup to keep things compiling. All the common forms in the tree were removed with a perl script. Sponsored by: Netflix
* x86: Rename {stop,start}_emulating to fpu_{enable,disable}John Baldwin2023-10-111-0/+9
| | | | | | | While here, centralize the macros in <x86/fpu.h>. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D42135
* x86: AMD Zen2: Zenbleed chicken bit mitigationOlivier Certner2023-10-022-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Applies only to bare-metal Zen2 processors. The system currently automatically applies it to all of them. Tunable/sysctl 'machdep.mitigations.zenbleed.enable' can be used to forcibly enable or disable the mitigation at boot or run-time. Possible values are: 0: Mitigation disabled 1: Mitigation enabled 2: Run the automatic determination. Currently, value 2 is the default and has identical effect as value 1. This might change in the future if we choose to take into account microcode revisions in the automatic determination process. The tunable/sysctl value is simply ignored on non-applicable CPU models, which is useful to apply the same configuration on a set of machines that do not all have Zen2 processors. Trying to set it to any integer value not listed above is silently equivalent to setting it to value 2 (automatic determination). The current mitigation state can be queried through sysctl 'machdep.mitigations.zenbleed.state', which returns "Not applicable", "Mitigation enabled" or "Mitigation disabled". Note that this state is not guaranteed to be accurate in case of intervening modifications of the corresponding chicken bit directly via cpuctl(4) (this includes the cpucontrol(8) utility). Resetting the desired policy through 'machdep.mitigations.zenbleed.enable' (possibly to its current value) will reset the hardware state and ensure that the reported state is again coherent with it. Reviewed by: kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D41817
* x86: Add defines for workaround bits in AMD's MSR "Decode Configuration"Olivier Certner2023-09-141-2/+7
| | | | | | | | | | | They are a bit more informative than raw hexadecimal values. While here, sort existing defines of bits for AMD MSRs to match the address order. Reviewed by: kib, emaste Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D41816
* sys: Remove $FreeBSD$: one-line .c comment patternWarner Losh2023-08-161-1/+0
| | | | Remove /^/[*/]\s*\$FreeBSD\$.*\n/
* sys: Remove $FreeBSD$: one-line .h patternWarner Losh2023-08-1616-16/+0
| | | | Remove /^\s*\*+\s*\$FreeBSD\$.*$\n/
* sys: Remove $FreeBSD$: two-line .h patternWarner Losh2023-08-1639-78/+0
| | | | Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
* tc_fill_vdso_timehands32(): fixKonstantin Belousov2023-08-121-1/+6
| | | | | | | | | | | | | On 64bit, there is a 4-byte hole in struct vdso_timekeep32 after tk_current, if the structure is not packed. This is due to the MD th_x86_pvc_last_systime being 64bit. Change amd64 VDSO_TIMEHANDS_MD32 to not use uint64_t, replace it with pair of uint32_t, as it is done for all other members. PR: 273085 Sponsored by: The FreeBSD Foundation MFC after: 1 week
* x86: remove intr_bindElliott Mitchell2023-08-031-3/+0
| | | | | | | | | | | `intr_bind(u_int vector, u_char cpu);` looked suspicious since everywhere else "cpu" is a u_int and >256 processors isn't unreasonable now. `intr_bind()` is not used anywhere in FreeBSD (now, after commit bf42f3738087). Time to remove. Relnotes: Yes Reviewed by: mjg Differential Revision: https://reviews.freebsd.org/D36901
* x86: Add defines for a couple of thermal and PM bitsMark Johnston2023-06-191-0/+2
| | | | | MFC after: 1 week Sponsored by: The FreeBSD Foundation
* smp: Dynamically allocate the stoppcbs arrayMark Johnston2023-05-251-1/+0
| | | | | | | | | | | | | | This avoids bloating the kernel image when MAXCPU is large. A follow-up patch for kgdb and other kernel debuggers is needed since the stoppcbs symbol is now a pointer. Bump __FreeBSD_version so that debuggers can use osreldate to figure out how to handle stoppcbs. PR: 269572 MFC after: never Reviewed by: mjg, emaste Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D39806
* spdx: The BSD-2-Clause-NetBSD identifier is obsolete, drop -NetBSDWarner Losh2023-05-122-2/+2
| | | | | | | | | The SPDX folks have obsoleted the BSD-2-Clause-NetBSD 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
* spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDWarner Losh2023-05-1220-20/+20
| | | | | | | | | 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
* Use bool for one-bit wide bit-fieldsDimitry Andric2023-04-251-4/+4
| | | | | | | | | | | | A signed one-bit wide bit-field can take only the values 0 and -1. Clang 16 introduced a warning that "implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1". Fix the warnings by using C99 bool. Reported by: Clang 16 Reviewed by: emaste, jhb MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D39705
* x86: Move i386 timerreg.h to x86Dmitry Chagin2023-04-201-0/+56
| | | | | | Reviewed by: emaste, jhb Differential Revision: https://reviews.freebsd.org/D39656 MFC after: 1 month
* x86: Move i386 ppireg.h to x86Dmitry Chagin2023-04-201-0/+51
| | | | | Differential Revision: https://reviews.freebsd.org/D39655 MFC after: 1 month
* xen/intr: move interrupt allocation/release to architectureElliott Mitchell2023-04-141-2/+11
| | | | | | | | | | | | | | | | Simply moving the interrupt allocation and release functions into files which belong to the architecture. Since x86 interrupt handling is quite distinct from other architectures, this is a crucial necessary step. Identifying the border between x86 and architecture-independent is actually quite tricky. Similarly, getting the prototypes for the border right is also quite tricky. Inspired by the work of Julien Grall <julien@xen.org>, 2015-10-20 09:14:56, but heavily adjusted. Reviewed by: royger Differential Revision: https://reviews.freebsd.org/D30936
* xen/intr: move x86 PIC interface to xen_arch_intr.c, introduce wrappersJulien Grall2023-04-141-0/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The x86 PIC interface is very much x86-specific and not used by other architectures. Since most of xen_intr.c can be shared with other architectures, the PIC interface needs to be broken off. Introduce wrappers for calls into the architecture-dependent interrupt layer. All architectures need roughly the same functionality, but the interface is slightly different between architectures. Due to the wrappers being so thin, all of them are implemented as inline in arch-intr.h. The original implementation was done by Julien Grall in 2015, but this has required major updating. Removal of PVHv1 meant substantial portions disappeared. The original implementation took care of moving interrupt allocation to xen_arch_intr.c, but this has required massive rework and was broken off. In the original implementation the wrappers were normal functions. Some had empty stubs in xen_intr.c and were removed. Reviewed by: royger Submitted by: Elliott Mitchell <ehem+freebsd@m5p.com> Original implementation: Julien Grall <julien@xen.org>, 2015-10-20 09:14:56 Differential Revision: https://reviews.freebsd.org/D30909
* xen/intr: introduce dev/xen/bus/intr-internal.hJulien Grall2023-04-141-0/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Move the xenisrc structure which needs to be shared between the core Xen interrupt code and architecture-dependent code into a separate header. A similar situation exists for the NR_EVENT_CHANNELS constant. Turn xi_intsrc into a type definition named xi_arch to reflect the new purpose of being an architectural variable for the interrupt source. This was originally implemented by Julien Grall, but has been heavily modified. The core side was renamed "intr-internal.h" and is #include'd by "arch-intr.h" instead of the other way around. This allows the architecture to add function definitions which use struct xenisrc. The original version only moved xi_intsrc into xen_arch_isrc_t. Moving xi_vector was done by the submitter. The submitter had also moved xi_activehi and xi_edgetrigger into xen_arch_isrc_t. Those disappeared with the removal of PVHv1 support. Copyright note. The current xenisrc structure was introduced at 76acc41fb7c7 by Justin T. Gibbs. Traces remain, but the strength of Copyright claims from before 2013 seem pretty weak. Reviewed by: royger Submitted by: Elliott Mitchell <ehem+freebsd@m5p.com>, 2021-03-17 19:09:01 Original implementation: Julien Grall <julien@xen.org>, 2015-10-20 09:14:56 Differential Revision: https://reviews.freebsd.org/D30648 [royger] - Adjust some line lengths - Fix comment about NR_EVENT_CHANNELS after movement. - Use #include instead of symlinks.
* xen: introduce XEN_CPUID_TO_VCPUID()/XEN_VCPUID()Julien Grall2023-04-141-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | Part of the series for allowing FreeBSD/ARM to run on Xen. On ARM the function is a trivial pass-through, other architectures need distinct implementations. While implementing XEN_VCPUID() as a call to XEN_CPUID_TO_VCPUID() works, that involves multiple accesses to the PCPU region. As such make this a distinct macro. Only callers in machine independent code have been switched. Add a wrapper for the x86 PIC interface to use matching the old prototype. Partially inspired by the work of Julien Grall <julien@xen.org>, 2015-08-01 09:45:06, but XEN_VCPUID() was redone by Elliott Mitchell on 2022-06-13 12:51:57. Reviewed by: royger Submitted by: Elliott Mitchell <ehem+freebsd@m5p.com> Original implementation: Julien Grall <julien@xen.org>, 2014-04-19 08:57:40 Original implementation: Julien Grall <julien@xen.org>, 2014-04-19 14:32:01 Differential Revision: https://reviews.freebsd.org/D29404