# zx_bti_create

## Summary

Create a new bus transaction initiator.

## Declaration

    #include <zircon/syscalls.h>

    zx_status_t zx_bti_create(zx_handle_t iommu,
                              uint32_t options,
                              uint64_t bti_id,
                              zx_handle_t* out);

## Description

`zx_bti_create()` creates a new [bus transaction initiator](https://fuchsia.dev/docs/reference/kernel_objects/bus_transaction_initiator)
given a handle to an IOMMU and a hardware transaction identifier for a device
downstream of that IOMMU.

*options* must be 0 (reserved for future definition of creation flags).

Upon success a handle for the new BTI is returned. This handle will have rights
`ZX_RIGHT_READ`, `ZX_RIGHT_WRITE`, `ZX_RIGHT_MAP`, `ZX_RIGHT_INSPECT`,
`ZX_RIGHT_DUPLICATE`, and `ZX_RIGHT_TRANSFER`.

## Rights

*iommu* must be of type `ZX_OBJ_TYPE_IOMMU` and have `ZX_RIGHT_NONE`.

## Return value

`zx_bti_create()` returns `ZX_OK` and a handle to the new BTI
(via *out*) on success. In the event of failure, a negative error value
is returned.

## Errors

`ZX_ERR_BAD_HANDLE` *iommu* is not a valid handle.

`ZX_ERR_WRONG_TYPE` *iommu* is not an iommu handle.

`ZX_ERR_ACCESS_DENIED` *iommu* handle does not have sufficient privileges.

`ZX_ERR_INVALID_ARGS` *bti_id* is invalid on the given IOMMU,
*out* is an invalid pointer, or *options* is non-zero.

`ZX_ERR_NO_MEMORY` Failure due to lack of memory.
There is no good way for userspace to handle this (unlikely) error.
In a future build this error will no longer occur.

## See also

- [`zx_bti_pin()`](https://fuchsia.dev/reference/syscalls/bti_pin)
- [`zx_bti_release_quarantine()`](https://fuchsia.dev/reference/syscalls/bti_release_quarantine)
- [`zx_pmt_unpin()`](https://fuchsia.dev/reference/syscalls/pmt_unpin)