Re: [PATCH v6 13/14] iommu/arm-smmu-v3: Report events that belong to devices attached to vIOMMU

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Feb 20, 2025 at 12:45:46PM -0800, Nicolin Chen wrote:
> ------------------------------------------------------------
> diff --git a/include/uapi/linux/iommufd.h b/include/uapi/linux/iommufd.h
> index fd2f13a63f27..be9746ecdc65 100644
> --- a/include/uapi/linux/iommufd.h
> +++ b/include/uapi/linux/iommufd.h
> @@ -1067,7 +1067,16 @@ enum iommu_veventq_type {
>   * struct iommu_vevent_arm_smmuv3 - ARM SMMUv3 Virtual Event
>   *                                  (IOMMU_VEVENTQ_TYPE_ARM_SMMUV3)
>   * @evt: 256-bit ARM SMMUv3 Event record, little-endian.
> - *       (Refer to "7.3 Event records" in SMMUv3 HW Spec)
> + *       Reported event records: (Refer to "7.3 Event records" in SMMUv3 HW Spec)
> + *       - 0x02 C_BAD_STREAMID

This is documented as 'Transaction StreamID out of range.' so it would
by a hypervisor kernel bug to hit it

> + *       - 0x04 C_BAD_STE

I'm not sure we do enough validation to reject all bad STE fragments
so it makes sense this could happen.

> + *       - 0x06 F_STREAM_DISABLED

This looked guest triggerable to me.. so it makes sense

> + *       - 0x08 C_BAD_SUBSTREAMID
> + *       - 0x0a C_BAD_STE

Typo, this is C_BAD_CD

> + *       - 0x10 F_TRANSLATION
> + *       - 0x11 F_ADDR_SIZE
> + *       - 0x12 F_ACCESS
> + *       - 0x13 F_PERMISSION

List makes sense to me otherwise

> But F_CD_FETCH and F_STE_FETCH seem to be complicated here, as both

F_STE_FETCH would indicate a hypervisor failure managing the stream
table so no need to forward it.

> report PA in their FetchAddr fields, although the spec does mention
> both might be injected to a guest VM:
>  - "Note: This event might be injected into a guest VM, as though
>     from a virtual SMMU, when a hypervisor receives a stage 2
>     Translation-related fault indicating CD fetch as a cause (with
>     CLASS == CD)."

That sounds like the VMM should be catching the
F_TRANSLATION and convert it for the CLASS=CD

> For F_CD_FETCH, at least the CD table pointer in the nested STE is
> an IPA, and all the entries in the CD table that can be 2-level are
> IPAs as well. So, we need some kinda reverse translation from a PA
> to IPA using its stage-2 mapping. I am not sure what's the best way
> to do that...

And if the F_TRANSLATION covers the case then maybe this just stays in
the hypervisor?

> Otherwise, perhaps not-supporting them in this series might be a
> safer bet?

Yeah, I would consider skipping F_CD_FETCH. May also just try it out
and see what events come out on a CD fetch failure..

Jason




[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux