Skip to content

Commit cebcffe

Browse files
committed
Merge tag 'vfio-v7.0-rc1' of https://github.com/awilliam/linux-vfio
Pull VFIO updates from Alex Williamson: "A small cycle with the bulk in selftests and reintroducing poison handling in the nvgrace-gpu driver. The rest are fixes, cleanups, and some dmabuf structure consolidation. - Update outdated mdev comment referencing the renamed mdev_type_add() function (Julia Lawall) - Introduce selftest support for IOMMU mapping of PCI MMIO BARs (Alex Mastro) - Relax selftest assertion relative to differences in huge page handling between legacy (v1) TYPE1 IOMMU mapping behavior and the compatibility mode supported by IOMMUFD (David Matlack) - Reintroduce memory poison handling support for non-struct-page- backed memory in the nvgrace-gpu variant driver (Ankit Agrawal) - Replace dma_buf_phys_vec with phys_vec to avoid duplicate structure and semantics (Leon Romanovsky) - Add missing upstream bridge locking across PCI function reset, resolving an assertion failure when secondary bus reset is used to provide that reset (Anthony Pighin) - Fixes to hisi_acc vfio-pci variant driver to resolve corner case issues related to resets, repeated migration, and error injection scenarios (Longfang Liu, Weili Qian) - Restrict vfio selftest builds to arm64 and x86_64, resolving compiler warnings on 32-bit archs (Ted Logan) - Un-deprecate the fsl-mc vfio bus driver as a new maintainer has stepped up (Ioana Ciornei)" * tag 'vfio-v7.0-rc1' of https://github.com/awilliam/linux-vfio: vfio/fsl-mc: add myself as maintainer vfio: selftests: only build tests on arm64 and x86_64 hisi_acc_vfio_pci: fix the queue parameter anomaly issue hisi_acc_vfio_pci: resolve duplicate migration states hisi_acc_vfio_pci: update status after RAS error hisi_acc_vfio_pci: fix VF reset timeout issue vfio/pci: Lock upstream bridge for vfio_pci_core_disable() types: reuse common phys_vec type instead of DMABUF open‑coded variant vfio/nvgrace-gpu: register device memory for poison handling mm: add stubs for PFNMAP memory failure registration functions vfio: selftests: Drop IOMMU mapping size assertions for VFIO_TYPE1_IOMMU vfio: selftests: Add vfio_dma_mapping_mmio_test vfio: selftests: Align BAR mmaps for efficient IOMMU mapping vfio: selftests: Centralize IOMMU mode name definitions vfio/mdev: update outdated comment
2 parents d4a379a + 96ca4ca commit cebcffe

26 files changed

Lines changed: 411 additions & 67 deletions

MAINTAINERS

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27606,8 +27606,9 @@ F: include/uapi/linux/vfio.h
2760627606
F: tools/testing/selftests/vfio/
2760727607

2760827608
VFIO FSL-MC DRIVER
27609+
M: Ioana Ciornei <ioana.ciornei@nxp.com>
2760927610
L: kvm@vger.kernel.org
27610-
S: Obsolete
27611+
S: Maintained
2761127612
F: drivers/vfio/fsl-mc/
2761227613

2761327614
VFIO HISILICON PCI DRIVER

drivers/dma-buf/dma-buf-mapping.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ static struct scatterlist *fill_sg_entry(struct scatterlist *sgl, size_t length,
3333
}
3434

3535
static unsigned int calc_sg_nents(struct dma_iova_state *state,
36-
struct dma_buf_phys_vec *phys_vec,
37-
size_t nr_ranges, size_t size)
36+
struct phys_vec *phys_vec, size_t nr_ranges,
37+
size_t size)
3838
{
3939
unsigned int nents = 0;
4040
size_t i;
@@ -91,7 +91,7 @@ struct dma_buf_dma {
9191
*/
9292
struct sg_table *dma_buf_phys_vec_to_sgt(struct dma_buf_attachment *attach,
9393
struct p2pdma_provider *provider,
94-
struct dma_buf_phys_vec *phys_vec,
94+
struct phys_vec *phys_vec,
9595
size_t nr_ranges, size_t size,
9696
enum dma_data_direction dir)
9797
{

drivers/iommu/iommufd/io_pagetable.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ struct iopt_pages_dmabuf_track {
202202

203203
struct iopt_pages_dmabuf {
204204
struct dma_buf_attachment *attach;
205-
struct dma_buf_phys_vec phys;
205+
struct phys_vec phys;
206206
/* Always PAGE_SIZE aligned */
207207
unsigned long start;
208208
struct list_head tracker;

drivers/iommu/iommufd/iommufd_private.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ struct iommu_group;
2020
struct iommu_option;
2121
struct iommufd_device;
2222
struct dma_buf_attachment;
23-
struct dma_buf_phys_vec;
2423

2524
struct iommufd_sw_msi_map {
2625
struct list_head sw_msi_item;
@@ -718,7 +717,7 @@ int __init iommufd_test_init(void);
718717
void iommufd_test_exit(void);
719718
bool iommufd_selftest_is_mock_dev(struct device *dev);
720719
int iommufd_test_dma_buf_iommufd_map(struct dma_buf_attachment *attachment,
721-
struct dma_buf_phys_vec *phys);
720+
struct phys_vec *phys);
722721
#else
723722
static inline void iommufd_test_syz_conv_iova_id(struct iommufd_ucmd *ucmd,
724723
unsigned int ioas_id,
@@ -742,7 +741,7 @@ static inline bool iommufd_selftest_is_mock_dev(struct device *dev)
742741
}
743742
static inline int
744743
iommufd_test_dma_buf_iommufd_map(struct dma_buf_attachment *attachment,
745-
struct dma_buf_phys_vec *phys)
744+
struct phys_vec *phys)
746745
{
747746
return -EOPNOTSUPP;
748747
}

drivers/iommu/iommufd/pages.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1078,7 +1078,7 @@ static int pfn_reader_user_update_pinned(struct pfn_reader_user *user,
10781078
}
10791079

10801080
struct pfn_reader_dmabuf {
1081-
struct dma_buf_phys_vec phys;
1081+
struct phys_vec phys;
10821082
unsigned long start_offset;
10831083
};
10841084

@@ -1461,7 +1461,7 @@ static struct dma_buf_attach_ops iopt_dmabuf_attach_revoke_ops = {
14611461
*/
14621462
static int
14631463
sym_vfio_pci_dma_buf_iommufd_map(struct dma_buf_attachment *attachment,
1464-
struct dma_buf_phys_vec *phys)
1464+
struct phys_vec *phys)
14651465
{
14661466
typeof(&vfio_pci_dma_buf_iommufd_map) fn;
14671467
int rc;

drivers/iommu/iommufd/selftest.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2002,7 +2002,7 @@ static const struct dma_buf_ops iommufd_test_dmabuf_ops = {
20022002
};
20032003

20042004
int iommufd_test_dma_buf_iommufd_map(struct dma_buf_attachment *attachment,
2005-
struct dma_buf_phys_vec *phys)
2005+
struct phys_vec *phys)
20062006
{
20072007
struct iommufd_test_dma_buf *priv = attachment->dmabuf->priv;
20082008

drivers/vfio/fsl-mc/Kconfig

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,9 @@ menu "VFIO support for FSL_MC bus devices"
22
depends on FSL_MC_BUS
33

44
config VFIO_FSL_MC
5-
tristate "VFIO support for QorIQ DPAA2 fsl-mc bus devices (DEPRECATED)"
5+
tristate "VFIO support for QorIQ DPAA2 fsl-mc bus devices"
66
select EVENTFD
77
help
8-
The vfio-fsl-mc driver is deprecated and will be removed in a
9-
future kernel release.
10-
118
Driver to enable support for the VFIO QorIQ DPAA2 fsl-mc
129
(Management Complex) devices. This is required to passthrough
1310
fsl-mc bus devices using the VFIO framework.

drivers/vfio/fsl-mc/vfio_fsl_mc.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -531,8 +531,6 @@ static int vfio_fsl_mc_probe(struct fsl_mc_device *mc_dev)
531531
struct device *dev = &mc_dev->dev;
532532
int ret;
533533

534-
dev_err_once(dev, "DEPRECATION: vfio-fsl-mc is deprecated and will be removed in a future kernel release\n");
535-
536534
vdev = vfio_alloc_device(vfio_fsl_mc_device, vdev, dev,
537535
&vfio_fsl_mc_ops);
538536
if (IS_ERR(vdev))

drivers/vfio/mdev/mdev_sysfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ static void mdev_type_release(struct kobject *kobj)
156156
struct mdev_type *type = to_mdev_type(kobj);
157157

158158
pr_debug("Releasing group %s\n", kobj->name);
159-
/* Pairs with the get in add_mdev_supported_type() */
159+
/* Pairs with the get in mdev_type_add() */
160160
put_device(type->parent->dev);
161161
}
162162

drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ static int vf_qm_check_match(struct hisi_acc_vf_core_device *hisi_acc_vdev,
426426
ret = qm_get_vft(vf_qm, &vf_qm->qp_base);
427427
if (ret <= 0) {
428428
dev_err(dev, "failed to get vft qp nums\n");
429-
return ret;
429+
return ret < 0 ? ret : -EINVAL;
430430
}
431431

432432
if (ret != vf_data->qp_num) {
@@ -1188,12 +1188,34 @@ hisi_acc_vfio_pci_get_device_state(struct vfio_device *vdev,
11881188
return 0;
11891189
}
11901190

1191+
static void hisi_acc_vf_pci_reset_prepare(struct pci_dev *pdev)
1192+
{
1193+
struct hisi_acc_vf_core_device *hisi_acc_vdev = hisi_acc_drvdata(pdev);
1194+
struct hisi_qm *qm = hisi_acc_vdev->pf_qm;
1195+
struct device *dev = &qm->pdev->dev;
1196+
u32 delay = 0;
1197+
1198+
/* All reset requests need to be queued for processing */
1199+
while (test_and_set_bit(QM_RESETTING, &qm->misc_ctl)) {
1200+
msleep(1);
1201+
if (++delay > QM_RESET_WAIT_TIMEOUT) {
1202+
dev_err(dev, "reset prepare failed\n");
1203+
return;
1204+
}
1205+
}
1206+
1207+
hisi_acc_vdev->set_reset_flag = true;
1208+
}
1209+
11911210
static void hisi_acc_vf_pci_aer_reset_done(struct pci_dev *pdev)
11921211
{
11931212
struct hisi_acc_vf_core_device *hisi_acc_vdev = hisi_acc_drvdata(pdev);
1213+
struct hisi_qm *qm = hisi_acc_vdev->pf_qm;
1214+
1215+
if (hisi_acc_vdev->set_reset_flag)
1216+
clear_bit(QM_RESETTING, &qm->misc_ctl);
11941217

1195-
if (hisi_acc_vdev->core_device.vdev.migration_flags !=
1196-
VFIO_MIGRATION_STOP_COPY)
1218+
if (!hisi_acc_vdev->core_device.vdev.mig_ops)
11971219
return;
11981220

11991221
mutex_lock(&hisi_acc_vdev->state_mutex);
@@ -1547,6 +1569,7 @@ static int hisi_acc_vfio_pci_open_device(struct vfio_device *core_vdev)
15471569
}
15481570
hisi_acc_vdev->mig_state = VFIO_DEVICE_STATE_RUNNING;
15491571
hisi_acc_vdev->dev_opened = true;
1572+
hisi_acc_vdev->match_done = 0;
15501573
mutex_unlock(&hisi_acc_vdev->open_mutex);
15511574
}
15521575

@@ -1734,6 +1757,7 @@ static const struct pci_device_id hisi_acc_vfio_pci_table[] = {
17341757
MODULE_DEVICE_TABLE(pci, hisi_acc_vfio_pci_table);
17351758

17361759
static const struct pci_error_handlers hisi_acc_vf_err_handlers = {
1760+
.reset_prepare = hisi_acc_vf_pci_reset_prepare,
17371761
.reset_done = hisi_acc_vf_pci_aer_reset_done,
17381762
.error_detected = vfio_pci_core_aer_err_detected,
17391763
};

0 commit comments

Comments
 (0)