Commit Graph
68685 Commits
Author SHA1 Message Date
Augustin Cavalier 1b6efe284a kernel/smp: Avoid calling cpu_pause() if test-and-set works on first try. 2026-03-17 14:48:53 -04:00
Augustin Cavalier 14b78e205c kernel/smp: call_all_cpus should run with interrupts disabled.
For consistency. And so should call_single_cpu.

Fixes #19983.
2026-03-17 14:23:58 -04:00
Augustin Cavalier 89c81c2ac1 kernel: Fix copy/paste error from previous commit. 2026-03-17 13:37:04 -04:00
Augustin Cavalier cf2179fa35 kernel: Add invalidation utility routines to VMTranslationMap.
These allow us to move a lot of the basic logic out of the
TranslationMaps. In the process, it extends the fix applied
to x86 in the previous commit to all the other maps.
2026-03-17 13:30:11 -04:00
Augustin Cavalier b4546a49f0 kernel/x86: Don't spuriously set the current CPU bit in Flush().
We may be called from the page daemon, which may be running on
a different CPU than the one this map is active on. So don't
bother flushing unnecessarily if we can avoid it.
2026-03-17 13:19:31 -04:00
Augustin Cavalier d4817afe36 kernel/smp: Use a single-CPU ICI if multicasting to only one CPU.
This avoids the broadcast mailbox (and the incrementing of
other CPU's counters) entirely in this case.

As this is used for TLB invalidation, processes that are only
running two threads at once will benefit immensely from this.
It also seems to be triggered by the kernel's "idle_scan_active_pages"
logic, which sometimes sends invalidations to CPUs besides its own.

On the VM setup, this path was hit around 200 times during boot,
around 600 times during a rebuild of HaikuDepot + mime_db, and
50,000+ times while running Iceweasel (Firefox). On bare metal,
it was hit around 300 times during boot, 300 times during a rebuild,
and 90,000+ times while running Iceweasel (over a different length
of time, though.)
2026-03-17 13:06:35 -04:00
Augustin Cavalier 9c08c836bf kernel/smp: Use read spinlocks when prepending broadcast messages.
Some brief testing shows that concurrency is unlikely here, but
we might as well.
2026-03-17 12:08:59 -04:00
Augustin Cavalier b6447046fc kernel/smp: De-indent smp_send_ici.
No functional change intended.
2026-03-17 11:54:27 -04:00
Augustin Cavalier 19bcb3be0a kernel/scheduler: Make invoke_scheduler atomic to skip unnecessary ICIs.
Following upon a KDL reported by atomozero, on wait-for-free-SMP-messages
on an unblock occurring with interrupts disabled.

In changing cpu_ent, move disabled to the beginning to avoid
enlarging the structure unncessarily.

On a 4-core VM, this skips around 200 sends during boot, and
over 3000 during a rebuild of HaikuDepot + mime_db (cold). On
bare metal (i3, 2x2), it skips around 150 during boot, and a bit
below 3000 during a rebuild of HaikuDepot + mime_db (over a much
longer time than in the VM, as the hardware is slower.)

Performance in the VM doesn't look much different. But this might
help in VirtualBox, or other situations where ICI latency is far
above what it should be.
2026-03-17 11:25:36 -04:00
Humdinger e53d371901 Mail app: Implement labeling emails
"Labels" (MAIL:label) will be used instead of the currently misused
"Status" (MAIL:status) to allow categorization of emails by the
user. These labels are only used on the locally download emails;
there's no syncing with a mail server.

(See also forum thread "Introducing a new indexed attribute META:tag" at
https://discuss.haiku-os.org/t/introducing-a-new-indexed-attribute-meta-tag.)

* Remove custom statuses from "Close and…" submenu and anything else
  concerning custom statuses.

* Add a "Set label" menu with a submenu to
  - Remove the current mail's label, if it has one
  - Add a new label
  - Choose from a list of labels (first 9 items with ALT+n shortcut)
  - Open the labels folder in Tracker to manage labels
    (delete/rename/etc.)

* Labels are saved as separate files in ~/config/settings/Mail/labels/

* Label files are queries for all files which have that particular
  label in their MAIL:label attribute. This is convenient when
  managing your label, e.g. see if there are any emails with a
  certain label before deleting it.

* Added "Same label" to the "Queries" menu.

* In MenusBeginning() the files in ~/config/settings/Mail/labels/ are
  read and shown with their file name as menu item.

* When an email is opened, its label file is created if it doesn't
  exist already.  That way the Mail app can provide labels that were
  not created with it, but  e.g. by manually filling the attribute in
  Tracker, or via a script etc.

* Related: When populating the labels menu, make sure each label query
  has the correct formula. A user may have created a label by hand or
  duplicated an existing formula, in which case the query formula would
  be missing or wrong.

Setting a label currently isn't supported when composing an email, as
we cannot set an attribute, because an email file isn't created until
it's sent.

Change-Id: I53fb4613ec1d2d96493169e0310c11c5ba0131c2
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10384
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: humdinger humdinger <[email protected]>
2026-03-17 12:52:32 +00:00
John Davis 640b37b32d hyperv_ic: Add time sync support
Adds support for the time sync Hyper-V integration component.

Change-Id: If8617feab196e59b8e1d2447ffbcb344a0e66f38
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10503
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: Jérôme Duval <[email protected]>
2026-03-17 06:25:53 +00:00
John Davis 4f6e4b41ba hyperv: Add reference counter support
Adds support for the Hyper-V partition reference counter.

Change-Id: Ie74b4d3af1b320b7b724776bdb6a22f643873f80
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10500
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: Jérôme Duval <[email protected]>
2026-03-17 06:25:53 +00:00
Augustin Cavalier d5a5f22579 pegasus: Replace with the upstream FreeBSD version.
Fixes #19745.

Change-Id: Ie540beecbf9f0a998f016f015357a38d1fa95bfd
Reviewed-on: https://review.haiku-os.org/c/haiku/+/9599
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: Jérôme Duval <[email protected]>
2026-03-16 21:30:32 +00:00
Sam Roberts 83be3b3da0 arm64: Clear fp before entering kernel
Otherwise, when crashing, the kernel could continue its
stacktrace back into memory which is no longer mapped.

Change-Id: Ifda337a08c476a18c7dbdd530e4236541d49d3bd
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10531
Tested-by: Commit checker robot <[email protected]>
Haiku-Format: Haiku-format Bot <[email protected]>
Reviewed-by: Fredrik Holmqvist <[email protected]>
2026-03-16 20:35:19 +00:00
Augustin Cavalier 924599c310 L2CAP: Change from SOCK_STREAM to SOCK_SEQPACKET.
This is the same as what FreeBSD does.
2026-03-16 13:21:46 -04:00
Augustin Cavalier 7512053757 kernel/smp: Refactor ICI broadcast/multicast to invoke the current CPU too.
Since the methods now don't just "send", the names are changed
also (which is fitting since they're now API-incompatible.)

The changes in the TranslationMaps to adopt this fixes a correctness
issue: previously TLB invalidations would be done either with or
without interrupts enabled depending on how they were invoked.
Now, they'll always be done with interrupts disabled. (This is
the same fix that was recently done to x86.)

The idea with processing the ICIs on the current CPU too is
that presumably the other CPUs will take just as much, if not
more, time processing the ICI than the sending CPU. So, we might
as well do the processing while we wait, rather than before or after.

Testing shows this to indeed be the case. On a bare metal i3, kernel
map invalidations (with global invalidations always forced) across
a boot-to-desktop go from around ~60.8ms cumulative before,
to ~51.8ms cumulative after this change.

Change-Id: Icd0343d462de7cf11043e6438f47b02f6b88bb8b
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10472
Reviewed-by: waddlesplash <[email protected]>
Tested-by: Commit checker robot <[email protected]>
2026-03-16 13:41:00 +00:00
Oscar Lesta 988ca40b01 cpp_rng: remove unused includes.
Change-Id: I5e2e1245f5b3e7d8bd104e9f0529b8dc1e4a5a85
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10530
Reviewed-by: waddlesplash <[email protected]>
2026-03-16 13:36:37 +00:00
Augustin Cavalier 000c32a568 asix88xxx: Import drivers from FreeBSD to replace usb_asix.
The homegrown usb_asix was partially based on the upstream FreeBSD
driver anyway, and hasn't seen much maintenance in recent years.
We might as well replace it with the FreeBSD version. In the process,
also add the "axge" driver, supporting the Gigabit version of this
hardware.

Tested by smrobtzz with the AX88179A: "it seems to work perfectly".

Change-Id: I37fdfc2cef6100916d6034817f117286f7f443b2
Reviewed-on: https://review.haiku-os.org/c/haiku/+/9600
Reviewed-by: waddlesplash <[email protected]>
2026-03-16 13:17:57 +00:00
Augustin Cavalier 9936387223 freebsd_network: Add everything needed for USB ethernet drivers.
Change-Id: I152d3fcdb50b9473f06c2164b9abb38b7c9d7e40
Reviewed-on: https://review.haiku-os.org/c/haiku/+/9598
Reviewed-by: waddlesplash <[email protected]>
2026-03-16 13:17:57 +00:00
Sam Roberts c0374aed39 freebsd_network: Add missing check for endpoint direction.
Signed-off-by: Augustin Cavalier <[email protected]>
2026-03-16 08:54:00 -04:00
Augustin Cavalier d59105d001 freebsd_network: Synchronize some mbuf routines with upstream FreeBSD.
Also delete an OpenBSD compatibility section that isn't used.

This includes a fix to mbufq_full (made in 2019 in FreeBSD)
to allow for mbufqs of unlimited size, apparently needed by
some drivers, found by @smrobtzz while testing USB ethernet
drivers.
2026-03-16 08:50:43 -04:00
Augustin Cavalier 913f501fbd kernel: Use uint64 for seconds in datetime conversion routines. 2026-03-16 08:35:51 -04:00
Sam Roberts b249bfc563 usb_ecm: Use appropriate langid when fetching MAC address
The AX88179A has an English MAC address and will STALL if you
don't remind it of this fact.

Change-Id: Id4b1d9b8ff69327787d826ce42e6d78bc3cbcc30
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10529
Reviewed-by: waddlesplash <[email protected]>
2026-03-16 12:28:46 +00:00
Nathan Patrizi 74613b3c9a ramdisk: Remove IOSchedulerSimple and handle IORequests directly
* Handle IO requests directly in the ramdisk instead of using
  IOSchedulerSimple as the request ordering being done is not needed.
* Fixes potential data corruption issues on the ramdisk caused by
  reordering partial write requests in IOSchedulerSimple.

Fixes #16951

Change-Id: I2d6c20016b54e8cb5b1d257989edada10c1d2376
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10490
Reviewed-by: waddlesplash <[email protected]>
Tested-by: Commit checker robot <[email protected]>
2026-03-16 12:27:28 +00:00
mohammedrattia cc14954ea8 bluetooth: fixing L2capClient testing Jamfile
- L2capClient SimpleTest couldn't compile because "bluetooth" isn't available library its correct name is "libbluetooth.so"
- I testing this on Haiku and it compiled normallly with only this change
- before the edit it was giving me error "-lbluetooth is unknown"

Change-Id: I88e59b0c1867c202d3e9916e5fa3964da22cb9e1
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10524
Reviewed-by: waddlesplash <[email protected]>
Tested-by: Commit checker robot <[email protected]>
2026-03-16 12:25:36 +00:00
mohammedrattia 01d996da1a bluetooth: Refactoring LocateDelegateFromMessage() function
- This is just small refactoring edit. LocateDelegateFromMessage() and LocateLocalDeviceImpl() are doing exactly the same thing except for looking for hci_id in the first one, so I used the second in the first to enhance readability.
- I didn't test this specifically but bluetooth server compiles and do its functions normally.

Change-Id: Ic687f219e407a262155aaceed95176edb5c6ce70
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10525
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
2026-03-16 12:20:08 +00:00
vighnesh-sawant c122595a54 bluetooth: Make RemoteDevice::Authenticate actually pair after
connecting

Sends an auth request to the controller, if connection was initated by
us

Change-Id: I32af0a24b902d0223bb4e773258ea9e9749a899c
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10527
Reviewed-by: waddlesplash <[email protected]>
2026-03-16 12:19:26 +00:00
vighnesh-sawant aa864b9d41 bluetooth: Add support for SSP and refactor AcceptConnection and
CreateConnection

Move expecting commands from RemoteDevice::Authenticate to where they
are called.In SSP we expect for the events after ConnectionComplete.
For the state machine, LINK_KEY_NOTIFY tells us the end of the pairing
in both pairings, so we clear all expected events there for the ones we added in
ConnectionComplete, In SimplePairingComplete we clear the ones added
in IOCapabilityRequest. Tested with both bluetooth 2.1 and older pairing.

Change-Id: Ia208506c9f289d9f44dc3b8b0e4cd8a726a5d726
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10526
Reviewed-by: waddlesplash <[email protected]>
2026-03-16 12:19:26 +00:00
vighnesh-sawant dbf6744326 bluetooth: Prevent duplicates in RemoteDevicesView
Loops through and compares baddr,if its matching does not add it again
and frees it.

Change-Id: I2590852fb9c4a9f21facf5a600f45e11aeecb4d5
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10494
Reviewed-by: waddlesplash <[email protected]>
Tested-by: Commit checker robot <[email protected]>
2026-03-16 12:19:26 +00:00
vighnesh-sawant e7eb60f1a7 bluetooth: Implement EIR parsing for HCI_EVENT_EXTENDED_INQUIRY_EVENT
This parses only EIR_NAME_SHORT and EIR_NAME_COMPLETE, others are not
yet usefull, adds a way to fetch the cached friendly name and adds a
friendlyName field to RemoteDevice. Refactors DeviceListItem to work on
RemoteDevice as it's only being used for that.Also adds a check if the
cached name is complete or not. If not ask for the complete name.

Change-Id: I7e37fb9cf44cb5598ef348fdd4d781c5ae04e24e
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10489
Reviewed-by: waddlesplash <[email protected]>
Tested-by: Commit checker robot <[email protected]>
2026-03-16 12:19:26 +00:00
Kacper Kasper ee10ca4b42 Preconfigure SSH server on test image
* This allows logging in to freshly built image using ssh.

Change-Id: I15baeee455827b73f12e1a222b166bd7975786dd
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10426
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: Kacper Kasper <[email protected]>
Reviewed-by: Priyanshu Gupta <[email protected]>
2026-03-15 20:55:27 +00:00
Autocomitter 36367253cd Update translations from Pootle 2026-03-14 08:10:57 +00:00
John Davis 51805ac6d3 kernel/x86: Fix IO-APIC initialization on non-PCI systems
Currently the IO-APIC is fully initialized after PCI initialization
resulting in the IO-APIC not being initialized on systems without a
PCI bus (i.e. Hyper-V Gen2 VMs). This change moves IO-APIC
initialization to occur during early init, deferring PCI interrupt
enumeration and routing until after PCI initialization has been
completed.

Change-Id: I00be0be05d2e7668c3c6bc7af3afc4ff8d04a129
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10414
Reviewed-by: waddlesplash <[email protected]>
Reviewed-by: X512 X512 <[email protected]>
Tested-by: Commit checker robot <[email protected]>
2026-03-13 18:08:44 +00:00
John Davis a0c9ad5269 hyperv: Implement heartbeat support
Adds support for the Hyper-V heartbeat integration component as part
of a new hyperv_ic driver.

Change-Id: I130ccc946d1f3ea30d87abf403d23c2cc34a1c57
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10427
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: Jérôme Duval <[email protected]>
2026-03-13 14:06:07 +00:00
Sam Roberts e438946e25 kernel/arm64: Add kernel support for Samsung UART
Tested on M1 MacBook Air.

Change-Id: Idda9b2a168642b55a9e30336be1c4f4936670035
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10487
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
2026-03-13 08:34:54 +00:00
Sam Roberts 013f25498a arm64: Correct kernel base address
* KERNEL_BASE differed from the base the kernel was linked for
* arch_mmu_is_kernel_address was off-by-one

Change-Id: Ic5a4a509e330bba2503532cc75f1fdaa85ad4f07
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10488
Reviewed-by: waddlesplash <[email protected]>
2026-03-12 19:16:54 +00:00
vighnesh-sawant c0336fd788 bluetooth: Add support for HCI_EVENT_EXTENDED_INQUIRY_RESULT
Follow up of a4e1f4d8ce,
this contains only response per event.

Change-Id: I6582f9530a273699048c04481fa0ef4a31a315ae
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10486
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
2026-03-12 17:01:16 +00:00
vighnesh-sawant 230470d6d4 bluetooth: Add support for HCI_EVENT_INQUIRY_RESULT_WITH_RSSI
Follow up of a4e1f4d8ce, details given
in that commit message on parsing of this event message

Change-Id: Icc0b54bdafe3cb167553d2fda3f62762d2d2595e
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10485
Reviewed-by: waddlesplash <[email protected]>
2026-03-12 17:01:16 +00:00
John Davis 6e270b5f8c hyperv: Add mmio_size attribute to device nodes
Some devices such as graphics and PCI passthrough bridges require
MMIO space. Add this as a device node attribute if present.

Change-Id: Id374ff61c29c1ccad10e3a7f3f7053c14d02aa5e
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10483
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: Jérôme Duval <[email protected]>
2026-03-12 15:09:09 +00:00
John Davis 19630fa076 hyperv: Fix definition of HV_MS_TO_US
Definition is intended to be used where bigtime_t is accepted
and should be signed.

Change-Id: I6ebe21c55ae47b0b4f46f0df655942b582759d51
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10482
Reviewed-by: waddlesplash <[email protected]>
Tested-by: Commit checker robot <[email protected]>
2026-03-12 15:09:09 +00:00
Sam Roberts d2819f9e83 arm64: Add apple,s5l UART driver
This is the debug UART found in Apple SoCs. Tested on M1 MacBook Air.

Registers definitions were taken from:
  - https://github.com/AsahiLinux/m1n1/blob/18eb02fa92789dfcdab8e00e8b1cace7ab002718/src/uart_regs.h
  - https://www.sistemasorp.es/blog/S3C2410%20-%20datasheet.pdf

Change-Id: I2e4c8b7927fc823cedca421e1a2623b91f5ef112
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10480
Reviewed-by: waddlesplash <[email protected]>
2026-03-11 23:38:03 +00:00
Sam Roberts 5bb69a0f33 build: Fixes for arm64 macOS
* macOS ships an ancient version of GNU Bison which wants
  an '=' after %name-prefix

* macOS awk doesn't support strftime, so try to find a working
  awk.

* _haiku_build_{open,openat,fcntl} are declared and defined with
  different prototypes (variadic vs non-variadic). This is bad
  on its own, but it "happens to" work on most platforms since
  variadic parameters are usually passed in registers, same as other
  arguments. On arm64 macOS, variadic parameters are always passed
  on the stack, so you get weird and confusing bugs when using
  these functions.

Change-Id: I8cee9ecac0ac9b039be6b7e35ceaf8ad7c0f4c44
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10468
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
2026-03-11 02:21:34 +00:00
Augustin Cavalier a2e4f9f75f kernel/x86: Use call_single_cpu_sync in get_cpuid.
Sends a more targeted ICI than a broadcast.
2026-03-10 17:55:12 -04:00
Augustin Cavalier 1d740a6700 kernel/smp: find_free_message expects interrupts enabled.
Use thread_pin instead of disable_interrupts in the call_*
methods.
2026-03-10 17:54:33 -04:00
Augustin Cavalier e867e95538 kernel/smp: Deduplicate call_*_cpu.
* Rename call_single_cpu for consistency.

 * Combine call_all_cpus implementations into one, like call_single_cpu.
2026-03-10 15:33:33 -04:00
Augustin Cavalier 334e90a2ac kernel/smp: Just return free messages using a write spinlock.
There isn't much value in using extra atomics here.
2026-03-10 15:21:27 -04:00
Augustin Cavalier 3c28d298f7 kernel: Don't fail if the private string.h is included under GCC2. 2026-03-10 13:10:25 -04:00
Augustin Cavalier 918b2dfaab BMessage: Eliminate UsePrivateHeaders kernel. 2026-03-10 13:10:25 -04:00
Augustin Cavalier b350405e06 kernel/smp: Refactor smp_msg structure allocation.
The SMP_MAX_CPUS * 4 fixed pool size apparently goes all the way
back to NewOS, which supported only 4 CPUs max. As ours is now
64, this means the fixed pool size was very large even on systems
with only a few cores. So, instead, allocate 4 messages per CPU
(though often more, due to rounding up to the page size; e.g.
on x86_64, 1 page fits 56 smp_msgs.)

Also, put them a dedicated area, to keep them a bit more segmented
from the kernel heap, in case of problems.
2026-03-10 13:04:46 -04:00
Augustin Cavalier 10d0685a9e EFI: Fix some more instances of memcpy on other architectures. 2026-03-10 12:20:00 -04:00