aboutsummaryrefslogtreecommitdiff
path: root/sys/amd64
Commit message (Collapse)AuthorAgeFilesLines
...
* mpi3mr: Broadcom's MPT-Fusion version 4 is amd64 and aarch64 onlyWarner Losh2025-04-281-0/+3
| | | | | | | | | | | | | Broadcom's MPT-Fusion version 4 driver only works on 64-bit systems, and has only been tested in amd64 and aarch64, so move it's building to just those. I didn't notice this in the review and neglected to test those cases (since I knew it didn't work there, so was a blind spot). Pointy-hat: imp Fixes: 9cdd40759617 Sponsored-by: Netflix Sponsored by: Netflix
* mpi3mr: Allow driver to be in-kenrel and add to GENERICChandrakanth patil2025-04-281-0/+1
| | | | | | | | | | | | | | | | | | | | | Registered the mpi3mr driver source files in sys/conf/files, enabling it to be compiled into the base kernel image. This matches the approach used for existing Broadcom drivers such as mrsas, mps, and mpr. Add mpi3mr to sys/conf/NOTES. With this change, the mpi3mr driver will be built as part of the base kernel, allowing automatic loading during boot when supported hardware is detected. Below changes are suggested by chs@: - Corrected the file name typo mistake in /sys/conf/files from mpi3mr_app.c.c to mpi3mr_app.c - Added mpi3mr driver entries in "sys/amd64/conf/GENERIC" and "sys/i386/conf/GENERIC" Reviewed by: ssaxena, chs, imp Differential Revision: https://reviews.freebsd.org/D49754
* amd64: make LA57 mode for a process opt-in by defaultKonstantin Belousov2025-04-273-1/+13
| | | | | | | | | The vm.pmap.prefer_la48 manages the mode. Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D49913
* amd64: drop mistakenly added fileDoug Moore2025-04-211-13/+0
| | | | | | File PHO was added by mistake. Removed. Fixes: aa60a08f2a57 ("amd64: replace tailq pointers with iterators")
* amd64: replace tailq pointers with iteratorsDoug Moore2025-04-213-12/+31
| | | | | | | | Change architecture-specific code to use iterators rather than tailq pointers. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D49923
* sgx: replace tailq pointers with iteratorsDoug Moore2025-04-191-10/+17
| | | | | | | | In sgx code, use iterators to replace tailq pointers for page manipulation. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D49919
* amd64: print limited EFIRT fault messages on first fault, not secondKonstantin Belousov2025-04-091-2/+2
| | | | | | Noted by: olce Sponsored by: The FreeBSD Foundation MFC after: 1 week
* vm_assign_pptdev: only call vm_iommu_map() onceKonstantin Belousov2025-04-091-3/+4
| | | | | | | for the first assigned pass-through device. PR: 285976 Sponsored by: The FreeBSD Foundation
* bhyve amd64: allow iommu to fail attaching device to host domainKonstantin Belousov2025-04-091-1/+5
| | | | | | | | | If iommu does not want to handle some device, e.g. because the ACPI table does not list it as translated, this is not a reason to fail creating the host domain. PR: 285976 Sponsored by: The FreeBSD Foundation
* amd64: also limit printings of EFIRT page faultsKonstantin Belousov2025-04-091-2/+7
| | | | | | | Fixes: fd748c7d5b7aefbeda604403f203637b12ae89df Sponsored by: The FreeBSD Foundation PR: 285797 MFC after: 1 week
* bhyve IOMMU_REMOVE_DEVICE(): ignore iommu absence for sake of ppt_attach()Konstantin Belousov2025-04-061-1/+1
| | | | | | | Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D49629
* bhyve: make most of the iommu_ops interfaces return errorKonstantin Belousov2025-04-066-108/+159
| | | | | | | | | and change create_mapping()/remove_mapping() to allow shorten results. Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D49629
* efirt: add a tunable to disable printing faults during EFIRT callsKonstantin Belousov2025-04-021-2/+11
| | | | | | | | | PR: 285797 Reported and tested by: Bakul Shah <bakul@iitbombay.org> Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D49592
* bhyve: style, add comma to the last line of designated initializerKonstantin Belousov2025-04-011-1/+1
| | | | | Sponsored by: The FreeBSD Foundation MFC after: 3 days
* sgx: Add a simple cdev_pg_path methodJohn Baldwin2025-03-271-0/+7
| | | | | | | This uses the constant string of "sgx" as the pathname Reviewed by: br, kib Differential Revision: https://reviews.freebsd.org/D49336
* sys: add wlan_gcmp to GENERIC kernels as appropriateAdrian Chadd2025-03-271-0/+1
| | | | | | | Add wlan_gcmp wherever CCMP is defined in kernel configs. Differential Revision: https://reviews.freebsd.org/D49343 Reviewed by: bz, cy
* bhyve: fix CPUID L3 Cache Size reporting for AMD/SVMKonstantin Belousov2025-03-051-3/+8
| | | | | | | | | | | | | | | | | | | | | | Adjust leaf 0x8000_001D %ecx 3 on AMD (L3 cache params). - Report cache as 1-way associative. Glibc does not believe that there are fully associative L3 caches, ignoring the leaf and falling back to legacy way of reading cache params. - Do not report 4095 logical CPUs per L3 cache, report the true total number of emulated CPUs. The insanely large value tricked some version of glibc to overflow 32bit calculation of the L3 cache size, as reported in the PR. Also, for leaf 0x8000_0008, do not clip ApicIdSize to zero if less than 4. This effectively falls back to legacy. PR: 279901 With the help from: Florian Weimer <fweimer@redhat.com> Reviewed by: kevans, meta, mp Tested by: meta, mp Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D48187
* vmm: Emulate testb imm8,r/m8Jose Luis Duran2025-03-041-0/+12
| | | | | | | | | | | | Add support for "testb imm8,r/m8" emulation. PR: 261940 PR: 282852 Reviewed by: markj, emaste Approved by: emaste (mentor) Obtained from: Illumos (https://www.illumos.org/issues/14483) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D49208
* vmm: Consolidate code which manages guest memory regionsMark Johnston2025-02-186-427/+33
| | | | | | | | | | | | | | | | | | | | | | | On all three platforms supported by vmm, we have mostly duplicated code to manage guest physical memory regions. Deduplicate much of this code and move it into sys/dev/vmm/vmm_mem.c. To avoid exporting struct vm outside of machdep vmm.c, add a new struct vm_mem to contain the memory segment descriptors, and add a vm_mem() accessor, akin to vm_vmspace(). This way vmm_mem.c can implement its routines without needing to see the layout of struct vm. The handling of the per-VM vmspace is also duplicated but will be moved to vmm_mem.c in a follow-up patch. On amd64, move the ppt_is_mmio() check out of vm_mem_allocated() to keep the code MI, as PPT is only implemented on amd64. There are only a couple of callers, so this is not unreasonable. No functional change intended. Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D48270
* sys: Add cpu_update_pcb hookJohn Baldwin2025-01-312-4/+7
| | | | | | | | | | | | | This MD function is invoked before dumping register set notes when writing out a core dump to ensure that the PCB for a given thread is up to date. This provides a centralized place to update the PCB with values of the current thread for each arch rather than doing this work in each register set's get method. Discussed with: jrtc27 Reviewed by: kib, markj Sponsored by: AFRL, DARPA Differential Revision: https://reviews.freebsd.org/D44910
* sys: make the kernel metadata pointer globalAhmad Khalifa2025-01-241-41/+24
| | | | | | | | | | | | | | | | | The way we got the kernel metadata pointer was by calling preload_search_by_type with one of the following three: "elf kernel", "elf32 kernel" and "elf64 kernel". Which one(s) we used wasn't consistent though. Sometimes we would only try "elf kernel", and other times we would try one of the latter two if the first failed. However, the loader only ever sets "elf kernel" as the kernel type. Now, the kmdp is a global, preload_kmdp, and it's initialized using preload_initkmdp in machdep.c (or machdep_boot.c on arm/64). preload_initkmdp takes a single boolean argument that tells us whether not finding the kmdp is fatal or not. Reviewed by: imp, kib Pull Request: https://github.com/freebsd/freebsd-src/pull/1394
* machine/param.h: drop __HAVE_ACPI defineMitchell Horne2025-01-231-2/+0
| | | | | | | | It is no longer used anywhere (since 62508c531e0f), and not defined for arm64 which also supports ACPI. Reviewed by: imp, jhb Differential Revision: https://reviews.freebsd.org/D48486
* pci: cleanup __PCI_REROUTE_INTERRUPTSMitchell Horne2025-01-231-1/+0
| | | | | | | | This flag was used as a transition for differing pcib implementations. Today it is defined for all supported architectures, and can be removed. Reviewed by: imp, jhb Differential Revision: https://reviews.freebsd.org/D48485
* amd64/fpu: Fix build for NODEBUG kernelsBojan Novković2025-01-221-0/+4
| | | | | Fixes: b995101 Reported by: Michael Butler (imb@protected-networks.net)
* amd64/fpu: Track supervisor state XSAVE componentsBojan Novković2025-01-221-14/+24
| | | | | | | | | | | | The amd64/fpu.c xsave_* routines track supported XSAVE components and features. However, they only track supported user state components, and there is currently no way for a consumer to check whether the CPU supports a supervisor state component. Fix this by saving the supported supervisor state components, enumerated by CPUID function 0DH, sub-function 1, in a separate mask. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D48466
* Centralize and simpify implemention of some VM macrosBrooks Davis2025-01-142-8/+1
| | | | | | | | | | | | | These macros have substantially identical implementations on each platform. Use roundup2/rounddown2 for round_page/trunc_page. This version standardizes on not using explicit casts and instead preserving the original type. A couple of tweaks were required to make this work. Reviewed by: brooks, kib, markj Obtained from: CheriBSD Differential Revision: https://reviews.freebsd.org/D48450
* vmm: Fix error handling in vmm_handler()Mark Johnston2025-01-091-0/+2
| | | | | | | | | | | | | In commit a97f683fe3c4 I didn't add code to remove the vmmctl device when vmm.ko is unloaded, so it would persist and prevent vmm.ko from being re-loaded. Extend vmmdev_cleanup() to destroy the vmmctl cdev. Also call vmmdev_cleanup() if vmm_init() fails. Reviewed by: corvink, andrew Fixes: a97f683fe3c4 ("vmm: Add a device file interface for creating and destroying VMs") Differential Revision: https://reviews.freebsd.org/D48269
* amd64/vmm: Rename vm_get_vmspace() to vm_vmspace()Mark Johnston2025-01-073-4/+3
| | | | | | | | | For consistency with other vm accessors. No functional change intended. Reviewed by: corvink Differential Revision: https://reviews.freebsd.org/D48268
* amd64/vmm: Remove vmm_mem_init()Mark Johnston2025-01-073-14/+0
| | | | | | | | | | It is a no-op and doesn't exist on other platforms. As part of some work to deduplicate vmm code, just remove it. No functional change intended. Reviewed by: corvink Differential Revision: https://reviews.freebsd.org/D48267
* cpu_set_upcall / linux_clone_thread: Remove calls to cpu_thread_cleanJohn Baldwin2025-01-031-10/+0
| | | | | | | | | This is intended to clean state of a thread at the end of its lifecycle during wait(), not the beginning of its life cycle. Reviewed by: kib Sponsored by: AFRL, DARPA Differential Revision: https://reviews.freebsd.org/D48023
* amd64: on any fault during call to EFI RT, restore execution and print fault ↵Konstantin Belousov2024-12-251-12/+18
| | | | | | | | | | | | | | details The fault info should be useful to see what specifically BIOS tried to do and why it faulted. E.g. it might allow to see which EFI memory segment needs to be mapped in addition to normal runtime segments, to work around the fault. Reviewed by: kevans, markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D48186
* amd64: extract code to print fault details from trap_fatal() into a new helperKonstantin Belousov2024-12-251-7/+22
| | | | | | | | Suggested by: markj Reviewed by: kevans, markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D48186
* x86 atomics: Remove unused WANT_FUNCTIONSOlivier Certner2024-12-171-3/+0
| | | | | | | | | | This macro has not been in use since commit "inline atomics and allow tied modules to inline locks" (r335873, f4b3640475cec929). Reviewed by: markj, kib, emaste, imp MFC after: 5 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D48061
* atomics: Constify loadsOlivier Certner2024-12-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | In order to match reality, allow using these functions with pointers on const objects, and bring us closer to C11. Remove the '+' modifier in the atomic_load_acq_64_i586()'s inline asm statement's constraint for '*p' (the value to load). CMPXCHG8B always writes back some value, even when the value exchange does not happen in which case what was read is written back. atomic_load_acq_64_i586() further takes care of the operation atomically writing back the same value that was read in any case. All in all, this makes the inline asm's write back undetectable by any other code, whether executing on other CPUs or code on the same CPU before and after the call to atomic_load_acq_64_i586(), except for the fact that CMPXCHG8B will trigger a #GP(0) if the memory address is part of a read-only mapping. This unfortunate property is however out of scope of the C abstract machine, and in particular independent of whether the 'uint64_t' pointed to is declared 'const' or not. Approved by: markj (mentor) MFC after: 5 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D46887
* x86: Add routines for querying XSAVE feature informationBojan Novković2024-12-151-1/+110
| | | | | | | | | | | | This patch adds several routines that track and expose information about various XSAVE-related features. More specifically, it adds the ability to check whether a given XFEATURE is supported and which XSAVE extensions are supported. Furthermore, it adds several routines for calculating the size and offsets within a save area given a XSAVE feature bitmap. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D47394
* amd64: Add wrappers for XRSTORS and XSAVESBojan Novković2024-12-151-0/+23
| | | | | Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D46984
* x86: Refactor kernel-mode NMI handlingBojan Novković2024-12-151-28/+4
| | | | | | | | | | This refactor aims to add the ability to share performance counter interrupts by refactoring the kernel-mode NMI handler. The handler now allows multiple drivers to service the same interrupt (e.g. hwpmc(4) and hwt(4)'s Intel Processor Trace backend). Reviewed by: kib, avg Differential Revision: https://reviews.freebsd.org/D46421
* vmcb.h: fix typo in the comment, try twoKonstantin Belousov2024-12-101-1/+1
| | | | | | Noted by: rm Sponsored by: The FreeBSD Foundation MFC after: 3 days
* vmcb.h: fix typo in the commentKonstantin Belousov2024-12-101-1/+1
| | | | | Sponsored by: The FreeBSD Foundation MFC after: 3 days
* amd64: re-enable la57, try twoKonstantin Belousov2024-12-091-0/+1
| | | | | | | | | | If you need to use libc with jemalloc without commit eade2001aa9d91440886de8359a4dec9edcde2a9 (head, or b90d68c9b28b0a458bdf4a963397817974ed0f90 stable/14), you have to set vm.pmap.la57 to 0 for system-global effect, or use proccontrol -m la48 on affected image. Sponsored by: The FreeBSD Foundation
* Replace calls to bus_generic_attach with bus_attach_childrenJohn Baldwin2024-12-061-1/+2
| | | | | Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D47675
* Replace calls to bus_generic_probe with bus_identify_childrenJohn Baldwin2024-12-061-1/+1
| | | | | Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D47674
* amd64/vmm: Add svm_modsuspend to the vmm_ops_amd tableMark Johnston2024-12-031-2/+1
| | | | | Fixes: 0b32ef71f9f1 ("vmm: Correctly suspend and resume the vmm driver.") Sponsored by: Klara, Inc.
* vmm: Correctly suspend and resume the vmm driver.Joshua Rogers2024-11-297-2/+28
| | | | | | | | | | | | | | | Previously, VMXON would be executed on a resume, contrary to proper initalization. The contents of MSR_IA32_FEATURE_CONTROL may be lost on suspension, therefore must be restored. Likewise, the VMX Enable bit may be cleared upon suspend, requiring it to be re-set. Concretely disable VMX on suspend, and re-enable it on resume. Note: any IOMMU context will remain lost for any enabled vmm devices. Signed-off-by: Joshua Rogers <Joshua@Joshua.Hu> Reviewed by: jhb,imp Pull Request: https://github.com/freebsd/freebsd-src/pull/1419
* amd64: add machine/pte.hKonstantin Belousov2024-11-262-57/+105
| | | | | | | | | | | Following arm64 and risc-v, move definitions that describe hardware-enforced layout of PTEs and #PF error bits, into a dedicated header. Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D47749
* amd64: switch pmap_map_io_transient() to use pmap_kenter_attr()Konstantin Belousov2024-11-251-7/+3
| | | | | | | | | | | instead of constructing transient pte itself. This pre-set PG_A and PG_M bits, avoiding atomic pte update on access and modification. Also it set the nx bit, the mapping is not supposed to be used for executing. Reviewed by: alc Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D47717
* amd64 pmap: assert and explain why pmap_qremove() is safe WRT supermappingsKonstantin Belousov2024-11-251-0/+12
| | | | | | | | | Based on alc@ comments from https://reviews.freebsd.org/D47678. Reviewed by: alc Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D47717
* amd64 efi rt: handle #BPKonstantin Belousov2024-11-211-0/+12
| | | | | | | | PR: 282860 Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D47694
* atomic(9): Implement atomic_testand(clear|set)_ptrJohn Baldwin2024-11-191-0/+2
| | | | | | | | | | For current architectures, these are just aliases for the existing operation on the relevant scalar integer. Reviewed by: imp, kib Obtained from: CheriBSD Sponsored by: AFRL, DARPA Differential Revision: https://reviews.freebsd.org/D47631
* vmm: Postpone vmm module initialization to after SI_SUB_DEVFSMark Johnston2024-11-071-1/+2
| | | | | | | | | | | | | vmmops_modinit() needs to create a device file, and this must happen after SI_SUB_DEVFS. On non-EARLY_AP_STARTUP platforms (i.e., !x86) this happens already by accident, but we shouldn't rely on it. On riscv, remove the current SI_SUB_SMP ordering since that was copied from arm64 and isn't needed. In particular, riscv's vmmops_modinit() does not call smp_rendezvous(). Reported by: Oleksandr Kryvulia <shuriku@shurik.kiev.ua> Fixes: a97f683fe3c4 ("vmm: Add a device file interface for creating and destroying VMs")