diff --git a/src/iommu/dma.c b/src/iommu/dma.c index e5b2b488..4c2cb074 100644 --- a/src/iommu/dma.c +++ b/src/iommu/dma.c @@ -115,7 +115,7 @@ int _iommu_map_vaddr(struct iommu_ctx *ctx, void *vaddr, size_t len, uint64_t *i if (flags & IOMMU_MAP_FIXED_IOVA) { _iova = *iova; } else if (ctx->ops.iova_reserve && ctx->ops.iova_reserve(ctx, len, &_iova, flags)) { - log_debug("failed to allocate iova\n"); + log_error("failed to allocate iova\n"); return -1; } @@ -169,7 +169,7 @@ int iommu_unmap_vaddr(struct iommu_ctx *ctx, void *vaddr, size_t *len) *len = m->len; if (ctx->ops.dma_unmap(ctx, m)) { - log_debug("failed to unmap dma\n"); + log_error("failed to unmap dma\n"); return -1; } @@ -196,7 +196,7 @@ int iommu_unmap_all(struct iommu_ctx *ctx) { if (ctx->ops.dma_unmap_all) { if (ctx->ops.dma_unmap_all(ctx)) { - log_debug("failed to unmap dma\n"); + log_error("failed to unmap dma\n"); return -1; } diff --git a/src/iommu/iommufd.c b/src/iommu/iommufd.c index 54ff0ea7..7582a5a6 100644 --- a/src/iommu/iommufd.c +++ b/src/iommu/iommufd.c @@ -53,7 +53,7 @@ static int iommu_ioas_update_iova_ranges(struct iommu_ioas *ioas) if (ioctl(__iommufd, IOMMU_IOAS_IOVA_RANGES, &iova_ranges)) { if (errno != EMSGSIZE) { - log_debug("could not get ioas iova ranges\n"); + log_error("could not get ioas iova ranges\n"); return -1; } @@ -64,7 +64,7 @@ static int iommu_ioas_update_iova_ranges(struct iommu_ioas *ioas) iova_ranges.allowed_iovas = (uintptr_t)ioas->ctx.iova_ranges; if (ioctl(__iommufd, IOMMU_IOAS_IOVA_RANGES, &iova_ranges)) { - log_debug("could not get ioas iova ranges\n"); + log_error("could not get ioas iova ranges\n"); return -1; } } @@ -106,33 +106,33 @@ static int iommufd_get_device_fd(struct iommu_ctx *ctx, const char *bdf) vfio_id = pci_get_device_vfio_id(bdf); if (!vfio_id) { - log_debug("could not determine the vfio device id for %s\n", bdf); + log_error("could not determine the vfio device id for %s\n", bdf); return -1; } if (asprintf(&path, "/dev/vfio/devices/%s", vfio_id) < 0) { - log_debug("asprintf failed\n"); + log_error("asprintf failed\n"); return -1; } devfd = open(path, O_RDWR); if (devfd < 0) { - log_debug("could not open the device cdev\n"); + log_error("could not open the device cdev\n"); return -1; } if (ioctl(devfd, VFIO_DEVICE_BIND_IOMMUFD, &bind)) { - log_debug("could not bind device to iommufd\n"); + log_error("could not bind device to iommufd\n"); goto close_dev; } if (ioctl(devfd, VFIO_DEVICE_ATTACH_IOMMUFD_PT, &attach_data)) { - log_debug("could not associate device with ioas\n"); + log_error("could not associate device with ioas\n"); goto close_dev; } if (iommu_ioas_update_iova_ranges(ioas)) { - log_debug("could not update iova ranges\n"); + log_error("could not update iova ranges\n"); goto close_dev; } @@ -177,7 +177,7 @@ static int iommu_ioas_do_dma_map(struct iommu_ctx *ctx, struct iova_mapping *m) } if (ioctl(__iommufd, IOMMU_IOAS_MAP, &map)) { - log_debug("failed to map\n"); + log_error("failed to map\n"); return -1; } @@ -211,7 +211,7 @@ static int iommu_ioas_do_dma_unmap(struct iommu_ctx *ctx, struct iova_mapping *m } if (ioctl(__iommufd, IOMMU_IOAS_UNMAP, &unmap)) { - log_debug("failed to unmap\n"); + log_error("failed to unmap\n"); return -1; } @@ -243,7 +243,7 @@ static int iommu_ioas_init(struct iommu_ioas *ioas) }; if (ioctl(__iommufd, IOMMU_IOAS_ALLOC, &alloc_data)) { - log_debug("could not allocate ioas\n"); + log_error("could not allocate ioas\n"); return -1; } diff --git a/src/iommu/vfio.c b/src/iommu/vfio.c index f8a53a9c..731a8220 100644 --- a/src/iommu/vfio.c +++ b/src/iommu/vfio.c @@ -203,7 +203,7 @@ static int vfio_iommu_type1_iova_reserve(struct iommu_ctx *ctx, size_t len, uint __autolock(&vfio->lock); if (!ALIGNED(len, __VFN_PAGESIZE)) { - log_debug("len is not page aligned\n"); + log_error("len is not page aligned\n"); errno = EINVAL; return -1; } @@ -233,7 +233,7 @@ static int vfio_iommu_type1_init(struct vfio_container *vfio) return 0; if (ioctl(vfio->fd, VFIO_SET_IOMMU, VFIO_TYPE1_IOMMU)) { - log_debug("failed to set vfio iommu type\n"); + log_error("failed to set vfio iommu type\n"); return -1; } @@ -241,13 +241,13 @@ static int vfio_iommu_type1_init(struct vfio_container *vfio) #ifdef VFIO_IOMMU_INFO_CAPS if (vfio_iommu_type1_get_capabilities(vfio)) { - log_debug("failed to get iommu capabilities\n"); + log_error("failed to get iommu capabilities\n"); return -1; } #endif if (vfio_iommu_type1_iova_reserve(&vfio->ctx, VFIO_IOMMU_TYPE1_IOVA_RESERVED, &iova, 0x0)) { - log_debug("could not reserve iova range\n"); + log_error("could not reserve iova range\n"); return -1; } @@ -271,12 +271,12 @@ static int vfio_group_set_container(struct vfio_group *group, struct vfio_contai log_info("adding group '%s' to container\n", group->path); if (ioctl(group->fd, VFIO_GROUP_SET_CONTAINER, &vfio->fd)) { - log_debug("failed to add group to vfio container\n"); + log_error("failed to add group to vfio container\n"); return -1; } if (vfio_iommu_type1_init(vfio)) { - log_debug("failed to configure iommu\n"); + log_error("failed to configure iommu\n"); log_fatal_if(ioctl(group->fd, VFIO_GROUP_UNSET_CONTAINER), "unset container\n"); @@ -296,18 +296,18 @@ static int vfio_group_open(const char *path) fd = open(path, O_RDWR); if (fd < 0) { - log_debug("failed to open vfio group file: %s\n", strerror(errno)); + log_error("failed to open vfio group file: %s\n", strerror(errno)); return -1; } if (ioctl(fd, VFIO_GROUP_GET_STATUS, &group_status)) { - log_debug("failed to get vfio group status\n"); + log_error("failed to get vfio group status\n"); goto close_fd; } if (!(group_status.flags & VFIO_GROUP_FLAGS_VIABLE)) { errno = EINVAL; - log_debug("vfio group is not viable\n"); + log_error("vfio group is not viable\n"); goto close_fd; } @@ -349,7 +349,7 @@ static int vfio_get_group_fd(struct vfio_container *vfio, const char *path) group->fd = vfio_group_open(group->path); if (group->fd < 0) { - log_debug("failed to open vfio group\n"); + log_error("failed to open vfio group\n"); goto free_group_path; } @@ -375,7 +375,7 @@ static int vfio_get_device_fd(struct iommu_ctx *ctx, const char *bdf) group = pci_get_iommu_group(bdf); if (!group) { - log_debug("could not determine iommu group for device %s\n", bdf); + log_error("could not determine iommu group for device %s\n", bdf); errno = EINVAL; return -1; } @@ -387,7 +387,7 @@ static int vfio_get_device_fd(struct iommu_ctx *ctx, const char *bdf) ret_fd = ioctl(gfd, VFIO_GROUP_GET_DEVICE_FD, bdf); if (ret_fd < 0) { - log_debug("failed to get device fd\n"); + log_error("failed to get device fd\n"); return -1; } @@ -417,13 +417,13 @@ static int vfio_iommu_type1_do_dma_map(struct iommu_ctx *ctx, struct iova_mappin } if (!ALIGNED(((uintptr_t)m->vaddr | m->len | m->iova), __VFN_PAGESIZE)) { - log_debug("vaddr, len or iova not page aligned\n"); + log_error("vaddr, len or iova not page aligned\n"); errno = EINVAL; return -1; } if (ioctl(vfio->fd, VFIO_IOMMU_MAP_DMA, &dma_map)) { - log_debug("could not map\n"); + log_error("could not map\n"); return -1; } @@ -447,7 +447,7 @@ static int vfio_iommu_type1_do_dma_unmap(struct iommu_ctx *ctx, struct iova_mapp } if (ioctl(vfio->fd, VFIO_IOMMU_UNMAP_DMA, &dma_unmap)) { - log_debug("could not unmap\n"); + log_error("could not unmap\n"); return -1; } @@ -485,7 +485,7 @@ static int vfio_iommu_type1_do_dma_unmap_all(struct iommu_ctx *ctx) }; if (ioctl(vfio->fd, VFIO_IOMMU_UNMAP_DMA, &dma_unmap)) { - log_debug("failed to unmap dma\n"); + log_error("failed to unmap dma\n"); return -1; } @@ -510,17 +510,17 @@ static int vfio_init_container(struct vfio_container *vfio) { vfio->fd = open("/dev/vfio/vfio", O_RDWR); if (vfio->fd < 0) { - log_debug("failed to open vfio device\n"); + log_error("failed to open vfio device\n"); return -1; } if (ioctl(vfio->fd, VFIO_GET_API_VERSION) != VFIO_API_VERSION) { - log_debug("invalid vfio version\n"); + log_error("invalid vfio version\n"); return -1; } if (!ioctl(vfio->fd, VFIO_CHECK_EXTENSION, VFIO_TYPE1_IOMMU)) { - log_debug("vfio type 1 iommu not supported\n"); + log_error("vfio type 1 iommu not supported\n"); return -1; } diff --git a/src/nvme/core.c b/src/nvme/core.c index 1a6091dd..d5431895 100644 --- a/src/nvme/core.c +++ b/src/nvme/core.c @@ -82,14 +82,14 @@ static int nvme_configure_cq(struct nvme_ctrl *ctrl, int qid, int qsize, int vec dstrd = NVME_FIELD_GET(cap, CAP_DSTRD); if (qid && qid > ctrl->config.ncqa + 1) { - log_debug("qid %d invalid; max qid is %d\n", qid, ctrl->config.ncqa + 1); + log_error("qid %d invalid; max qid is %d\n", qid, ctrl->config.ncqa + 1); errno = EINVAL; return -1; } if (qsize < 2) { - log_debug("qsize must be at least 2\n"); + log_error("qsize must be at least 2\n"); errno = EINVAL; return -1; } @@ -113,7 +113,7 @@ static int nvme_configure_cq(struct nvme_ctrl *ctrl, int qid, int qsize, int vec len = __pgmapn(&cq->vaddr, qsize, 1 << NVME_CQES, &opaque); if (_iommu_map_vaddr(__iommu_ctx(ctrl), cq->vaddr, len, &cq->iova, 0x0, opaque)) { - log_debug("failed to map vaddr\n"); + log_error("failed to map vaddr\n"); __pgunmap(cq->vaddr, len, opaque); return -1; @@ -130,7 +130,7 @@ static void nvme_discard_cq(struct nvme_ctrl *ctrl, struct nvme_cq *cq) return; if (iommu_unmap_vaddr(__iommu_ctx(ctrl), cq->vaddr, &len)) - log_debug("failed to unmap vaddr\n"); + log_error("failed to unmap vaddr\n"); __pgunmap(cq->vaddr, len, cq->vaddr_opaque); @@ -154,14 +154,14 @@ static int nvme_configure_sq(struct nvme_ctrl *ctrl, int qid, int qsize, dstrd = NVME_FIELD_GET(cap, CAP_DSTRD); if (qid && qid > ctrl->config.nsqa + 1) { - log_debug("qid %d invalid; max qid is %d\n", qid, ctrl->config.nsqa + 1); + log_error("qid %d invalid; max qid is %d\n", qid, ctrl->config.nsqa + 1); errno = EINVAL; return -1; } if (qsize < 2) { - log_debug("qsize must be at least 2\n"); + log_error("qsize must be at least 2\n"); errno = EINVAL; return -1; } @@ -194,7 +194,7 @@ static int nvme_configure_sq(struct nvme_ctrl *ctrl, int qid, int qsize, if (_iommu_map_vaddr(__iommu_ctx(ctrl), sq->pages.vaddr, len, &sq->pages.iova, 0x0, sq->pages.vaddr_opaque)) { - log_debug("failed to map vaddr\n"); + log_error("failed to map vaddr\n"); goto unmap_pages; } @@ -221,7 +221,7 @@ static int nvme_configure_sq(struct nvme_ctrl *ctrl, int qid, int qsize, goto free_sq_rqs; if (_iommu_map_vaddr(__iommu_ctx(ctrl), sq->vaddr, len, &sq->iova, 0x0, sq->vaddr_opaque)) { - log_debug("failed to map vaddr\n"); + log_error("failed to map vaddr\n"); goto unmap_sq; } @@ -233,7 +233,7 @@ static int nvme_configure_sq(struct nvme_ctrl *ctrl, int qid, int qsize, free(sq->rqs); unmap_pages: if (iommu_unmap_vaddr(__iommu_ctx(ctrl), sq->pages.vaddr, (size_t *)&len)) - log_debug("failed to unmap vaddr\n"); + log_error("failed to unmap vaddr\n"); __pgunmap(sq->pages.vaddr, len, sq->pages.vaddr_opaque); @@ -275,12 +275,12 @@ static int nvme_configure_adminq(struct nvme_ctrl *ctrl, unsigned long sq_flags) struct nvme_sq *sq = &ctrl->sq[NVME_AQ]; if (nvme_configure_cq(ctrl, NVME_AQ, NVME_AQ_QSIZE, 0)) { - log_debug("failed to configure admin completion queue\n"); + log_error("failed to configure admin completion queue\n"); return -1; } if (nvme_configure_sq(ctrl, NVME_AQ, NVME_AQ_QSIZE, cq, sq_flags)) { - log_debug("failed to configure admin submission queue\n"); + log_error("failed to configure admin submission queue\n"); goto discard_cq; } @@ -315,7 +315,7 @@ int nvme_create_iocq(struct nvme_ctrl *ctrl, int qid, int qsize, int vector) uint16_t iv = 0; if (nvme_configure_cq(ctrl, qid, qsize, vector)) { - log_debug("could not configure io completion queue\n"); + log_error("could not configure io completion queue\n"); return -1; } @@ -357,7 +357,7 @@ int nvme_create_iosq(struct nvme_ctrl *ctrl, int qid, int qsize, struct nvme_cq union nvme_cmd cmd; if (nvme_configure_sq(ctrl, qid, qsize, cq, flags)) { - log_debug("could not configure io submission queue\n"); + log_error("could not configure io submission queue\n"); return -1; } @@ -390,12 +390,12 @@ int nvme_delete_iosq(struct nvme_ctrl *ctrl, int qid) int nvme_create_ioqpair(struct nvme_ctrl *ctrl, int qid, int qsize, int vector, unsigned long flags) { if (nvme_create_iocq(ctrl, qid, qsize, vector)) { - log_debug("could not create io completion queue\n"); + log_error("could not create io completion queue\n"); return -1; } if (nvme_create_iosq(ctrl, qid, qsize, &ctrl->cq[qid], flags)) { - log_debug("could not create io submission queue\n"); + log_error("could not create io submission queue\n"); return -1; } @@ -405,12 +405,12 @@ int nvme_create_ioqpair(struct nvme_ctrl *ctrl, int qid, int qsize, int vector, int nvme_delete_ioqpair(struct nvme_ctrl *ctrl, int qid) { if (nvme_delete_iosq(ctrl, qid)) { - log_debug("could not delete io submission queue\n"); + log_error("could not delete io submission queue\n"); return -1; } if (nvme_delete_iocq(ctrl, qid)) { - log_debug("could not delete io completion queue\n"); + log_error("could not delete io completion queue\n"); return -1; } @@ -436,7 +436,7 @@ static int nvme_wait_rdy(struct nvme_ctrl *ctrl, unsigned short rdy) do { if ((uint64_t)_time_ns > deadline_ns) { - log_debug("timed out\n"); + log_error("timed out\n"); errno = ETIMEDOUT; return -1; @@ -553,14 +553,14 @@ int nvme_init(struct nvme_ctrl *ctrl, const char *bdf, const struct nvme_ctrl_op memcpy(&ctrl->opts, &nvme_ctrl_opts_default, sizeof(*opts)); if (pci_device_info_get_ull(bdf, "class", &classcode)) { - log_debug("could not get device class code\n"); + log_error("could not get device class code\n"); return -1; } log_info("pci class code is 0x%06llx\n", classcode); if ((classcode & 0xffff00) != 0x010800) { - log_debug("%s is not an NVMe device\n", bdf); + log_error("%s is not an NVMe device\n", bdf); errno = EINVAL; return -1; } @@ -573,7 +573,7 @@ int nvme_init(struct nvme_ctrl *ctrl, const char *bdf, const struct nvme_ctrl_op ctrl->regs = vfio_pci_map_bar(&ctrl->pci, 0, 0x1000, 0, PROT_READ | PROT_WRITE); if (!ctrl->regs) { - log_debug("could not map controller registersn\n"); + log_error("could not map controller registersn\n"); return -1; } @@ -595,14 +595,14 @@ int nvme_init(struct nvme_ctrl *ctrl, const char *bdf, const struct nvme_ctrl_op ctrl->config.mqes = NVME_FIELD_GET(cap, CAP_MQES); if (nvme_reset(ctrl)) { - log_debug("could not reset controller\n"); + log_error("could not reset controller\n"); return -1; } /* map admin queue doorbells */ ctrl->doorbells = vfio_pci_map_bar(&ctrl->pci, 0, 0x1000, 0x1000, PROT_WRITE); if (!ctrl->doorbells) { - log_debug("could not map doorbells\n"); + log_error("could not map doorbells\n"); return -1; } @@ -611,12 +611,12 @@ int nvme_init(struct nvme_ctrl *ctrl, const char *bdf, const struct nvme_ctrl_op ctrl->cq = znew_t(struct nvme_cq, ctrl->opts.ncqr + 2); if (nvme_configure_adminq(ctrl, 0x0)) { - log_debug("could not configure admin queue\n"); + log_error("could not configure admin queue\n"); return -1; } if (nvme_enable(ctrl)) { - log_debug("could not enable controller\n"); + log_error("could not enable controller\n"); return -1; } @@ -633,7 +633,7 @@ int nvme_init(struct nvme_ctrl *ctrl, const char *bdf, const struct nvme_ctrl_op NVME_FIELD_SET(ctrl->opts.ncqr, FEAT_NRQS_NCQR)); if (nvme_admin(ctrl, &cmd, NULL, 0, &cqe)) { - log_debug("could not set number of queues\n"); + log_error("could not set number of queues\n"); return -1; } @@ -658,7 +658,7 @@ int nvme_init(struct nvme_ctrl *ctrl, const char *bdf, const struct nvme_ctrl_op ret = nvme_admin(ctrl, &cmd, vaddr, len, NULL); if (ret) { - log_debug("could not identify\n"); + log_error("could not identify\n"); goto out; } diff --git a/src/nvme/util.c b/src/nvme/util.c index 9d9ca5e9..8db5eb90 100644 --- a/src/nvme/util.c +++ b/src/nvme/util.c @@ -70,7 +70,7 @@ int nvme_sync(struct nvme_ctrl *ctrl, struct nvme_sq *sq, union nvme_cmd *sqe, v do_unmap = true; if (_iommu_map_vaddr(ctx, buf, len, &iova, IOMMU_MAP_EPHEMERAL, opaque)) { - log_debug("failed to map vaddr\n"); + log_error("failed to map vaddr\n"); return -1; } } diff --git a/src/pci/util.c b/src/pci/util.c index fcef5cc0..e340fe7b 100644 --- a/src/pci/util.c +++ b/src/pci/util.c @@ -45,7 +45,7 @@ int pci_unbind(const char *bdf) ssize_t ret; if (asprintf(&path, "/sys/bus/pci/devices/%s/driver/unbind", bdf) < 0) { - log_debug("asprintf failed\n"); + log_error("asprintf failed\n"); return -1; } @@ -67,7 +67,7 @@ int pci_bind(const char *bdf, const char *driver) ssize_t ret; if (asprintf(&path, "/sys/bus/pci/drivers/%s/bind", driver) < 0) { - log_debug("asprintf failed\n"); + log_error("asprintf failed\n"); return -1; } @@ -85,12 +85,12 @@ int pci_driver_new_id(const char *driver, uint16_t vid, uint16_t did) ssize_t ret; if (asprintf(&path, "/sys/bus/pci/drivers/%s/new_id", driver) < 0) { - log_debug("asprintf failed\n"); + log_error("asprintf failed\n"); return -1; } if (asprintf(&id, "%x %x", vid, did) < 0) { - log_debug("asprintf failed\n"); + log_error("asprintf failed\n"); free(path); return -1; } @@ -110,12 +110,12 @@ int pci_driver_remove_id(const char *driver, uint16_t vid, uint16_t did) ssize_t ret; if (asprintf(&path, "/sys/bus/pci/drivers/%s/remove_id", driver) < 0) { - log_debug("asprintf failed\n"); + log_error("asprintf failed\n"); return -1; } if (asprintf(&id, "%x %x", vid, did) < 0) { - log_debug("asprintf failed\n"); + log_error("asprintf failed\n"); free(path); return -1; } @@ -134,7 +134,7 @@ int pci_device_info_get_ull(const char *bdf, const char *prop, unsigned long lon ssize_t ret; if (asprintf(&path, "/sys/bus/pci/devices/%s/%s", bdf, prop) < 0) { - log_debug("asprintf failed\n"); + log_error("asprintf failed\n"); return -1; } @@ -162,7 +162,7 @@ char *pci_get_driver(const char *bdf) if (asprintf(&link, "/sys/bus/pci/devices/%s/driver", bdf) < 0) { link = NULL; - log_debug("asprintf failed\n"); + log_error("asprintf failed\n"); goto out; } @@ -173,7 +173,7 @@ char *pci_get_driver(const char *bdf) if (errno == ENOENT) goto out; - log_debug("failed to resolve driver link\n"); + log_error("failed to resolve driver link\n"); goto out; } @@ -181,13 +181,13 @@ char *pci_get_driver(const char *bdf) p = strrchr(driver, '/'); if (!p) { - log_debug("failed to determine driver name\n"); + log_error("failed to determine driver name\n"); goto out; } if (asprintf(&name, "%s", p + 1) < 0) { name = NULL; - log_debug("asprintf failed\n"); + log_error("asprintf failed\n"); goto out; } @@ -204,7 +204,7 @@ char *pci_get_iommu_group(const char *bdf) ssize_t ret; if (asprintf(&link, "/sys/bus/pci/devices/%s/iommu_group", bdf) < 0) { - log_debug("asprintf failed\n"); + log_error("asprintf failed\n"); goto out; } @@ -212,7 +212,7 @@ char *pci_get_iommu_group(const char *bdf) ret = readlink(link, group, PATH_MAX - 1); if (ret < 0) { - log_debug("failed to resolve iommu group link\n"); + log_error("failed to resolve iommu group link\n"); goto out; } @@ -220,7 +220,7 @@ char *pci_get_iommu_group(const char *bdf) p = strrchr(group, '/'); if (!p) { - log_debug("failed to find iommu group number\n"); + log_error("failed to find iommu group number\n"); goto out; } @@ -244,13 +244,13 @@ char *pci_get_device_vfio_id(const char *bdf) DIR *dp; if (asprintf(&path, "/sys/bus/pci/devices/%s/vfio-dev", bdf) < 0) { - log_debug("asprintf failed\n"); + log_error("asprintf failed\n"); return NULL; } dp = opendir(path); if (!dp) { - log_debug("could not open directory; is %s bound to vfio-pci?\n", bdf); + log_error("could not open directory; is %s bound to vfio-pci?\n", bdf); return NULL; } diff --git a/src/vfio/device.c b/src/vfio/device.c index fa8206b0..d02a73fd 100644 --- a/src/vfio/device.c +++ b/src/vfio/device.c @@ -32,7 +32,7 @@ int vfio_set_irq(struct vfio_device *dev, int *eventfds, int count) if (!(dev->irq_info.flags & VFIO_IRQ_INFO_EVENTFD)) { errno = EINVAL; - log_debug("device irq does not support eventfd\n"); + log_error("device irq does not support eventfd\n"); return -1; } @@ -53,7 +53,7 @@ int vfio_set_irq(struct vfio_device *dev, int *eventfds, int count) free(irq_set); if (ret) { - log_debug("failed to set device irq\n"); + log_error("failed to set device irq\n"); return -1; } @@ -74,7 +74,7 @@ int vfio_disable_irq(struct vfio_device *dev) ret = ioctl(dev->fd, VFIO_DEVICE_SET_IRQS, &irq_set); if (ret) { - log_debug("failed to disable device irq\n"); + log_error("failed to disable device irq\n"); return -1; } diff --git a/src/vfio/pci.c b/src/vfio/pci.c index 72f674b4..0eb1bdd8 100644 --- a/src/vfio/pci.c +++ b/src/vfio/pci.c @@ -34,14 +34,14 @@ static int pci_set_bus_master(struct vfio_pci_device *pci) uint16_t pci_cmd; if (vfio_pci_read_config(pci, &pci_cmd, sizeof(pci_cmd), PCI_COMMAND) < 0) { - log_debug("failed to read pci config region\n"); + log_error("failed to read pci config region\n"); return -1; } pci_cmd |= PCI_COMMAND_MASTER; if (vfio_pci_write_config(pci, &pci_cmd, sizeof(pci_cmd), PCI_COMMAND) < 0) { - log_debug("failed to write pci config region\n"); + log_error("failed to write pci config region\n"); return -1; } @@ -58,7 +58,7 @@ static int vfio_pci_init_bar(struct vfio_pci_device *pci, int idx) }; if (ioctl(pci->dev.fd, VFIO_DEVICE_GET_REGION_INFO, &pci->bar_region_info[idx])) { - log_debug("failed to get bar region info\n"); + log_error("failed to get bar region info\n"); return -1; } @@ -76,14 +76,14 @@ static int vfio_pci_init_irq(struct vfio_pci_device *pci) do { if (irq_index < 0) { errno = EINVAL; - log_debug("no supported irq types\n"); + log_error("no supported irq types\n"); return -1; } pci->dev.irq_info.index = irq_index--; if (ioctl(pci->dev.fd, VFIO_DEVICE_GET_IRQ_INFO, &pci->dev.irq_info)) { - log_debug("failed to get device irq info\n"); + log_error("failed to get device irq info\n"); return -1; } } while (!pci->dev.irq_info.count); @@ -132,14 +132,14 @@ int vfio_pci_open(struct vfio_pci_device *pci, const char *bdf) pci->dev.fd = pci->dev.ctx->ops.get_device_fd(pci->dev.ctx, bdf); if (pci->dev.fd < 0) { - log_debug("failed to get device fd\n"); + log_error("failed to get device fd\n"); return -1; } pci->dev.device_info.argsz = sizeof(struct vfio_device_info); if (ioctl(pci->dev.fd, VFIO_DEVICE_GET_INFO, &pci->dev.device_info)) { - log_debug("failed to get device info\n"); + log_error("failed to get device info\n"); return -1; } @@ -151,7 +151,7 @@ int vfio_pci_open(struct vfio_pci_device *pci, const char *bdf) }; if (ioctl(pci->dev.fd, VFIO_DEVICE_GET_REGION_INFO, &pci->config_region_info)) { - log_debug("failed to get config region info\n"); + log_error("failed to get config region info\n"); return -1; } @@ -161,12 +161,12 @@ int vfio_pci_open(struct vfio_pci_device *pci, const char *bdf) } if (pci_set_bus_master(pci)) { - log_debug("failed to set pci bus master\n"); + log_error("failed to set pci bus master\n"); return -1; } if (vfio_pci_init_irq(pci)) { - log_debug("failed to initialize irq\n"); + log_error("failed to initialize irq\n"); return -1; }