summaryrefslogtreecommitdiff
path: root/sys/arch/xen/include
AgeCommit message (Collapse)Author
2023-03-24Allow a PVH dom0 to use VGA as console: make xen_pvh_consinit() return 1 ifbouyer
it handles the console and 0 otherwise (especially when console=tty0 or console=pc is present on the command line). In consinit() fallback to native console selection if xen_pvh_consinit() returns 0.
2023-02-25xen/hypervisor.h: Nix trailing whitespace.riastradh
No functional change intended.
2023-02-25xen: Fix sense of xen_rmb/wmb to make sense.riastradh
Use membar_acquire and membar_release, not membar_consumer and membar_producer, out of paranoia -- that better matches Linux's rmb/wmb (at least for non-I/O loads and stores). Proposed on port-xen: https://mail-index.netbsd.org/port-xen/2022/07/13/msg010248.html
2022-09-07NetBSD/x86: Raise the number of interrupt sources per CPU from 32 to 56.knakahara
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.
2022-08-31Remove XENPV support from xenmem; it's only used for !XENPV at this time.bouyer
2022-08-31Work in progress on dom0 PVH support: ioctl support for tools.bouyer
Basically, in PVH mode (where XENFEAT_auto_translated_physmap is enabled), the hypervisor will not map foreing ressources in our virtual address space for us. Instead, we have to pass it an address in our physical address space (but not mapped to some RAM) where the ressource will show up and then enter this PA in pour page table. For this, introduce xenmem_* which manage the PA space. In PVH mode this is just allocated from the iomem_ex extent. With this, I can start a PV domU, and the guest's kernel boots (and the console works). It hangs because the backend driver can't map the frontend ressources (yet). Note that, per https://xenbits.xen.org/docs/unstable/support-matrix.html, dom0 PVH support is still considered experimental by Xen.
2022-05-25PVH and HVM guests can easily have more than XEN_LEGACY_MAX_VCPUS (32) cpus.bouyer
Support up to HVM_MAX_VCPUS (256). This requires resizing a few arrays in evtchn.c, and using VCPUOP_register_vcpu_info for vcpuid >= XEN_LEGACY_MAX_VCPUS Tested with 96 vCPUs.
2022-05-23Work in progress on MSI/MSI-X on Xen (MSI works on my hardware, more workbouyer
needed for MSI-X): - Xen silently rejects 32 bits writes to MSI configuration registers (especially when setting PCI_MSI_CTL_MSI_ENABLE/PCI_MSIX_CTL_ENABLE), it expects 16 bits writes. So introduce a pci_conf_write16(), only available on XENPV (and working only for mode 1 without PCI_OVERRIDE_CONF_WRITE) and use it to enable MSI or MSI-X on XENPV. - for multi-MSI vectors, Xen allocates all of them in a single hypercall, so it's not convenient to do it at intr_establish() time. So do it at alloc() time and register the pirqs in the msipic structure. xen_pic_to_gsi() now just returns the values cached in the msipic. As a bonus, if the PHYSDEVOP_map_pirq hypercall fails we can fail the alloc() and we don't need the xen_pci_msi*_probe() hacks. options NO_PCI_MSI_MSIX still on by default for XEN3_DOM0.
2022-05-19Restore de EOI mechanism for pirq, using the newer hypervisor interface.bouyer
It is needed. Hopefully fixes kern/56291, kern/56793, kern/55667
2021-09-16fix various typos, mainly in comments.andvar
2020-08-31Add back <xen/xenio3.h>, it's needed by xentools413bouyer
2020-07-24<xen/xenio.h> is in fact used by the newly imported xentools 4.13,jdolecek
reinstantiate it header is for use by xentools only, which define domid_t themselves, so it should not be a problem the header doesn't define it per PR port-xen/52874
2020-07-19for Xen MSI, fallback to INTx when PHYSDEVOP_map_pirq fails for the devicejdolecek
apparently Xen requires VT-d to be enabled in BIOS for PHYSDEVOP_map_pirq to work, this change makes it work on systems with VT-d disabled or missing adresses the panic part of PR port-xen/55285 by Patrick Welche
2020-07-17don't install xen/xenio.h and xen/xenio3.h anymore, xentools don't use itjdolecek
PR port-xen/52874
2020-05-26Implement new ioctl, needed by Xen 4.13:bouyer
IOCTL_PRIVCMD_MMAPBATCH_V2 IOCTL_PRIVCMD_MMAP_RESOURCE IOCTL_GNTDEV_MMAP_GRANT_REF IOCTL_GNTDEV_ALLOC_GRANT_REF
2020-05-26Ajust pmap_enter_ma() for upcoming new Xen privcmd ioctl:bouyer
pass flags to xpq_update_foreign() Introduce a pmap MD flag: PMAP_MD_XEN_NOTR, which cause xpq_update_foreign() to use the MMU_PT_UPDATE_NO_TRANSLATE flag. make xpq_update_foreign() return the raw Xen error. This will cause pmap_enter_ma() to return a negative error number in this case, but the only user of this code path is privcmd.c and it can deal with it. Add pmap_enter_gnt()m which maps a set of Xen grant entries at the specified va in the specified pmap. Use the hooks implemented for EPT to keep track of mapped grand entries in the pmap, and unmap them when pmap_remove() is called. This requires pmap_remove() to be split into a pmap_remove_locked(), to be called from pmap_remove_gnt().
2020-05-15use short for irq2port[] to save memory (4KB), it only needs to storejdolecek
numbers <= NR_EVENT_CHANNELS (2048)
2020-05-14xen_vec_alloc() is no morejdolecek
2020-05-07Change event_set_handler() to take the target CPU parameter. If ci is NULL,bouyer
event_set_handler() will choose the CPU and bind the event. If ci is not NULL the caller is responsible for binding the event. Use a IPI xcall to register the handlers if needed. pull in a hack from x86 to force pirq handlers to be mpsafe if registered at a level != IPL_VM. This is for the com at isa interrupt handler, which registers at IPL_HIGH and has to way to tell it's mpsafe (taking KERNEL_LOCK at IPL_HIGH causes deadlocks on MP systems).
2020-05-04add support for using MSI for XenPV Dom0jdolecek
use PHYSDEVOP_map_pirq to get the pirq/gsi for MSI/MSI-X, switch also INTx to use it instead of PHYSDEVOP_alloc_irq_vector MSI confirmed working with single-vector MSI for wm(4), ahcisata(4), bge(4) XXX added some provision for MSI-X, but it doesn't actually work (no interrupts delivered), needs some further investigation; disable MSI-X for XENPV via flag in x86/pci/pci_machdep.c
2020-05-02Introduce Xen PVH support in GENERIC.bouyer
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().
2020-05-01make the csum blank/undefer counters per interfacejdolecek
2020-04-25Merge the bouyer-xenpvh branch, bringing in Xen PV drivers support under HVMbouyer
guests in GENERIC. Xen support can be disabled at runtime with boot -c disable hypervisor
2020-04-21convert to newer HYPERVISOR_physdev_op() interface, now command and thejdolecek
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
2020-04-21adjust so that this at least compiles and links with __HAVE_PCI_MSI_MSIXjdolecek
2020-04-21XEN_IPI_KICK was replaced by XEN_IPI_AST.ad
2020-04-21add blkif_x86_{32,64}_request_indirect typesjdolecek
2020-04-19change interface for xen_shm_map() so that caller always supplies the VA,jdolecek
it now fails only if the Xen hypercall fails, in which case the failure is final change xbdback to pre-allocate KVA on xbdback attach (and free on detach), so it has always KVA to map the request pages remove no longer needed KVA allocation failure handling
2020-04-13By default, events are bound to CPU 0 (exept for IPIs and VTIMERs whichbouyer
are bound to a different CPU at creation time). Recent MI changes caused the scheduler to choose a different CPU when probing and attaching xennet devices (I guess it's the xenbus thread which runs on a different CPU). This cause the callback to be called on a different CPU than the one expected by the kernel, and the event is ignored. It is handled when the clock causes the callback to be called on the right CPU, which is why xennet still run, but slowly. Change event_set_handler() to do a EVTCHNOP_bind_vcpu if requested to, and make sure we don't do it for IPIs and VIRQs (for theses, the op fails).
2020-04-11put xenbus dmat into xenbus_device so it's available also for backendjdolecek
devices which don't use autoconfig, remove from attach args
2020-04-10add and pass dma tag to PV drivers attached to xenbus, so thay canjdolecek
use bus_dmamap_load_mbuf() et.al. due to XENPV override, _BUS_BUS_TO_PHYS() dmamap segment ds_addr gets filled with ma, so value can be directly used for e.g. grant calls
2020-04-09update to __XEN_INTERFACE_VERSION__ 0x0003020a aka Xen 3.2.10jdolecek
this brings grant memory v2 support: - status separated from flags - revoking access needs just memory barrier, no need for expensive cmpxchg16 any more - sub-page hypervisor copy-only grants, to be used by xennet(4) - 64-bit frame, i.e. support for DomU RAM >16TB the grant table is now always allocated on boot to maximum size, it's now never grown in runtime; switch back to regular kmem_alloc()/kmem_free() code now requires v2 support, no compatibility for grant version 1 retained - Xen v2 support predates all currently supported Xen versions also interface for baloon changed slightly, code updated
2020-04-07add wrapper to free response from xenbus_dev_request_and_reply(), sojdolecek
that call in xenbus_dev_write() wouldn't need to know how it's allocated
2020-04-07add a small wrapper xenbus_directory_free() to free result ofjdolecek
xenbus_directory(), so that caller doesn't need to be aware how the memory was allocated
2020-04-07partially convert to kmem_alloc()jdolecek
plug memory leak in one xenbus_probe_device_type() error path when read_backend_details() fails
2020-04-07convert the node watch code to use kmem_alloc() instead of malloc()jdolecek
2020-04-07make xenbus_watch_path() static, it's not used outside xenbus_client.cjdolecek
2020-04-07revert the watch.node change, xenbus_watch_path() and xenbus_watch_path2()jdolecek
need to use non-constant path
2020-04-07change xenbus_read() interface so that caller supplies the buffer and it'sjdolecek
size, caller doesn't free(9) the returned value any more
2020-04-07no need to malloc()+copy watch.node, it's constant string - either "device"jdolecek
or "backend"; just use the strings direct
2020-04-06add known_mpsafe parameter also to pirq_establish(), and pass the parameterjdolecek
to underlying event_set_handler()
2020-04-06remove restriction on interrupt level for MP-safe interrupt handlersjdolecek
2020-04-05remove xengnt_grant_transfer() and xengnt_revoke_transfer(), nothingjdolecek
uses it any more
2020-04-03Attach xen IPI event counters.ad
2020-03-22actually in data_validated case, there is no need to inspect the data for Rx,jdolecek
simply set the supported csum offload flags to skip the software csum verification
2020-03-18use NET[RT]XF_data_validated flag to mark when Tx packet has validjdolecek
checksum; this is used to skip software checksum validation on xennet Rx side when configured for Rx offloading in Dom0 assume that checksum is valid when the Tx mbuf has no offload flags - in that case either it's local packet where checksum has just been computed in software, or forwarded external packet already verified when received on Dom0 practical offshot of this is that DomU doesn't re-verify checksum of packets forwarded from external hosts, e.g. via bridge(4)
2020-03-16drop the disabled M_EXT_ROMAP mbuf code, convert xennet_checksum_fill()jdolecek
to use in_undefer_cksum() instead of custom code to compute the checksum for Rx packets, and set csum_data appropriately for eventual hw offloading make it possible to skip the sw checksum computation by appropriate Rx flag similarily as we do for Tx XXX for now, the Rx flag is mostly for testing as it only works for dom0<->domu, need some further network stack changes to arrange for the checksum to be eventually computed when packets goes outside xen
2019-12-23Provide XEN stubs for intr_mask() / intr_unmask().thorpej
2019-11-23cpu_need_resched():ad
- Remove all code that should be MI, leaving the bare minimum under arch/. - Make the required actions very explicit. - Pass in LWP pointer for convenience. - When a trap is required on another CPU, have the IPI set it locally. - Expunge cpu_did_resched().
2019-10-30Switch to new PTE bits.maxv