Date: Sun, 09 Aug 2026 11:32:08 +0000 From: Kevin Bowling <kbowling@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: da309ed47603 - main - pci_iov: Use native types for status ioctl Message-ID: <6a786538.3fd0f.151b0b3e@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch main has been updated by kbowling: URL: https://cgit.FreeBSD.org/src/commit/?id=da309ed47603a6b55ca75ef392a630c7ea46004f commit da309ed47603a6b55ca75ef392a630c7ea46004f Author: Kevin Bowling <kbowling@FreeBSD.org> AuthorDate: 2026-08-09 11:12:04 +0000 Commit: Kevin Bowling <kbowling@FreeBSD.org> CommitDate: 2026-08-09 11:26:58 +0000 pci_iov: Use native types for status ioctl IOV_CONFIG and IOV_GET_SCHEMA expose native pointers and size_t lengths, and pci_iov has no compat32 ioctl translation. Using fixed-width fields for IOV_GET_STATUS alone does not make the interface usable by 32-bit binaries on a 64-bit kernel. It instead complicates otherwise ordinary pointer and length handling. Use void * and size_t like the existing ioctls. This also makes the %zu diagnostic in iovctl correct on ILP32 and removes the unneeded PTRIN conversion. Fixes: 6f8b3be1fbd6 ("pci: Add SR-IOV status reporting") --- sys/dev/pci/pci_iov.c | 8 ++------ sys/sys/iov.h | 8 +++----- usr.sbin/iovctl/iovctl.c | 5 ++--- 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/sys/dev/pci/pci_iov.c b/sys/dev/pci/pci_iov.c index 00a9c8e8be72..545d91e372f4 100644 --- a/sys/dev/pci/pci_iov.c +++ b/sys/dev/pci/pci_iov.c @@ -27,7 +27,6 @@ #include <sys/cdefs.h> #include "opt_bus.h" -#include <sys/abi_compat.h> #include <sys/param.h> #include <sys/conf.h> #include <sys/kernel.h> @@ -1109,8 +1108,7 @@ pci_iov_get_schema_ioctl(struct cdev *cdev, struct pci_iov_schema *output) { struct pci_devinfo *dinfo; void *packed; - size_t size; - uint64_t output_len; + size_t output_len, size; int error; packed = NULL; @@ -1161,8 +1159,6 @@ pci_iov_get_status_ioctl(struct cdev *cdev, struct pci_iov_status *output) status = NULL; packed = NULL; - if (output->reserved != 0) - return (EINVAL); mtx_lock(&Giant); dinfo = cdev->si_drv1; error = pci_iov_build_status(dinfo, &status); @@ -1179,7 +1175,7 @@ pci_iov_get_status_ioctl(struct cdev *cdev, struct pci_iov_status *output) output_len = output->len; output->len = size; if (size <= output_len) { - error = copyout(packed, PTRIN(output->status), size); + error = copyout(packed, output->status, size); if (error != 0) goto out; output->error = 0; diff --git a/sys/sys/iov.h b/sys/sys/iov.h index 67a890bba66f..04545c99dec2 100644 --- a/sys/sys/iov.h +++ b/sys/sys/iov.h @@ -200,13 +200,11 @@ struct pci_iov_schema #define IOV_STATUS_BOUND_DRIVER_NAME "bound-driver" #define IOV_STATUS_PASSTHROUGH_NAME "passthrough" -/* Fixed-width fields keep the ioctl ABI identical for 32-bit callers. */ struct pci_iov_status { - uint64_t status; /* User pointer to the packed nvlist. */ - uint64_t len; - int32_t error; - uint32_t reserved; /* Must be zero. */ + void *status; /* Packed nvlist. */ + size_t len; + int error; }; /* diff --git a/usr.sbin/iovctl/iovctl.c b/usr.sbin/iovctl/iovctl.c index 8938607a61e5..735b30340903 100644 --- a/usr.sbin/iovctl/iovctl.c +++ b/usr.sbin/iovctl/iovctl.c @@ -100,15 +100,14 @@ get_status(int fd) buflen = 0; for (;;) { memset(&arg, 0, sizeof(arg)); - arg.status = (uintptr_t)buf; + arg.status = buf; arg.len = buflen; error = ioctl(fd, IOV_GET_STATUS, &arg); if (error != 0) err(1, "Could not fetch SR-IOV status"); if (arg.error == 0) break; - if (arg.error != EMSGSIZE || arg.len <= buflen || - arg.len > SIZE_MAX) { + if (arg.error != EMSGSIZE || arg.len <= buflen) { errno = arg.error; err(1, "Could not fetch SR-IOV status"); }home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6a786538.3fd0f.151b0b3e>
