Home | History | Annotate | Download | only in x86
History log of /src/sys/arch/xen/x86/hypervisor_machdep.c
RevisionDateAuthorComments
 1.46  01-Mar-2023  riastradh xen/x86: Need kpreempt_disable/enable around curcpu() access.

This is called with `hardware' interrupts enabled (between sti and
cli), so presumably preemption is possible here.

XXX pullup-8
XXX pullup-9
XXX pullup-10
 1.45  07-Sep-2022  knakahara branches: 1.45.4;
NetBSD/x86: Raise the number of interrupt sources per CPU from 32 to 56.

There has been no objection for three years.
https://mail-index.netbsd.org/port-amd64/2019/09/22/msg003012.html
Implemented by nonaka@n.o, updated by me.
 1.44  20-Aug-2022  riastradh x86: Split most of pmap.h into pmap_private.h or vmparam.h.

This way pmap.h only contains the MD definition of the MI pmap(9)
API, which loads of things in the kernel rely on, so changing x86
pmap internals no longer requires recompiling the entire kernel every
time.

Callers needing these internals must now use machine/pmap_private.h.
Note: This is not x86/pmap_private.h because it contains three parts:

1. CPU-specific (different for i386/amd64) definitions used by...

2. common definitions, including Xenisms like xpmap_ptetomach,
further used by...

3. more CPU-specific inlines for pmap_pte_* operations

So {amd64,i386}/pmap_private.h defines 1, includes x86/pmap_private.h
for 2, and then defines 3. Maybe we should split that out into a new
pmap_pte.h to reduce this trouble.

No functional change intended, other than that some .c files must
include machine/pmap_private.h when previously uvm/uvm_pmap.h
polluted the namespace with pmap internals.

Note: This migrates part of i386/pmap.h into i386/vmparam.h --
specifically the parts that are needed for several constants defined
in vmparam.h:

VM_MAXUSER_ADDRESS
VM_MAX_ADDRESS
VM_MAX_KERNEL_ADDRESS
VM_MIN_KERNEL_ADDRESS

Since i386 needs PDP_SIZE in vmparam.h, I added it there on amd64
too, just to keep things parallel.
 1.43  31-May-2022  bouyer When we have pending events in stipending(), evt_set_pending() has to set
the ih_pending flag for each handler too. Xen/i386 should be stable again.
 1.42  31-May-2022  bouyer Revert previous; evt_set_pending() will set ret to 1 if needed to this was
not our bug.
 1.41  31-May-2022  bouyer stipending(): if we're going to process some interrupts don't return 0.
Hopefully fixes random hang seen in i386 Xen PV.

The bug has been there ~forever but was masked by the fact that spllower()
did call event handlers much more often.
 1.40  19-May-2022  bouyer Restore de EOI mechanism for pirq, using the newer hypervisor interface.
It is needed.
Hopefully fixes kern/56291, kern/56793, kern/55667
 1.39  02-May-2020  bouyer Introduce Xen PVH support in GENERIC.
This is compiled in with
options XENPVHVM
x86 changes:
- add Xen section and xen pvh entry points to locore.S. Set vm_guest
to VM_GUEST_XENPVH in this entry point.
Most of the boot procedure (especially page table setup and switch to
paged mode) is shared with native.
- change some x86_delay() to delay_func(), which points to x86_delay() for
native/HVM, and xen_delay() for PVH

Xen changes:
- remove Xen bits from init_x86_64_ksyms() and init386_ksyms()
and move to xen_init_ksyms(), used for both PV and PVH
- set ISA no-legacy-devices property for PVH
- factor out code from Xen's cpu_bootconf() to xen_bootconf()
in xen_machdep.c
- set up a specific pvh_consinit() which starts with printk()
(which uses a simple hypercall that is available early) and switch to
xencons when we can use pmap_kenter_pa().
 1.38  25-Apr-2020  bouyer Merge the bouyer-xenpvh branch, bringing in Xen PV drivers support under HVM
guests in GENERIC.
Xen support can be disabled at runtime with
boot -c
disable hypervisor
 1.37  21-Apr-2020  jdolecek convert to newer HYPERVISOR_physdev_op() interface, now command and the
arg are separate arguments - this is needed for newer physdev_op commands

remove code for PHYSDEVOP_IRQ_UNMASK_NOTIFY, it is obsolete since
interface version 0x00030202 and is unsupported by newer versions of Xen

confirmed working on amd64 Dom0, i386 compile-tested only
 1.36  09-May-2019  bouyer branches: 1.36.2; 1.36.8;
sti/cli are not allowed on Xen, we have to clear/set a bit in the
shared page. Revert x86_disable_intr/x86_enable_intr to plain function
calls on XENPV.
While there, clean up unused functions and macros, and change cli()/sti()
macros to x86_disable_intr/x86_enable_intr.
Makes Xen domU boot again
(http://www-soc.lip6.fr/~bouyer/NetBSD-tests/xen/HEAD/)
 1.35  12-Feb-2019  cherry conditionally include XENPV specific code.

This explicitly excludes PV only functionality that would be wrong to
attempt to use in other modes, for eg: p2m table management.
 1.34  25-Dec-2018  cherry Excise XEN specific code out of x86/x86/intr.c into xen/x86/xen_intr.c

While at it, separate the source function tracking so that the interrupt
paths are truly independant.

Use weak symbol exporting to provision for future PVHVM co-existence
of both files, but with independant paths. Introduce assembler code
such that in a unified scenario, native interrupts get first priority
in spllower(), followed by XEN event callbacks. IPL management and
semantics are unchanged - native handlers and xen callbacks are
expected to maintain their ipl related semantics.

In summary, after this commit, native and XEN now have completely
unrelated interrupt handling mechanisms, including
intr_establish_xname() and assembler stubs and intr handler
management.

Happy Christmas!
 1.33  19-Nov-2018  kre Hide differences between i386 and amd64 interrupt frames so XEN does
not need to know there is one. Hopefully unbreak i386 build.
 1.32  18-Nov-2018  cherry On Xen, copy just the bits we need from the trapframe for hardclock(9)
and statclock(9).

Current, the macros that use the trapframe are:
CLKF_USERMODE()
CLKF_PC()
CLKF_INTR()

Of these, CLKF_INTR() already ignores the frame and uses the ci_idepth
variable to do its job.

Convert the two remaining ones to do this, but only for XEN.
 1.31  18-Nov-2018  cherry Save the interrupt trap/clockframe to a per-cpu copy.

We can use this copy to pass on the trapframe to hardclock(9) from
within the xen timer handler. This delinks the current dependency
between MD code and the handler, which is specially prototyped to take
the clockframe unlike any other handler.

This change has performance implications, as each interrupt entry will
copy the entire trapframe over to the per-cpu cached copy. This can be
mitigated by selectively copying just the parts of the clockframe that
are used by hardclock() et. al.

Tested on amd64 XEN domU
 1.30  17-Nov-2018  cherry Use hypervisor provided interface to unmask specific ports.

Although at first glance this looks suboptimal, the unmask operation
fast path does not use hypervisor_unmask_event(). Instead, it directly
operates on the mask and pending bit arrays to provide what would
effectively be an "auto mask/eoi" semantic.

This change is thus not in the fast path, and has the advantage of
performance improvements since cross CPU state updates etc. is handled
within the hypervisor instead of domU IPIs.
 1.29  26-Oct-2018  cherry Decompose hypervisor_enable_event() into functional steps.

The hypervisor_unmask_event() step is relevant for any event.

The pirq related step is only relevant for pirq bound events.

Prune blanket usage of this, so that usage is semantically appropriate.
 1.28  21-Sep-2014  bouyer branches: 1.28.12; 1.28.18; 1.28.20;
Make Xen kernels compile without DIAGNOSTIC
 1.27  13-Jan-2013  bouyer branches: 1.27.12;
Re-apply
http://mail-index.netbsd.org/source-changes/2012/11/25/msg039125.html
http://mail-index.netbsd.org/source-changes/2012/11/25/msg039126.html
they're not involved in i386 domU hang shown by ATF.
 1.26  12-Jan-2013  bouyer Revert these commits from november 2012:
http://mail-index.netbsd.org/source-changes/2012/11/25/msg039125.html
http://mail-index.netbsd.org/source-changes/2012/11/25/msg039126.html
http://mail-index.netbsd.org/source-changes/2012/11/25/msg039142.html

they cause a i386PAE domU to hang while running ATF tests, as shown in
http://www-soc.lip6.fr/~bouyer/NetBSD-tests/xen/HEAD/

(we should pay more attention to test results, myself first).
 1.25  12-Jan-2013  bouyer Back out this commit:
http://mail-index.netbsd.org/source-changes/2012/12/28/msg039950.html
which cause a panic when running tests on amd64, as shown on:
http://www-soc.lip6.fr/~bouyer/NetBSD-tests/xen/HEAD/
(i386 hangs for unrelated reasons).
 1.24  28-Dec-2012  cherry Simplify the xen event handler callback by:
- moving the interrupt handler callback traversal into a separate
function.
- using evt_iterate_bits() to scan through the pending bitfield
- removing cross-cpu pending actions - events recieved on the wrong
vcpu are re-routed via hypervisor_send_event().
- simplifying nested while() loops by encapsulating them in
equivalent functions.

Many thanks for multiple reviews by bouyer@ and jym@
 1.23  25-Nov-2012  cherry Make hypervisor_set_ipending() and its consumers cpu unaware. This syncs syntax with semantics
 1.22  10-Nov-2012  cherry Remove e a redundant layer of function calling in the event handling path
 1.21  27-Dec-2011  cherry branches: 1.21.6;
Optimise branch predict hint for the intended use-case (cross cpu event notification)
 1.20  27-Dec-2011  cherry Do not touch pending flags across vcpus
 1.19  26-Dec-2011  cherry Do not fiddle with the event masks of non-local vcpus when unmasking events across vcpus
 1.18  03-Dec-2011  bouyer branches: 1.18.2;
hypervisor_unmask_event(): don't check/update evtchn_pending_sel for the
current CPU, but for any CPU which may accept this event.
xen/xenevt.c: more use of atomic ops and locks where appropriate, and some
other SMP fixes. Handle all events on the primary CPU (may be revisited
later). Set/clear ci_evtmask[] for watched events.

This should fix the problems on dom0 kernels reported by jym@
 1.17  19-Nov-2011  cherry [merging from cherry-xenmp] bring in bouyer@'s changes via:
http://mail-index.netbsd.org/source-changes/2011/10/22/msg028271.html
From the Log:
Log Message:
Various interrupt fixes, mainly:
keep a per-cpu mask of enabled events, and use it to get pending events.
A cpu-specific event (all of them at this time) should not be ever masked
by another CPU, because it may prevent the target CPU from seeing it
(the clock events all fires at once for example).
 1.16  20-Sep-2011  jym branches: 1.16.2;
Merge jym-xensuspend branch in -current. ok bouyer@.

Goal: save/restore support in NetBSD domUs, for i386, i386 PAE and amd64.

Executive summary:
- split all Xen drivers (xenbus(4), grant tables, xbd(4), xennet(4))
in two parts: suspend and resume, and hook them to pmf(9).
- modify pmap so that Xen hypervisor does not cry out loud in case
it finds "unexpected" recursive memory mappings
- provide a sysctl(7), machdep.xen.suspend, to command suspend from
userland via powerd(8). Note: a suspend can only be handled correctly
when dom0 requested it, so provide a mechanism that will prevent
kernel to blindly validate user's commands

The code is still in experimental state, use at your own risk: restore
can corrupt backend communications rings; this can completely thrash
dom0 as it will loop at a high interrupt level trying to honor
all domU requests.

XXX PAE suspend does not work in amd64 currently, due to (yet again!)
page validation issues with hypervisor. Will fix.

XXX secondary CPUs are not suspended, I will write the handlers
in sync with cherry's Xen MP work.

Tested under i386 and amd64, bear in mind ring corruption though.

No build break expected, GENERICs and XEN* kernels should be fine.
./build.sh distribution still running. In any case: sorry if it does
break for you, contact me directly for reports.
 1.15  10-Aug-2011  cherry refactor the bitstring/mask operations to be behind an API. Make pending interrupt marking cpu aware.
 1.14  30-Mar-2011  jym branches: 1.14.2;
Fix a year old bug that was only fixed in jym-xensuspend branch, but
not in HEAD:
- use uvm_km_alloc() instead of kmem_alloc() to enforce alignement when
allocating p2m_frame pages (xentools can only deal with page-aligned
addresses)
- do not use paddr_t for p2m_frame_list_list with PAE, xentools expect
32 bits PFNs even with 64 bits PTE.

Required to make ``xm dump-core'' work as expected.
 1.13  23-Oct-2009  snj branches: 1.13.4; 1.13.6;
Remove 3rd and 4th clauses. OK cl@ (copyright holder).
 1.12  29-Jul-2009  cegger remove Xen2 support.
ok bouyer@
 1.11  21-Oct-2008  cegger branches: 1.11.8;
introduce two macros: xendomain_is_dom0() and xendomain_is_privileged(). Use them.
 1.10  16-Sep-2008  bouyer Implement the arch-dependent p2m frame lists list. This adds support for
'xm dump-core' for NetBSD domUs.
From Jean-Yves Migeon (jean-yves dot migeon at espci dot fr)
 1.9  01-Jul-2008  bouyer branches: 1.9.2;
Raise ci_idepth (and switch to interrupt stack on i386) becore calling
xenevt_event().
 1.8  21-Apr-2008  cegger branches: 1.8.2; 1.8.4; 1.8.6;
Access Xen's vcpu info structure per-CPU.
Tested on i386 and amd64 (both dom0 and domU) by me.
Xen2 tested (both dom0 and domU) by bouyer.
OK bouyer
 1.7  14-Apr-2008  cegger branches: 1.7.2;
- use POSIX integer types
- ansify functions
 1.6  19-Feb-2008  bouyer branches: 1.6.6;
The event bitmasks provided by the hypervisor are unsigned long (so 64bits
on amd64). Make sure to use the right type to store and manipulate them.
This fixes amd64, where basically any event channel > 31 was not working
(and you get there after starting/stopping a domU a few times). Things
would occasionally unwedge though the spllower() callbacks.
 1.5  19-Feb-2008  bouyer Fix xenevt to not call softint_schedule() above IPL_HIGH:
Register a ipl callback for IPL_HIGH.
if the current ipl level is too high, just record the event in a bitmap,
and record IPL_HIGH as pending. The callback will process the pending events.
 1.4  20-Dec-2007  ad branches: 1.4.2;
- Make __cpu_simple_lock and similar real functions and patch at runtime.
- Remove old x86 atomic ops.
- Drop text alignment back to 16 on i386 (really, this time).
- Minor cleanup.
 1.3  12-Dec-2007  bouyer cleanup the debug event handler to not use the IPL system at all. Fix
debug event storm on XEN2.
 1.2  22-Nov-2007  bouyer branches: 1.2.2; 1.2.4; 1.2.6; 1.2.8; 1.2.10; 1.2.12;
Pull up the bouyer-xenamd64 branch to HEAD. This brings in amd64 support
to NetBSD/Xen, both Dom0 and DomU.
 1.1  17-Oct-2007  bouyer branches: 1.1.2; 1.1.4;
file hypervisor_machdep.c was initially added on branch bouyer-xenamd64.
 1.1.4.2  27-Dec-2007  mjf Sync with HEAD.
 1.1.4.1  08-Dec-2007  mjf Sync with HEAD.
 1.1.2.1  17-Oct-2007  bouyer Prepare for xenamd64:
- kill xen/i386/identcpu.c, use i386/i386/identcpu.c instead (with a few
#ifndef XEN)
- move some files that can be shared between i386 and amd64 from
xen/i386 to xen/x86 (or to xen/xen for non-cpu-specific code)
- split assembly out of xen/include/hypervisor.h to xen/include/hypercalls.h
- use <xen/...> instead of <machine/...> for cpu-independant include files.

more work needed here, i386-specific files should got out of arch/xen to
arch/xeni386, and more code shared with arch/i386.
 1.2.12.2  02-Jan-2008  bouyer Sync with HEAD
 1.2.12.1  13-Dec-2007  bouyer cleanup the way debug event is handled: make it bypass the IPL system
completely, it's called by shortcuts in the normal path because we want it to
be always called, even if the IPL is high.
Fix debug even recursion on XEN2
 1.2.10.1  13-Dec-2007  yamt sync with head.
 1.2.8.4  27-Feb-2008  yamt sync with head.
 1.2.8.3  21-Jan-2008  yamt sync with head
 1.2.8.2  07-Dec-2007  yamt sync with head
 1.2.8.1  22-Nov-2007  yamt file hypervisor_machdep.c was added on branch yamt-lazymbuf on 2007-12-07 17:27:17 +0000
 1.2.6.1  26-Dec-2007  ad Sync with head.
 1.2.4.2  03-Dec-2007  ad Sync with HEAD.
 1.2.4.1  22-Nov-2007  ad file hypervisor_machdep.c was added on branch vmlocking on 2007-12-03 19:04:40 +0000
 1.2.2.2  27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.2.2.1  22-Nov-2007  joerg file hypervisor_machdep.c was added on branch jmcneill-pm on 2007-11-27 19:36:19 +0000
 1.4.2.3  23-Mar-2008  matt sync with HEAD
 1.4.2.2  09-Jan-2008  matt sync with HEAD
 1.4.2.1  20-Dec-2007  matt file hypervisor_machdep.c was added on branch matt-armv6 on 2008-01-09 01:50:14 +0000
 1.6.6.4  17-Jan-2009  mjf Sync with HEAD.
 1.6.6.3  28-Sep-2008  mjf Sync with HEAD.
 1.6.6.2  02-Jul-2008  mjf Sync with HEAD.
 1.6.6.1  02-Jun-2008  mjf Sync with HEAD.
 1.7.2.1  18-May-2008  yamt sync with head.
 1.8.6.1  03-Jul-2008  simonb Sync with head.
 1.8.4.2  24-Sep-2008  wrstuden Merge in changes between wrstuden-revivesa-base-2 and
wrstuden-revivesa-base-3.
 1.8.4.1  18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.8.2.3  11-Mar-2010  yamt sync with head
 1.8.2.2  19-Aug-2009  yamt sync with head.
 1.8.2.1  04-May-2009  yamt sync with head.
 1.9.2.2  13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.9.2.1  19-Oct-2008  haad Sync with HEAD.
 1.11.8.10  27-Aug-2011  jym Rename the functions for suspend to reflect that Xen does not hijack
the ACPI "sleepstate" sysctl(7) node anymore.

Add a boolean value to mark that the save/suspend operation has been
notified by dom0, so as to avoid possible errors where admin would like
to schedule the domain for sleep without dom0 being prepared for that. Fail
with EAGAIN in this case.

Sprinkle some KNF.
 1.11.8.9  27-Aug-2011  jym Further sync with HEAD.
 1.11.8.8  07-May-2011  jym KNF.
 1.11.8.7  02-May-2011  jym Sync with head.
 1.11.8.6  30-Mar-2011  jym Sync with my commits in HEAD.
 1.11.8.5  29-Mar-2011  jym More sync fixes. And add the mbr_gpt files.
 1.11.8.4  01-Nov-2009  jym - Upgrade suspend/resume code to comply with Xen2 removal.
- Add support for PAE domUs suspend/resume.
- Fix an issue regarding initialization of the xbd ring I/O that could end
badly during resume, with invalid block operations submitted to dom0 backend.

NetBSD supports PAE under x86_32 by considering the L2 page as being
4 pages long instead of 1.

Xen validates the page types during resume. Sadly, the hypervisor handles
alternative recursive mappings (== PG/PD entries pointing to pages other
than self) inadequately, which could lead to incorrect page pinning.

As a result, the important change with this patch is to clear these alternative
mappings during suspend, and reset them back to their former self upon
resume. For PAE, approx. all 4 PDIR_SLOT_PTEs could be considered as
alternative recursive mappings.

See comments in pmap.c for further details.

Now, let the testing and bug hunting begin.
 1.11.8.3  01-Nov-2009  jym Sync with HEAD.
 1.11.8.2  29-May-2009  jym - use uvm_km_alloc() instead of kmem_alloc() to enforce alignement when
allocating p2m_frame pages (xentools can only deal with page-aligned addresses)
- *sigh* do not use paddr_t for p2m_frame_list_list with PAE, xentools expect
32 bits addresses even with 64 bits PTE...
 1.11.8.1  09-Feb-2009  jym Initial code for xen save/restore/migrate facilities.

- split the attach code of frontends in two half: one that is only needed
during autoconf(9) attach/detach phases, and one used at each save/restore
of device state (between suspend and resume).

Applies to hypervisor, xencons, xenbus, xbd, and xennet.

- add a rwlock(9) ("ptom_lock") to protect the different parts in the kernel
that manipulate MFNs (which could change between a suspend and a resume,
without the kernel noticing it). Parts that require MFNs acquire a reader lock,
while suspend code will acquire a writer lock to ensure that no-other parts
in kernel still use MFNs.

- integrate the suspend code with sysmon.

- various things in pmap(9), and clock.

TODO:
- factorize code a bit more inside frontends drivers.
- remove all alternative recursive (APDP_PDE) mappings found in PD/PT during
suspend, as Xen does not support them.
- abstract the ptom_lock locking, it is only required when kernel preemption
is enabled, or on MP systems.

Current code works mostly. You may experience difficulties in some corner
cases (dom0 warnings about xennet interface errors, and Xen tools failing to
validate NetBSD's alternative pmaps).
 1.13.6.1  06-Jun-2011  jruoho Sync with HEAD.
 1.13.4.1  21-Apr-2011  rmind sync with head
 1.14.2.6  22-Oct-2011  bouyer Various interrupt fixes, mainly:
keep a per-cpu mask of enabled events, and use it to get pending events.
A cpu-specific event (all of them at this time) should not be ever masked
by another CPU, because it may prevent the target CPU from seeing it
(the clock events all fires at once for example).
 1.14.2.5  18-Sep-2011  cherry Use an IPI to re-route events to the cpu where the handler has been registered
 1.14.2.4  22-Aug-2011  cherry Do not trust the hypervisor to route events to the right cpu. Enforce this in stipending()
 1.14.2.3  17-Aug-2011  cherry Pullup relevant changes from -current
 1.14.2.2  04-Aug-2011  cherry first cut at per-cpu event handling
 1.14.2.1  03-Jun-2011  cherry Initial import of xen MP sources, with kernel and userspace tests.
- this is a source priview.
- boots to single user.
- spurious interrupt and pmap related panics are normal
 1.16.2.2  16-Jan-2013  yamt sync with (a bit old) head
 1.16.2.1  17-Apr-2012  yamt sync with head
 1.18.2.1  18-Feb-2012  mrg merge to -current.
 1.21.6.3  03-Dec-2017  jdolecek update from HEAD
 1.21.6.2  25-Feb-2013  tls resync with head
 1.21.6.1  20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.27.12.1  22-Sep-2014  martin Pull up following revision(s) (requested by bouyer in ticket #115):
sys/arch/xen/x86/hypervisor_machdep.c: revision 1.28
sys/arch/xen/xenbus/xenbus_client.c: revision 1.13
sys/arch/xen/xen/xbdback_xenbus.c: revision 1.60
sys/arch/xen/xen/clock.c: revision 1.63
Make Xen kernels compile without DIAGNOSTIC
 1.28.20.1  10-Jun-2019  christos Sync with HEAD
 1.28.18.2  26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.28.18.1  26-Nov-2018  pgoyette Sync with HEAD, resolve a couple of conflicts
 1.28.12.1  31-Jul-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1864):

sys/arch/xen/x86/hypervisor_machdep.c: revision 1.46 (patch)

xen/x86: Need kpreempt_disable/enable around curcpu() access.

This is called with `hardware' interrupts enabled (between sti and
cli), so presumably preemption is possible here.
 1.36.8.7  25-Apr-2020  bouyer sync with bouyer-xenpvh-base2 (HEAD)
 1.36.8.6  25-Apr-2020  bouyer Sync with bouyer-xenpvh-base2 (HEAD)
 1.36.8.5  19-Apr-2020  bouyer Move xen_ipi.c to XENPV only.
Make sure we don't need to send events to remote CPUs (outside of IPIs)
 1.36.8.4  18-Apr-2020  bouyer Add PVHVM multiprocessor support:
We need the hypervisor to be set up before cpus attaches.
Move hypervisor setup to a new function xen_hvm_init(), called at the
beggining of mainbus_attach(). This function searches the cfdata[] array
to see if the hypervisor device is enabled (so you can disable PV
support with
disable hypervisor
from userconf).
For HVM, ci_cpuid doens't match the virtual CPU index needed by Xen.
Introduce ci_vcpuid to cpu_info. Introduce xen_hvm_init_cpu(), to be
called for each CPU in in its context, which initialize ci_vcpuid and
ci_vcpu, and setup the event callback.
Change Xen code to use ci_vcpuid.

Do not call lapic_calibrate_timer() for VM_GUEST_XENPVHVM, we will use
Xen timers.

Don't call lapic_initclocks() from cpu_hatch(); instead set
x86_cpu_initclock_func to lapic_initclocks() in lapic_calibrate_timer(),
and call *(x86_cpu_initclock_func)() from cpu_hatch().
Also call x86_cpu_initclock_func from cpu_attach() for the boot CPU.
As x86_cpu_initclock_func is called for all CPUs, x86_initclock_func can
be a NOP for lapic timer.

Reorganize Xen code for x86_initclock_func/x86_cpu_initclock_func.
Move x86_cpu_idle_xen() to hypervisor_machdep.c
 1.36.8.3  16-Apr-2020  bouyer amd64: Xhypervisor_pvhvm_callback has to be in text.user for SVS.
Thanks to maxv@ for helping me with this.
Enable SVS again.
While there, increase ci_idepth before calling do_hypervisor_callback,
and don't touch ci_idepth while looping over pending events.
 1.36.8.2  16-Apr-2020  bouyer Reorganise sources to make it possible to include Xen PVHVM support in
native kernels. Among others:
- move xen/include/amd64/hypercall.h to amd64/include/xen and
xen/include/i386/hypercall.h to i386/include/xen
- exclude some native files from the build for xenpv
- add xen to "machine" config statement for amd64 and i386
- split arch/xen/conf/files.xen to arch/xen/conf/files.xen (for pv drivers)
and arch/xen/conf/files.xen.pv (for full pv support)
- add GENERIC_XENHVM kernel config which includes GENERIC and add Xen PV
drivers.
 1.36.8.1  12-Apr-2020  bouyer Get rid of xen-specific ci_x* interrupt handling:
- use the general SIR mechanism, reserving 3 more slots for IPL_VM, IPL_SCHED
and IPL_HIGH
- remove specific handling from C sources, or change to ipending
- convert IPL number to SIR number in various places
- Remove XUNMASK/XPENDING in assembly or change to IUNMASK/IPENDING
- remove Xen-specific ci_xsources, ci_xmask, ci_xunmask, ci_xpending from
struct cpu_info
- for now remove a KASSERT that there are no pending interrupts in
idle_block(). We can get there with some software interrupts pending
in autoconf XXX needs to be looked at.
 1.36.2.1  31-Jul-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1681):

sys/arch/xen/x86/hypervisor_machdep.c: revision 1.46 (patch)

xen/x86: Need kpreempt_disable/enable around curcpu() access.

This is called with `hardware' interrupts enabled (between sti and
cli), so presumably preemption is possible here.
 1.45.4.1  31-Jul-2023  martin Pull up following revision(s) (requested by riastradh in ticket #269):

sys/arch/xen/x86/hypervisor_machdep.c: revision 1.46

xen/x86: Need kpreempt_disable/enable around curcpu() access.

This is called with `hardware' interrupts enabled (between sti and
cli), so presumably preemption is possible here.

RSS XML Feed