| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
to get unmask_irq declaration
|
|
|
|
| |
Message-ID: <20240309140244.347835-2-luca@orpolo.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
declarations.
I was trying to reuse TASK_NAME_SIZE in kern/thread.h but it was
impossible because files included from kern/task.h end up requiring
kern/thread.h (through percpu.h), creating a recursive dependency.
With this change, mach_types.h only defines forward declarations and
modules have to explicitly include the appropriate header file if they
want to be able touch those structures. Most of the other includes are
required because we no longer grab many different includes through
mach_types.h.
Message-ID: <20240212062634.1082207-1-flaviocruz@gmail.com>
|
|
|
|
| |
Message-ID: <20240211115958.1889648-1-damien@zamaudio.com>
|
| |
|
|
|
|
|
|
| |
TESTED: works in qemu
TESTED: works hardware with AMD cpu
Message-ID: <20240207050158.1640853-5-damien@zamaudio.com>
|
|
|
|
|
| |
vm_page_grab_contig does not necessarily allocate at the beginning of
the DMA segment, so rather allocate by hand very early.
|
|
|
|
|
|
|
| |
TESTED: This works in qemu correctly
TESTED: This works on an AMD board with ACPI v2.0 correctly
Message-ID: <20240207050158.1640853-3-damien@zamaudio.com>
|
|
|
|
|
|
|
| |
This initializes the lapic without
turning on the IOAPIC interrupts during SMP init.
Message-ID: <20240207050158.1640853-2-damien@zamaudio.com>
|
|
|
|
|
|
| |
self-modifying code is generally frowned upon, Intel largely says the
support is model-dependent. We can as well just relocate from the C
code like we did for the temporary gdt.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This took some time to figure out.
Involves a hand-crafted 16 bit assembly instruction [1]
because it requires an immediate for the memory address
of far jump. This required self-modifying code
to inject the next instruction, therefore I added a near
jump to clear the instruction cache queue in case the pipeline
cached the unmodified jump location.
[1] Intel Architecture Software Developer's Manual,
Volume 2: Instruction Set Reference Manual
|
|
|
|
|
|
|
|
|
| |
This enables gnumach to additionally parse the XSDT table
if the revision of ACPI is 2.
TESTED: Still works on qemu (ACPI v1.0)
TESTED: Works on a x86 board with XSDT (ACPI v2.0)
Message-ID: <20240131021218.1335821-1-damien@zamaudio.com>
|
|
|
|
|
|
|
| |
Move cninit() further down so that IOAPIC has a chance
to initialize before the com port interrupt is unmasked
in the IOAPIC, fixing a fault and reboot.
Message-ID: <20240131100210.1354522-1-damien@zamaudio.com>
|
|
|
|
|
|
| |
Clear flag in msr for xAPIC mode.
Message-ID: <20240130080405.1304381-1-damien@zamaudio.com>
|
|
|
|
|
|
|
| |
Previously, only IOAPIC[0] was supported.
Now this supports up to two IOAPICs.
Message-ID: <20240129100652.1262126-1-damien@zamaudio.com>
|
|
|
|
|
|
|
|
| |
Since we are not using legacy MP tables but intending to use ACPI
to configure interrupt routing, we can assume all boards have
virtual wire mode, thus do not require setting of IMCR register.
(This may fix crashes on machines that do not have IMCR registers).
Message-ID: <20240124035138.1044855-2-damien@zamaudio.com>
|
|
|
|
|
|
|
|
| |
TESTED: By booting gnumach off an HP T620 with console=com0 and receiving 115200 8N1 console
on another machine connected via the serial port in minicom.
Without this patch, part of the console is garbled by mismatching com params (9600 7N1).
Message-ID: <20240119031214.691086-1-damien@zamaudio.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Logic for interrupts:
- interrupt.S raises spl (thus IF cleared)
- interrupt.S EOI
- interrupt.S calls the handler
- for pure in-kernel handlers, they do whatever they want with IF
cleared.
- when a userland handler is registers, queue_intr masks the irq.
- interrupt.S lowers spl with splx_cli, thus IF still cleared
- iret, that sets IF
- later on, userland acks the IRQ, that unmasks the irq
The key to this change is that all interrupts, including IPIs, are
treated the same way. Eg. the spl level is now raised before an IPI and
restored after. Also, EOI is not needed inside irq_acknowledge.
With this change and the experimental change not to dispatch threads
direct to idle processors in the scheduler, I no longer observe kernel
faults, but an occasional hang does occur.
Message-Id: <20231002033906.124427-1-damien@zamaudio.com>
|
|
|
|
| |
Message-Id: <20231001045755.95707-1-damien@zamaudio.com>
|
|
|
|
| |
Message-Id: <20231001045731.95682-1-damien@zamaudio.com>
|
|
|
|
| |
Message-Id: <20230930063032.75232-3-damien@zamaudio.com>
|
|
|
|
| |
Message-Id: <20230930063032.75232-2-damien@zamaudio.com>
|
| |
|
|
|
|
|
| |
Computing it would be complex, and this is a temporary descriptor
anyway.
|
| |
|
|
|
|
| |
So we can use it very early.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This speeds up smp again, by storing the struct processor
in a percpu area and avoiding an expensive cpu_number every call
of current_processor(), as well as getting the cpu_number by
an offset into the percpu area. Untested on 64 bit
and work remains to use other percpu arrays.
TESTED: (NCPUS=8) -smp 1 boots to login shell ~2x slower than uniprocessor
TESTED: (NCPUS=8) -smp 2 boots to INIT but hangs there
TESTED: (NCPUS=8) -smp 4 gets stuck seemingly within rumpdisk and hangs
TESTED: (NCPUS=1) uniprocessor is a bit faster than normal
Message-Id: <20230924103428.455966-3-damien@zamaudio.com>
|
|
|
|
| |
spl cannot be called before the clock is set up.
|
|
|
|
|
| |
We need to make sure segments are in addresses order, and avoid returning
dma32 memory when it's not actually within directmap memory.
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
5da1aea7ab3c ("Acknoledge interrupt after handler call") moved the IRQ ack
to after calling the handler because of overflows. But that was because the
interrupts were getting enabled at some point. Now that all spl levels
above 0 just disable interrupts, once we have called spl7 we are safe
until splx_cli is called (and even that doesn't release interrupts, only
the eventual iret will).
And if the handler triggers another IRQ, it will be lost, so we do want
to ack the IRQ before handling it.
|
|
|
|
|
|
|
|
|
|
|
| |
Rumpdisk needs to allocate dma32 memory areas, so we do always need this
limit.
The non-Xen x86_64 case had a typo, and the 32bit PAE case didn't have
the DMA32 limit.
Also, we have to cope with VM_PAGE_DMA32_LIMIT being either above or below
VM_PAGE_DIRECTMAP_LIMIT depending on the cases.
|
|
|
|
| |
Message-Id: <20230805154843.2003098-1-damien@zamaudio.com>
|
|
|
|
|
|
|
|
|
|
| |
This speeds up smp slightly by reducing the cpu_number()
complexity to have no branching, just a look up table.
It also addresses the problem that CPU_NUMBER was only using
raw apic_id as an approximation of the kernel_id.
Other improvements were to remove unnecessary checks now that
the lookup table always resolves to a valid value.
Message-Id: <20230805074945.1983707-1-damien@zamaudio.com>
|
|
|
|
|
|
|
| |
* i386/i386at/acpi_parse_apic.c: use vm_offset_t instead of uint32_t
for vm addresses
* x86_64/Makefrag.am: support --enable-apic
Message-Id: <20230521204918.492957-1-luca@orpolo.org>
|
|
|
|
| |
So that userland's uname -m still reports i686-AT386.
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
hz variable is the number of mach ticks in 1 second.
We want to know how many lapic ticks in 1 mach tick.
Therefore, we set a timer for 10 mach ticks and divide
the lapic stopwatch counter value by 10.
Message-Id: <20230311072937.450161-1-damien@zamaudio.com>
|
|
|
|
|
|
|
|
|
|
|
| |
Previously the lapic timer was calibrated by one-shot PIT timer2.
This method can be buggy and generally unused in emulation environments.
This patch reworks the timer calibration to use a mach timer based
on regular PIT interrupts to remapped IOAPIC pin.
This also changes the primary clock source to use PIT timer0 remapped
to an IOAPIC pin when APIC mode is enabled, instead of a periodic lapic
timer.
Message-Id: <20230306070452.292697-1-damien@zamaudio.com>
|
|
|
|
|
|
| |
NB: This relies on a fix for QEMU as one-shot PIT mode
is currently broken in qemu.
Message-Id: <20230226013110.50606-1-damien@zamaudio.com>
|
|
|
|
|
|
| |
TESTED: With and without apic/smp
Message-Id: <20230225061420.16985-1-damien@zamaudio.com>
|
|
|
|
|
|
|
|
|
|
|
| |
Fixes boot --enable-ncpus=1 with --enable-apic configuration
albeit the keyboard is stuck and network cannot be accessed.
Error messages:
Timeout reached while wating for return value
/bin/console: Could not receive return value from daemon process: Connection timed out
Message-Id: <20230219022351.25767-1-damien@zamaudio.com>
|
| |
|