aboutsummaryrefslogtreecommitdiff
path: root/sys/powerpc/pseries
Commit message (Collapse)AuthorAgeFilesLines
* 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
* newbus: globally replace device_add_child(..., -1) with DEVICE_UNIT_ANYWarner Losh2024-07-251-1/+1
| | | | Sponsored by: Netflix
* sys: Automated cleanup of cdefs and other formattingWarner Losh2023-11-278-8/+0
| | | | | | | | | | | | | | | | 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
* powerpc: better handling of shutdown flagsMitchell Horne2023-11-231-2/+2
| | | | | | | | | RB_HALT does not mean poweroff, RB_POWEROFF does. Reviewed by: jhibbits MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D42339
* sys: Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-1612-23/+0
| | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
* sys: Remove $FreeBSD$: two-line .h patternWarner Losh2023-08-163-6/+0
| | | | Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
* spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDWarner Losh2023-05-1214-14/+14
| | | | | | | | | 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
* phyp_llan: Mechanically convert to IfAPIJustin Hibbits2023-03-111-23/+21
| | | | Sponsored by: Juniper Networks, Inc.
* powerpc: fix warning: a function declaration without a prototype is ↵Piotr Kubaj2023-02-261-1/+1
| | | | | | | | | | | deprecated in all versions of C Reviewers: #powerpc Approved by: alfredo Subscribers: imp, jhibbits Differential Revision: https://reviews.freebsd.org/D38787
* powerpc pseries: Remove unused devclass arguments to DRIVER_MODULE.John Baldwin2022-05-107-21/+12
|
* Remove unused uart_devclass.John Baldwin2022-05-061-1/+1
|
* powerpc pseries xics: Use devclass_find to lookup xicp devclass.John Baldwin2022-04-271-1/+3
| | | | | Reviewed by: jhibbits Differential Revision: https://reviews.freebsd.org/D35083
* powerpc: Use __diagused for variables only used in KASSERT().John Baldwin2022-04-131-3/+3
|
* llan: Remove unused variables.John Baldwin2022-04-121-11/+9
| | | | | | In theory the errors during llan_attach should be handled, but other errors in llan_attach (e.g. bus_setup_intr) are already ignored, so just remove the unused variable to preserve the status quo.
* powerpc/pseries: Allow radix pmap in pseries for ISA 3.0Justin Hibbits2021-08-122-1/+12
| | | | | | | | | | ISA 3.0 allows for nested radix translations with minimal to no involvement of the hypervisor. This should make pseries signficantly faster on POWER9 pseries instances, as fewer hypercalls are needed to manage pmap now. MFC after: 2 weeks Relnotes: yes
* newbus: Move from bus_child_{pnpinfo,location}_src to ↵Warner Losh2021-06-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | bus_child_{pnpinfo,location} with sbuf Now that the upper layers all go through a layer to tie into these information functions that translates an sbuf into char * and len. The current interface suffers issues of what to do in cases of truncation, etc. Instead, migrate all these functions to using struct sbuf and these issues go away. The caller is also in charge of any memory allocation and/or expansion that's needed during this process. Create a bus_generic_child_{pnpinfo,location} and make it default. It just returns success. This is for those busses that have no information for these items. Migrate the now-empty routines to using this as appropriate. Document these new interfaces with man pages, and oversight from before. Reviewed by: jhb, bcr Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D29937
* powerpc: fix boot on pseries without hugepagesLeandro Lupori2021-06-021-41/+42
| | | | | | | | | | Commit 49c894ddced5 introduced an issue that prevented pseries boot, when hugepages were not available to the guest. Now large page info must be available before moea64_install is called, so this change moves the code that scans large page sizes before the call. Reviewed by: jhibbits (IRC) Sponsored by: Instituto de Pesquisas Eldorado (eldorado.org.br)
* Rename ofwpci.c to ofw_pcib.cMarcin Wojtas2021-05-201-2/+2
| | | | | | | | | | | | | | It's a class0 driver that implements some pcib methods and creates a pci bus as its children. The "ofw_pci" name will be used by a new driver that will be a subclass of the pci bus. No functional changes intended. Submitted by: Kornel Duleba <mindal@semihalf.com> Reviewed by: andrew Obtained from: Semihalf Sponsored by: Alstom Group Differential Revision: https://reviews.freebsd.org/D30226
* powerpc64: Split out DMAP and non-DMAP implementations of some methodsJustin Hibbits2021-05-061-0/+2
| | | | | | | | | | Summary: Some methods are split between DMAP and non-DMAP, conditional on hw_direct_map variable. Rather than checking this variable every time, use it to install different functions via IFUNCs. Reviewed By: luporl Differential Revision: https://reviews.freebsd.org/D30071
* powerpc/pseries: Add new hypercall definition, H_REGISTER_PROC_TBLJustin Hibbits2021-03-311-1/+3
| | | | | | This will be used by the Radix MMU on pseries. MFC after: 1 week
* [PowerPC64LE] pseries: Fix input buffering logic.Brandon Bergren2021-02-251-5/+4
| | | | | | | | | | | | | | | | | | | | | | In uart_phyp_get(), when the internal buffer is empty, we make a hypercall to retrieve up to 16 bytes of input data from the hypervisor. As this is specified to be returned in BE format, we need to do a 64-bit byte swap on the first and second half of the data. If the buffer being passed in was insufficient to return the fetched data, we store the remainder in the internal buffer and use it to satisfy the following calls to uart_phyp_get() until it is drained. However, in this case, we were accidentally byteswapping the internal buffer again. Move the byteswapping code to just after the hypercall so it only gets swapped when we're filling the buffer. Fixes arrow keys in qemu on pseries, among other console oddities. Sponsored by: Tag1 Consulting, Inc. MFC after: 3 days
* Add CFI start/end proc directives to arm64, i386, and ppcConrad Meyer2020-12-051-1/+2
| | | | | | | | | | | | | | Follow-up to r353959 and r368070: do the same for other architectures. arm32 already seems to use its own .fnstart/.fnend directives, which appear to be ARM-specific variants of the same thing. Likewise, MIPS uses .frame directives. Reviewed by: arichardson Differential Revision: https://reviews.freebsd.org/D27387 Notes: svn path=/head/; revision=368354
* Implement superpages for PowerPC64 (HPT)Leandro Lupori2020-11-061-35/+160
| | | | | | | | | | | | | | | | | | | | | | | | | | This change adds support for transparent superpages for PowerPC64 systems using Hashed Page Tables (HPT). All pmap operations are supported. The changes were inspired by RISC-V implementation of superpages, by @markj (r344106), but heavily adapted to fit PPC64 HPT architecture and existing MMU OEA64 code. While these changes are not better tested, superpages support is disabled by default. To enable it, use vm.pmap.superpages_enabled=1. In this initial implementation, when superpages are disabled, system performance stays at the same level as without these changes. When superpages are enabled, buildworld time increases a bit (~2%). However, for workloads that put a heavy pressure on the TLB the performance boost is much bigger (see HPC Challenge and pgbench on D25237). Reviewed by: jhibbits Sponsored by: Eldorado Research Institute (eldorado.org.br) Differential Revision: https://reviews.freebsd.org/D25237 Notes: svn path=/head/; revision=367417
* [PowerPC64LE] Fix endianness issues in phyp_vscsi.Brandon Bergren2020-09-231-31/+40
| | | | | | | | | | | | | Unlike virtio, which in legacy mode is guest endian, the hypervisor vscsi interface operates in big endian, so we must convert back and forth in several places. These changes are enough to attach a rootdisk. Sponsored by: Tag1 Consulting, Inc. Notes: svn path=/head/; revision=366038
* [PowerPC64LE] Fix endianness issues in phyp and opal consoles.Brandon Bergren2020-09-231-2/+8
| | | | | | | | | | This applies to both pseries and powernv, which were tested at different points during the patchset development. Sponsored by: Tag1 Consulting, Inc. Notes: svn path=/head/; revision=366036
* [PowerPC64LE] Tell the hypervisor to switch interrupts to LE at CHRP attach.Brandon Bergren2020-09-232-0/+28
| | | | | | | | | | Since we will need to be able to take traps relatively early in the process, ensure that the hypervisor changes our ILE for us as soon as we are ready. Sponsored by: Tag1 Consulting, Inc. Notes: svn path=/head/; revision=366035
* [PowerPC64LE] LE bringup work: locore / machdep / platformBrandon Bergren2020-09-221-1/+2
| | | | | | | | | | This is the initial LE changes required in the machdep code to get as far as platform attachment on qemu pseries. Sponsored by: Tag1 Consulting, Inc. Notes: svn path=/head/; revision=366033
* powerpc: clean up empty lines in .c and .h filesMateusz Guzik2020-09-0113-38/+20
| | | | Notes: svn path=/head/; revision=365073
* powerpc/mmu: Convert PowerPC pmap drivers to ifunc from kobjJustin Hibbits2020-05-271-36/+40
| | | | | | | | | | | | | With IFUNC support in the kernel, we can finally get rid of our poor-man's ifunc for pmap, utilizing kobj. Since moea64 uses a second tier kobj as well, for its own private methods, this adds a second pmap install function (pmap_mmu_init()) to perform pmap 'post-install pre-bootstrap' initialization, before the IFUNCs get initialized. Reviewed by: bdragon Notes: svn path=/head/; revision=361544
* This is Ethernet driver so mark the interrupt appropriately.Gleb Smirnoff2020-01-231-1/+1
| | | | Notes: svn path=/head/; revision=357011
* Enable use of ofwcons for early debugLeandro Lupori2019-12-091-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | This change enables the use of OpenFirmware Console (ofwcons), even when VGA is available, allowing early kernel messages to be seen, that is important in case of crashes before VGA console initialization. This is specially useful in virtualized environments, where the user/developer doesn't have full control of the virtualization engine (e.g. OpenStack). The old behavior is preserved by default and, in order to use ofwcons, a few tunables that have been introduced need to be set: - hw.ofwfb.disable=1 - disable OFW FrameBuffer device - machdep.ofw.mtx_spin=1 - change PPC OFW mutex to SPIN type, to match kernel console's mutex type - debug.quiesce_ofw=0 - don't call OFW quiesce, needed to keep ofwcons I/O working More details can be found at differential revision D20640. Reviewed by: jhibbits Differential Revision: https://reviews.freebsd.org/D20640 Notes: svn path=/head/; revision=355556
* [PPC64] Enable opal console use as a GDB DBGPORTLeandro Lupori2019-12-091-1/+1
| | | | | | | | | | | | | | This change makes it possible to use OPAL console as a GDB debug port. Similar to uart and uart_phyp debug ports, it has to be enabled by setting the hw.uart.dbgport variable to the serial console node of the device tree. Reviewed by: jhibbits Differential Revision: https://reviews.freebsd.org/D22649 Notes: svn path=/head/; revision=355555
* [PPC] Remove extra \0 char inserted on vty by QEMULeandro Lupori2019-11-291-4/+25
| | | | | | | | | | | | | | Since version 2.11.0, QEMU became bug-compatible with PowerVM's vty implementation, by inserting a \0 after every \r going to the guest. Guests are expected to workaround this issue by removing every \0 immediately following a \r. Reviewed by: jhibbits Differential Revision: https://reviews.freebsd.org/D22171 Notes: svn path=/head/; revision=355209
* [PPC64] Enable phyp vty use as a GDB DBGPORTLeandro Lupori2019-11-251-0/+163
| | | | | | | | | | | | | | | This change makes it possible to use a POWER Hypervisor virtual terminal device (phyp vty) as a GDB debug port. Similar to the uart debug port, it has to be enabled by setting the hw.uart_phyp.dbgport variable to the vty node of the device tree. Reviewed by: jhibbits Differential Revision: https://reviews.freebsd.org/D22205 Notes: svn path=/head/; revision=355093
* Convert to if_foreach_llmaddr() KPI.Gleb Smirnoff2019-10-211-13/+13
| | | | Notes: svn path=/head/; revision=353867
* [PPC64] Initial kernel minidump implementationLeandro Lupori2019-10-141-0/+32
| | | | | | | | | | | | | Based on POWER9BSD implementation, with all POWER9 specific code removed and addition of new methods in PPC64 MMU interface, to isolate platform specific code. Currently, the new methods are implemented on pseries and PowerNV (D21643). Reviewed by: jhibbits Differential Revision: https://reviews.freebsd.org/D21551 Notes: svn path=/head/; revision=353489
* powerpc/pmap64: Make moea64 statistics optionalJustin Hibbits2019-07-251-2/+2
| | | | | | | | | | | | | | | | | | Summary: It turns out statistics accounting is very expensive in the pmap driver, and doesn't seem necessary in the common case. Make this optional behind a MOEA64_STATS #define, which one can set if they really need statistics. This saves ~7-8% on buildworld time on a POWER9. Found by bdragon. Reviewed by: luporl Differential Revision: https://reviews.freebsd.org/D20903 Notes: svn path=/head/; revision=350313
* [PPC64] pseries: fix realmaxaddr calculationLeandro Lupori2019-07-101-1/+8
| | | | | | | | | | | | On POWER9/pseries, QEMU passes several regions of memory, instead of a single region containing all memory, as the code was expecting. Reviewed by: jhibbits Differential Revision: https://reviews.freebsd.org/D20857 Notes: svn path=/head/; revision=349885
* [PPC64] pseries llan: fix MAC addressLeandro Lupori2019-07-041-2/+11
| | | | | | | | | | | | | | | | | | | | | There was an issue in pseries llan driver, that resulted in the first 2 bytes of the MAC address getting stripped, and the last 2 being always 0. In most cases the network interface still worked, despite the MAC being different of what was specified to QEMU, but when some other host or DHCP server expected a specific MAC, this would fail. This change fixes this by shifting right by 2 the local-mac-address read from device tree, if its length is 6 instead of 8, as observed in QEMU DT, that always presents a 6 bytes value for this property. PR: 237471 Reported by: Alfredo Dal'Ava Junior Reviewed by: jhibbits Differential Revision: https://reviews.freebsd.org/D20843 Notes: svn path=/head/; revision=349723
* [PPC] Fix build error when POWERNV is disabledLeandro Lupori2019-06-111-1/+1
| | | | | | | | | | | | When building a kernel supporting PSERIES but not POWERNV, the compiler would complain about an error variable being possibly used before being initialized. In practice, however, this should never happen. In any case, it is now initialized to an error value. Notes: svn path=/head/; revision=348900
* [PPC64] Support QEMU/KVM pseries without hugepagesLeandro Lupori2019-06-071-7/+40
| | | | | | | | | | | | | | | | This set of changes make it possible to run FreeBSD for PowerPC64/pseries, under QEMU/KVM, without requiring the host to make hugepages available to the guest. While there was already this possibility, by means of setting hw_direct_map to 0, on PowerPC64 there were a couple of issues/wrong assumptions that prevented this from working, before this changelist. Reviewed by: jhibbits Differential Revision: https://reviews.freebsd.org/D20522 Notes: svn path=/head/; revision=348783
* Extract eventfilter declarations to sys/_eventfilter.hConrad Meyer2019-05-202-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | 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
* [PPC64] Fix wrong KASSERT in mphyp_pte_insert()Leandro Lupori2019-04-231-1/+1
| | | | | | | | | | | | | | | | | | As mphyp_pte_unset() can also remove PTE entries, and as this can happen in parallel with PTEs evicted by mphyp_pte_insert(), there is a (rare) chance the PTE being evicted gets removed before mphyp_pte_insert() is able to do so. Thus, the KASSERT should check wether the result is H_SUCCESS or H_NOT_FOUND, to avoid panics if the situation described above occurs. More details about this issue can be found in PR 237470. PR: 237470 Reviewed by: jhibbits Differential Revision: https://reviews.freebsd.org/D20012 Notes: svn path=/head/; revision=346600
* [PowerPC64] pseries-llan: increment packet output counters on error and successJustin Hibbits2019-04-231-2/+6
| | | | | | | | | | | | Summary: when using pseries-llan driver, Opkts and Oerrs counters (netstat -i) are always zero. This patch adds an small error handling to increment these counters. Submitted by: alfredo.junior_eldorado.org.br Differential Revision: https://reviews.freebsd.org/D20009 Notes: svn path=/head/; revision=346590
* powerpc64/pseries: Fix hypervisor call with extra argumentsJustin Hibbits2019-04-231-0/+5
| | | | | | | | | | | | | | | | Some hypervisor calls, such as H_SEND_LOGICAL_LAN, take more arguments than are traditionally passed in registers. The HCALL ABI will accept these arguments in r11 and r12. With ELFv2 ABI, these arguments are 2 double-words lower than ELFv1 ABI, as two double-words in the stack frame are no longer used, and therefore removed from the frame. Fix the offsets for loading the registers for the HCALL. This fixes the phyp_llan driver with ELFv2 kernel. Submitted by: alfredo.junior_eldorado.org.br Differential Revision: https://reviews.freebsd.org/D20008 Notes: svn path=/head/; revision=346589
* [ppc64] llan: fix fatal kernel trap when system is low on memoryLeandro Lupori2019-02-051-2/+0
| | | | | | | | | | | | | | | | | | When running several builders in parallel, on QEMU, with 8GB of memory, a fatal kernel trap (0x300 (data storage interrupt)) caused by llan driver is sometimes observed, when the system starts to run out of swap space. This happens because, at llan_intr(), a phyp call to add a logical LAN buffer is always made when llan_add_rxbuf() fails, even if it fails to allocate a new buffer. PR: 235489 Reviewed by: jhibbits Differential Revision: https://reviews.freebsd.org/D19084 Notes: svn path=/head/; revision=343791
* powerpc/powernv: Add a driver for the POWER9 XIVE interrupt controllerJustin Hibbits2019-02-021-6/+9
| | | | | | | | | | | | | | | | | The XIVE (External Interrupt Virtualization Engine) is a new interrupt controller present in IBM's POWER9 processor. It's a very powerful, very complex device using queues and shared memory to improve interrupt dispatch performance in a virtualized environment. This yields a ~10% performance improvment over the XICS emulation mode, measured in both buildworld, and 'dd' from nvme to /dev/null. Currently, this only supports native access. MFC after: 1 month Notes: svn path=/head/; revision=343674
* powerpc: Fix opaque irq data initializationJustin Hibbits2019-01-191-12/+16
| | | | | | | | | | | | The powerpc_intr structure is not zero-initialized, so on an invariants build would panic in the xics driver with an invalid pointer. Also fix the xics driver to share the private data setup code between xics_enable() and xics_bind(). Reported by: Leonardo Bianconi Notes: svn path=/head/; revision=343167
* powerpc/pseries: Cache the IPI vector to avoid the common static lookupJustin Hibbits2019-01-121-8/+13
| | | | | | | | | | | | The IPI vector is static, and happens to be the most common interrupt by far on some systems. Rather than searching for the interrupt every time, cache the index. This appears to yield a small performance boost, of about 8% reduction in buildworld times, on my POWER9 system, when paired with r342975. Notes: svn path=/head/; revision=342976
* powerpc: Add opaque 'private data' to interrupt vectorsJustin Hibbits2019-01-121-51/+44
| | | | | | | | | | The XICS and XIVE need extra data beyond irq and vector. Rather than performing a separate search, it's better for the general interrupt facility to hold a private pointer, since the search already must be done anyway at that level. Notes: svn path=/head/; revision=342975