github.com/metacubex/gvisor@v0.0.0-20240320004321-933faba989ec/pkg/abi/linux/vfio.go (about)

     1  // Copyright 2024 The gVisor Authors.
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //     http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  // The package implements VFIOuserspace driver interface.
    16  
    17  package linux
    18  
    19  // For IOCTLs requests from include/uapi/linux/vfio.h.
    20  const (
    21  	VFIO_TYPE = ';'
    22  	VFIO_BASE = 100
    23  
    24  	// VFIO extensions.
    25  	VFIO_TYPE1_IOMMU     = 1
    26  	VFIO_SPAPR_TCE_IOMMU = 2
    27  	VFIO_TYPE1v2_IOMMU   = 3
    28  )
    29  
    30  // IOCTLs for VFIO file descriptor from include/uapi/linux/vfio.h.
    31  var (
    32  	VFIO_CHECK_EXTENSION     = IO(VFIO_TYPE, VFIO_BASE+1)
    33  	VFIO_SET_IOMMU           = IO(VFIO_TYPE, VFIO_BASE+2)
    34  	VFIO_GROUP_SET_CONTAINER = IO(VFIO_TYPE, VFIO_BASE+4)
    35  )