From c3dab32ec9b111e036b7de9cb8cb5a987b1764f3 Mon Sep 17 00:00:00 2001 From: Kunkun Jiang Date: Fri, 18 Nov 2022 15:22:16 +0800 Subject: [PATCH 03/36] Revert "hw/arm/smmuv3: Post-load stage 1 configurations to the host" This reverts commit 1b95c995f032c21bf6607dda8ede0f5856bb190a. Signed-off-by: Kunkun Jiang --- hw/arm/smmuv3.c | 33 +++++---------------------------- 1 file changed, 5 insertions(+), 28 deletions(-) diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c index 2bd9f22055..55e78db65d 100644 --- a/hw/arm/smmuv3.c +++ b/hw/arm/smmuv3.c @@ -936,7 +936,7 @@ static void smmuv3_s1_range_inval(SMMUState *s, Cmd *cmd) } } -static int smmuv3_notify_config_change(SMMUState *bs, uint32_t sid) +static void smmuv3_notify_config_change(SMMUState *bs, uint32_t sid) { #ifdef __linux__ IOMMUMemoryRegion *mr = smmu_iommu_mr(bs, sid); @@ -945,10 +945,9 @@ static int smmuv3_notify_config_change(SMMUState *bs, uint32_t sid) IOMMUConfig iommu_config = {}; SMMUTransCfg *cfg; SMMUDevice *sdev; - int ret; if (!mr) { - return 0; + return; } sdev = container_of(mr, SMMUDevice, iommu); @@ -957,13 +956,13 @@ static int smmuv3_notify_config_change(SMMUState *bs, uint32_t sid) smmuv3_flush_config(sdev); if (!pci_device_is_pasid_ops_set(sdev->bus, sdev->devfn)) { - return 0; + return; } cfg = smmuv3_get_config(sdev, &event); if (!cfg) { - return 0; + return; } iommu_config.pasid_cfg.argsz = sizeof(struct iommu_pasid_table_config); @@ -985,13 +984,10 @@ static int smmuv3_notify_config_change(SMMUState *bs, uint32_t sid) iommu_config.pasid_cfg.config, iommu_config.pasid_cfg.base_ptr); - ret = pci_device_set_pasid_table(sdev->bus, sdev->devfn, &iommu_config); - if (ret) { + if (pci_device_set_pasid_table(sdev->bus, sdev->devfn, &iommu_config)) { error_report("Failed to pass PASID table to host for iommu mr %s (%m)", mr->parent_obj.name); } - - return ret; #endif } @@ -1561,24 +1557,6 @@ static void smmu_realize(DeviceState *d, Error **errp) smmu_init_irq(s, dev); } -static int smmuv3_post_load(void *opaque, int version_id) -{ - SMMUv3State *s3 = opaque; - SMMUState *s = &(s3->smmu_state); - SMMUDevice *sdev; - int ret = 0; - - QLIST_FOREACH(sdev, &s->devices_with_notifiers, next) { - uint32_t sid = smmu_get_sid(sdev); - ret = smmuv3_notify_config_change(s, sid); - if (ret) { - break; - } - } - - return ret; -} - static const VMStateDescription vmstate_smmuv3_queue = { .name = "smmuv3_queue", .version_id = 1, @@ -1597,7 +1575,6 @@ static const VMStateDescription vmstate_smmuv3 = { .version_id = 1, .minimum_version_id = 1, .priority = MIG_PRI_IOMMU, - .post_load = smmuv3_post_load, .fields = (VMStateField[]) { VMSTATE_UINT32(features, SMMUv3State), VMSTATE_UINT8(sid_size, SMMUv3State), -- 2.27.0