Changeset View
Changeset View
Standalone View
Standalone View
sys/amd64/vmm/vmm_dev.c
/*- | /*- | ||||
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD | * SPDX-License-Identifier: BSD-2-Clause-FreeBSD | ||||
* | * | ||||
* Copyright (c) 2011 NetApp, Inc. | * Copyright (c) 2011 NetApp, Inc. | ||||
* All rights reserved. | * All rights reserved. | ||||
* Copyright (c) 2022 The FreeBSD Foundation | |||||
* | * | ||||
* Portions of this software were developed by Ararat River | |||||
* Consulting, LLC under sponsorship of the FreeBSD Foundation. | |||||
* | |||||
* Redistribution and use in source and binary forms, with or without | * Redistribution and use in source and binary forms, with or without | ||||
* modification, are permitted provided that the following conditions | * modification, are permitted provided that the following conditions | ||||
* are met: | * are met: | ||||
* 1. Redistributions of source code must retain the above copyright | * 1. Redistributions of source code must retain the above copyright | ||||
* notice, this list of conditions and the following disclaimer. | * notice, this list of conditions and the following disclaimer. | ||||
* 2. Redistributions in binary form must reproduce the above copyright | * 2. Redistributions in binary form must reproduce the above copyright | ||||
* notice, this list of conditions and the following disclaimer in the | * notice, this list of conditions and the following disclaimer in the | ||||
* documentation and/or other materials provided with the distribution. | * documentation and/or other materials provided with the distribution. | ||||
▲ Show 20 Lines • Show All 365 Lines • ▼ Show 20 Lines | vmmdev_ioctl(struct cdev *cdev, u_long cmd, caddr_t data, int fflag, | ||||
struct vm_lapic_irq *vmirq; | struct vm_lapic_irq *vmirq; | ||||
struct vm_lapic_msi *vmmsi; | struct vm_lapic_msi *vmmsi; | ||||
struct vm_ioapic_irq *ioapic_irq; | struct vm_ioapic_irq *ioapic_irq; | ||||
struct vm_isa_irq *isa_irq; | struct vm_isa_irq *isa_irq; | ||||
struct vm_isa_irq_trigger *isa_irq_trigger; | struct vm_isa_irq_trigger *isa_irq_trigger; | ||||
struct vm_capability *vmcap; | struct vm_capability *vmcap; | ||||
struct vm_pptdev *pptdev; | struct vm_pptdev *pptdev; | ||||
struct vm_pptdev_mmio *pptmmio; | struct vm_pptdev_mmio *pptmmio; | ||||
struct vm_pptdev_mmio_bar *pptmmio_bar; | |||||
struct vm_pptdev_msi *pptmsi; | struct vm_pptdev_msi *pptmsi; | ||||
struct vm_pptdev_msix *pptmsix; | struct vm_pptdev_msix *pptmsix; | ||||
struct vm_nmi *vmnmi; | struct vm_nmi *vmnmi; | ||||
#ifdef COMPAT_FREEBSD13 | #ifdef COMPAT_FREEBSD13 | ||||
struct vm_stats_old *vmstats_old; | struct vm_stats_old *vmstats_old; | ||||
#endif | #endif | ||||
struct vm_stats *vmstats; | struct vm_stats *vmstats; | ||||
struct vm_stat_desc *statdesc; | struct vm_stat_desc *statdesc; | ||||
▲ Show 20 Lines • Show All 56 Lines • ▼ Show 20 Lines | case VM_RESTART_INSTRUCTION: | ||||
*/ | */ | ||||
vcpu = *(int *)data; | vcpu = *(int *)data; | ||||
error = vcpu_lock_one(sc, vcpu); | error = vcpu_lock_one(sc, vcpu); | ||||
if (error) | if (error) | ||||
goto done; | goto done; | ||||
state_changed = 1; | state_changed = 1; | ||||
break; | break; | ||||
#ifdef COMPAT_FREEBSD13 | |||||
case VM_MAP_PPTDEV_MMIO: | case VM_MAP_PPTDEV_MMIO: | ||||
#endif | |||||
case VM_MAP_PPTDEV_MMIO_BAR: | |||||
case VM_UNMAP_PPTDEV_MMIO: | case VM_UNMAP_PPTDEV_MMIO: | ||||
case VM_BIND_PPTDEV: | case VM_BIND_PPTDEV: | ||||
case VM_UNBIND_PPTDEV: | case VM_UNBIND_PPTDEV: | ||||
#ifdef COMPAT_FREEBSD12 | #ifdef COMPAT_FREEBSD12 | ||||
case VM_ALLOC_MEMSEG_FBSD12: | case VM_ALLOC_MEMSEG_FBSD12: | ||||
#endif | #endif | ||||
case VM_ALLOC_MEMSEG: | case VM_ALLOC_MEMSEG: | ||||
case VM_MMAP_MEMSEG: | case VM_MMAP_MEMSEG: | ||||
▲ Show 20 Lines • Show All 80 Lines • ▼ Show 20 Lines | error = ppt_setup_msix(sc->vm, pptmsix->vcpu, | ||||
pptmsix->addr, pptmsix->msg, | pptmsix->addr, pptmsix->msg, | ||||
pptmsix->vector_control); | pptmsix->vector_control); | ||||
break; | break; | ||||
case VM_PPTDEV_DISABLE_MSIX: | case VM_PPTDEV_DISABLE_MSIX: | ||||
pptdev = (struct vm_pptdev *)data; | pptdev = (struct vm_pptdev *)data; | ||||
error = ppt_disable_msix(sc->vm, pptdev->bus, pptdev->slot, | error = ppt_disable_msix(sc->vm, pptdev->bus, pptdev->slot, | ||||
pptdev->func); | pptdev->func); | ||||
break; | break; | ||||
#ifdef COMPAT_FREEBSD13 | |||||
case VM_MAP_PPTDEV_MMIO: | case VM_MAP_PPTDEV_MMIO: | ||||
pptmmio = (struct vm_pptdev_mmio *)data; | pptmmio = (struct vm_pptdev_mmio *)data; | ||||
error = ppt_map_mmio(sc->vm, pptmmio->bus, pptmmio->slot, | error = ppt_map_mmio(sc->vm, pptmmio->bus, pptmmio->slot, | ||||
pptmmio->func, pptmmio->gpa, pptmmio->len, | pptmmio->func, pptmmio->gpa, pptmmio->len, | ||||
pptmmio->hpa); | pptmmio->hpa); | ||||
break; | |||||
#endif | |||||
case VM_MAP_PPTDEV_MMIO_BAR: | |||||
pptmmio_bar = (struct vm_pptdev_mmio_bar *)data; | |||||
error = ppt_map_mmio_bar(sc->vm, pptmmio_bar->bus, | |||||
pptmmio_bar->slot, pptmmio_bar->func, | |||||
pptmmio_bar->gpa, pptmmio_bar->len, | |||||
pptmmio_bar->bar, pptmmio_bar->offset); | |||||
break; | break; | ||||
case VM_UNMAP_PPTDEV_MMIO: | case VM_UNMAP_PPTDEV_MMIO: | ||||
pptmmio = (struct vm_pptdev_mmio *)data; | pptmmio = (struct vm_pptdev_mmio *)data; | ||||
error = ppt_unmap_mmio(sc->vm, pptmmio->bus, pptmmio->slot, | error = ppt_unmap_mmio(sc->vm, pptmmio->bus, pptmmio->slot, | ||||
pptmmio->func, pptmmio->gpa, pptmmio->len); | pptmmio->func, pptmmio->gpa, pptmmio->len); | ||||
break; | break; | ||||
case VM_BIND_PPTDEV: | case VM_BIND_PPTDEV: | ||||
pptdev = (struct vm_pptdev *)data; | pptdev = (struct vm_pptdev *)data; | ||||
▲ Show 20 Lines • Show All 717 Lines • Show Last 20 Lines |