[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250113192927.GJ396083@nvidia.com>
Date: Mon, 13 Jan 2025 15:29:27 -0400
From: Jason Gunthorpe <jgg@...dia.com>
To: Nicolin Chen <nicolinc@...dia.com>
Cc: kevin.tian@...el.com, corbet@....net, will@...nel.org, joro@...tes.org,
suravee.suthikulpanit@....com, robin.murphy@....com,
dwmw2@...radead.org, baolu.lu@...ux.intel.com, shuah@...nel.org,
linux-kernel@...r.kernel.org, iommu@...ts.linux.dev,
linux-arm-kernel@...ts.infradead.org,
linux-kselftest@...r.kernel.org, linux-doc@...r.kernel.org,
eric.auger@...hat.com, jean-philippe@...aro.org, mdf@...nel.org,
mshavit@...gle.com, shameerali.kolothum.thodi@...wei.com,
smostafa@...gle.com, ddutile@...hat.com, yi.l.liu@...el.com,
patches@...ts.linux.dev
Subject: Re: [PATCH v5 13/14] iommu/arm-smmu-v3: Introduce struct
arm_smmu_vmaster
On Tue, Jan 07, 2025 at 09:10:16AM -0800, Nicolin Chen wrote:
> +int arm_smmu_attach_prepare_vmaster(struct arm_smmu_attach_state *state,
> + struct iommu_domain *domain)
> +{
> + struct arm_smmu_nested_domain *nested_domain;
> + struct arm_smmu_vmaster *vmaster;
> + unsigned long vsid;
> + unsigned int cfg;
> +
> + iommu_group_mutex_assert(state->master->dev);
> +
> + if (domain->type != IOMMU_DOMAIN_NESTED)
> + return 0;
> + nested_domain = to_smmu_nested_domain(domain);
> +
> + /* Skip ABORT/BYPASS or invalid vSTE */
> + cfg = FIELD_GET(STRTAB_STE_0_CFG, le64_to_cpu(nested_domain->ste[0]));
> + if (cfg == STRTAB_STE_0_CFG_ABORT || cfg == STRTAB_STE_0_CFG_BYPASS)
> + return 0;
Why? If the VM sets an ABORT vSTE then I would expect that any
protection violation events the VM triggers are captured and forwarded
as well?
Basically any time a vSTE is in place we should capture events that
are affiliated with the SID?
> + if (!(nested_domain->ste[0] & cpu_to_le64(STRTAB_STE_0_V)))
> + return 0;
> +
> + vsid = iommufd_viommu_get_vdev_id(&nested_domain->vsmmu->core,
> + state->master->dev);
> + /* Fail the attach if vSID is not correct set by the user space */
> + if (!vsid)
> + return -ENOENT;
Is it really OK that 0 is being used as invalid here?
Jason
Powered by blists - more mailing lists