summaryrefslogtreecommitdiff
path: root/Kernel
AgeCommit message (Collapse)Author
2023-03-11Kernel/Storage+Base: Fix boot_device_addressing document for NVMePankaj Raghav
The LUN.target_id parameter points to a NVMe Namespace which starts from 1 and not 0. Fix the document to reflect the same while addressing a nvme device in the boot parameters
2023-03-11Kernel: Add non standard value to sys$sysconfFabian Dellwing
Add `_SC_PHYS_PAGES` to sys$sysconf syscall. This value is needed for a port I'm working on.
2023-03-11Kernel: Fix variable shadowing issue in PCIIDELegacyModeControllerJulian Offenhäuser
In this specific else case, primary_base_io_window would not be assigned in the outer scope, leading to a crash immediately after.
2023-03-10Kernel: Use RefPtr instead of LockRefPtr for File and subclassesAndreas Kling
This was mostly straightforward, as all the storage locations are guarded by some related mutex. The use of old-school associated mutexes instead of MutexProtected is unfortunate, but the process to modernize such code is ongoing.
2023-03-09Kernel: Switch LockRefPtr<Inode> to RefPtr<Inode>Andreas Kling
The main place where this is a little iffy is in RAMFS where inodes have a LockWeakPtr to their parent inode. I've left that as a LockWeakPtr for now.
2023-03-08Kernel: Add missing include that broke the AARCH64 buildMarco Cutecchia
2023-03-08Kernel: Fix mispellings of AARCH64 that broke the buildMarco Cutecchia
2023-03-08Kernel/Storage: Remove indication for possible future support of ATAPILiav A
There's no plan to support ATAPI in the foreseeable future. ATAPI is considered mostly as an extension to pass SCSI commands over ATA-link compatible channel (which could be a physical SATA or PATA). ATAPI is mostly used for controlling optical drives which are considered obsolete in 2023, and require an entire SCSI abstraction layer we don't exhibit with bypassing ioctls for sending specific SCSI commands in many control-flow sequences for actions being taken for such hardware. Therefore, let's make it clear we don't support ATAPI (SCSI over ATA) unless someone picks it up and proves otherwise that this can be done cleanly and also in a relevant way to our project.
2023-03-08Kernel: Remove ATAPI eject method from the AHCIPort classLiav A
We never actually used it. It never has been proved to work reliably, therefore it should be removed.
2023-03-08Kernel/VirtIO: Ignore Configurations that have length of zero bytesLiav A
These configurations are simply invalid. Ignoring those allow us to boot with the virtio-gpu-pci device (in addition to the already supported virtio-vga PCI device).
2023-03-07Kernel: Use non-locking {Nonnull,}RefPtr for OpenFileDescriptionAndreas Kling
This patch switches away from {Nonnull,}LockRefPtr to the non-locking smart pointers throughout the kernel. I've looked at the handful of places where these were being persisted and I don't see any race situations. Note that the process file descriptor table (Process::m_fds) was already guarded via MutexProtected.
2023-03-06Kernel: Remove two outdated FIXMEs about the file descriptor table mutexAndreas Kling
These functions cannot be called without already holding the relevant mutex these days, since m_fds is a MutexProtected object. :^)
2023-03-06AK+Kernel: Remove all the Nonnull*PtrVector classesAndreas Kling
2023-03-06Kernel: Stop using NonnullLockRefPtrVectorAndreas Kling
2023-03-06Everywhere: Remove NonnullOwnPtr.h includesAndreas Kling
2023-03-06Everywhere: Stop using NonnullOwnPtrVectorAndreas Kling
Same as NonnullRefPtrVector: weird semantics, questionable benefits.
2023-03-06Everywhere: Remove NonnullRefPtr.h includesAndreas Kling
2023-03-06Everywhere: Stop using NonnullRefPtrVectorAndreas Kling
This class had slightly confusing semantics and the added weirdness doesn't seem worth it just so we can say "." instead of "->" when iterating over a vector of NNRPs. This patch replaces NonnullRefPtrVector<T> with Vector<NNRP<T>>.
2023-03-05Kernel: Move process coredump metadata modification to the prctl syscallLiav A
2023-03-05Kernel: Actually check Process unveil data when creating perfcore dumpLiav A
Before of this patch, we looked at the unveil data of the FinalizerTask, which naturally doesn't have any unveil restrictions, therefore allowing an unveil bypass for a process that enabled performance coredumps. To ensure we always check the dumped process unveil data, an option to pass a Process& has been added to a couple of methods in the class of VirtualFileSystem.
2023-03-05Kernel+Userland: Add support for using the PCSpeaker with various tonesLiav A
2023-03-01Kernel: Move TYPEDEF_* TTY macros to API/ttydefaults.h fileLiav A
This allows us to get rid of an include to LibC/sys/ttydefaults.h in the Kernel TTY implementation. Also, move ttydefchars static const struct to another file called Kernel/API/ttydefaultschars.h, so it could be used too in the Kernel TTY implementation without the need to include anything from LibC.
2023-03-01Kernel+LibC: Move the FD_SETSIZE declaration to API/POSIX/select.h fileLiav A
2023-03-01Kernel: Remove includes to LibC stdarg definitionsLiav A
We don't actually need the va_list and other stdarg definitions in the kernel, because we actually don't use the "pure" printf interface in any kernel code at all, but we retain the snprintf declaration because the libstdc++ library still need it to be declared and extern'ed.
2023-03-01Kernel: Remove heuristics for detecting malformed malloc memory accessLiav A
I never saw these kind of messages in any debug session I had, and it helps us to remove an include to LibC/mallocdefs.h file.
2023-02-25Kernel: Mark sys$prctl() as not needing the big lockLiav A
This syscall has sufficient locking and therefore it doesn't need the big lock being taken.
2023-02-24Kernel+Userland: Refine preventing syscall annotations of Regions optionLiav A
Instead of using a special case of the annotate_mapping syscall, let's introduce a new prctl option to disallow further annotations of Regions as new syscall Region(s).
2023-02-24Kernel: Do 2 validations in annotate_mapping syscall outside a spinlockLiav A
2023-02-24Kernel: Properly lock Process protected data in the prctl syscallLiav A
2023-02-24Kernel/FileSystem: Simplify the ProcFS significantlyLiav A
Since the ProcFS doesn't hold many global objects within it, the need for a fully-structured design of backing components and a registry like with the SysFS is no longer true. To acommodate this, let's remove all backing store and components of the ProcFS, so now it resembles what we had in the early days of ProcFS in the project - a mostly-static filesystem, with very small amount of kmalloc allocations needed. We still use the inode index mechanism to understand the role of each inode, but this is done in a much "static"ier way than before.
2023-02-24Kernel: Fix typo proccess => process in a name of Process methodLiav A
2023-02-24AK+Kernel: Add includes before removing Kernel/ProcessExposed.hLiav A
Apparently without this file, we won't be able to compile due to missing includes to TimeManagement and KBufferBuilder.
2023-02-24Kernel+Userland: Unify declarations for KCOV in Kernel/API/kcov.hLiav A
2023-02-24Kernel+Userland: Move prctl numbers header file to Kernel/API directoryLiav A
2023-02-23Kernel: Prevent out-of-bounds read/write in VirtIO GPU3DDevice::ioctlLiav A
Before doing a check if offset_in_region + num_bytes of the transfer descriptor are together more than NUM_TRANSFER_REGION_PAGES * PAGE_SIZE, check that addition of both of these parameters will not simply overflow which could lead to out-of-bounds read/write. Fixes #17518.
2023-02-21Kernel: Support more clocks in sys$clock_getres()Humberto Alves
Support all the available clocks in clock_getres(). Also, fix this function to use the actual ticks per second value, not the constant `_SC_CLK_TCK` (which is always equal to 8) and move the resolution computation logic to TimeManagement.
2023-02-21Kernel: Fix const-correctness issue in StorageManagementAndreas Kling
We have to take the StorageDevice as a mutable reference, otherwise we can't perform any interesting I/O operations on it.
2023-02-21Kernel: Make NVMeQueue const-correct internallyAndreas Kling
Store the DMA R/W page PhysicalPage object as an NNRP<T const>.
2023-02-21Kernel: Fix const-correctness of PCI::DeviceIdentifier usageAndreas Kling
2023-02-21Kernel: Make NNRP<PhysicalPage const> possibleAndreas Kling
This wasn't possible before as ref() and unref() were non-const.
2023-02-19Kernel/IntelGraphics: Move PLL handling code to a different fileLiav A
Dealing with the specific details of how to program a PLL should be done in a separate file to ensure we can easily expand it to support future generations of the Intel graphics device.
2023-02-19Kernel/Graphics: Return ENODEV if there's no valid EDID to returnLiav A
ENODEV better represents the fact that there might be no display device (e.g. a monitor) connected to the connector, therefore we should return this error. Another reason to not use ENOTIMPL is that it's a requirement for all DisplayConnectors to put a valid EDID in place even for a hardware we don't currently support mode-setting in runtime.
2023-02-19Kernel/Graphics: Allow Intel DisplayConnector to not have consoleLiav A
2023-02-19Kernel/IntelGraphics: Move DisplayPlane enable code to derived classesLiav A
Instead of doing that on the IntelDisplayPlane class, let's have this in derived classes so these classes can decide how to use the settings that were provided before calling the enable method.
2023-02-19Kernel/IntelGraphics: Add Generation enum to the Definitions fileLiav A
This will be used to annotate which Generation is being used for each Intel iGPU we discover.
2023-02-19Kernel/IntelGraphics: Move pipe management to the Transcoder classLiav A
It became apparent to me that future generations of the Intel graphics chipset utilize the same register set as part of the Transcoder register set. Therefore, it should be included now in the Transcoder class.
2023-02-19Kernel/Graphics: Introduce the IntelDisplayConnectorGroup classLiav A
In the real world, graphics hardware tend to have multiple display connectors. However, usually the connectors share one register space but still keeping different PLL timings and display lanes. This new class should represent a group of multiple display connectors working together in the same Intel graphics adapter. This opens an opportunity to abstract the interface so we could support future Intel iGPU generations. This is also a preparation before the driver can support newer devices and utilize their capabilities. The mentioned preparation is applied in a these aspects: 1. The code is splitted into more classes to adjust to future expansion. 2 classes are introduced: IntelDisplayPlane and IntelDisplayTranscoder, so the IntelDisplayPlane controls the plane registers and second class controls the pipeline (transcoder, encoder) registers. On gen4 it's not really useful because there are probably one plane and one encoder to care about, but in future generations, there are likely to be multiple transcoders and planes to accommodate multi head support. 2. The set_edid_bytes method in the DisplayConnector class can now be told to not assume the provided EDID bytes are always invalid. Therefore it can refrain from printing error messages if this flag parameter is true. This is useful for supporting real hardware situation when on boot not all ports are connected to a monitor, which can result in floating bus condition (essentially all the bytes we read are 0xFF). 3. An IntelNativeDisplayConnector could now be set to flag other types of connections such as eDP (embedded DisplayPort), Analog output, etc. This is important because on the Intel gen4 graphics we could assume to have one analog output connector, but on future generations this is very likely to not be the case, as there might be no VGA outputs, but rather only an eDP connector which is converted to VGA by a design choice of the motherboard manufacturer. 4. Add ConnectorIndex to IntelNativeDisplayConnector class - Currently this is used to verify we always handle the correct connector when doing modesetting. Later, it will be used to locate special settings needed when handling connector requests. 5. Prepare to support more types of display planes. For example, the Intel Skylake register set for display planes is a bit different, so let's ensure we can properly support it in the near future.
2023-02-19Kernel+Userland: Add constants subdirectory at /sys/kernel directoryLiav A
This subdirectory is meant to hold all constant data related to the kernel. This means that this data is never meant to updated and is relevant from system boot to system shutdown. Move the inodes of "load_base", "cmdline" and "system_mode" to that directory. All nodes under this new subdirectory are generated during boot, and therefore don't require calling kmalloc each time we need to read them. Locking is also not necessary, because these nodes and their data are completely static once being generated.
2023-02-19Kernel: Remove unnecessary include from SysFS PowerStateSwitch codeLiav A
I added that include in 2e55956784ac0c61fe877c316867074e0f432452 by a mistake, so we should get rid of it as soon as possible.
2023-02-19Kernel/FileSystem: Don't assume flags for root filesystem mount flagsLiav A
This is considered somewhat an abstraction layer violation, because we should always let userspace to decide on the root filesystem mount flags because it allows the user to configure the mount table to preferences that they desire. Now that SystemServer is modified to re-mount the root mount with the desired flags, we can just mount the root filesystem without assuming special flags.