From: Baolu Lu <baolu.lu@linux.intel.com>
To: Pranjal Shrivastava <praan@google.com>,
Joerg Roedel <joro@8bytes.org>, Will Deacon <will@kernel.org>,
Robin Murphy <robin.murphy@arm.com>
Cc: baolu.lu@linux.intel.com, Mostafa Saleh <smostafa@google.com>,
iommu@lists.linux.dev, Kunkun Jiang <jiangkunkun@huawei.com>,
Jason Gunthorpe <jgg@nvidia.com>
Subject: Re: [PATCH rc v3] iommu: Handle iommu faults for a bad iopf setup
Date: Fri, 16 Aug 2024 10:17:59 +0800 [thread overview]
Message-ID: <c35a4976-7b36-411d-9f4c-4fb3a3bf204a@linux.intel.com> (raw)
In-Reply-To: <20240815182423.446137-1-praan@google.com>
On 8/16/24 2:24 AM, Pranjal Shrivastava wrote:
> The iommu_report_device_fault function was updated to return void while
> assuming that drivers only need to call iommu_report_device_fault() for
> reporting an iopf. This implementation causes following problems:
>
> 1. The drivers rely on the core code to call it's page_reponse,
> however, when a fault is received and no fault capable domain is
> attached / iopf_param is NULL, the ops->page_response is NOT called
> causing the device to stall in case the fault type was PAGE_REQ.
>
> 2. The arm_smmu_v3 driver relies on the returned value to log errors
> returning void from iommu_report_device_fault causes these events to
> be missed while logging.
>
> Modify the iommu_report_device_fault function to return -EINVAL for
> cases where no fault capable domain is attached or iopf_param was NULL
> and calls back to the driver (ops->page_response) in case the fault type
> was IOMMU_FAULT_PAGE_REQ. The returned value can be used by the drivers
> to log the fault/event as needed.
>
> Reported-by: Kunkun Jiang<jiangkunkun@huawei.com>
> Closes:https://lore.kernel.org/all/6147caf0-b9a0-30ca-795e-a1aa502a5c51@huawei.com/
> Fixes: 3dfa64aecbaf ("iommu: Make iommu_report_device_fault() return void")
> Signed-off-by: Jason Gunthorpe<jgg@nvidia.com>
> Signed-off-by: Pranjal Shrivastava<praan@google.com>
> ---
> drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 2 +-
> drivers/iommu/io-pgfault.c | 116 +++++++++++++-------
> include/linux/iommu.h | 5 +-
> 3 files changed, 83 insertions(+), 40 deletions(-)
Nit: can you please add some words to the comments of
iommu_report_device_fault() to explain what it returns? Right now, it
looks like the return value only matters for certain iommu drivers, so
it would be helpful to add a clear explanation.
Others look good to me,
Reviewed-by: Lu Baolu <baolu.lu@linux.intel.com>
Thanks,
baolu
next prev parent reply other threads:[~2024-08-16 2:21 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-15 18:24 [PATCH rc v3] iommu: Handle iommu faults for a bad iopf setup Pranjal Shrivastava
2024-08-15 23:04 ` Jason Gunthorpe
2024-08-16 2:17 ` Baolu Lu [this message]
2024-08-16 7:10 ` Pranjal Shrivastava
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c35a4976-7b36-411d-9f4c-4fb3a3bf204a@linux.intel.com \
--to=baolu.lu@linux.intel.com \
--cc=iommu@lists.linux.dev \
--cc=jgg@nvidia.com \
--cc=jiangkunkun@huawei.com \
--cc=joro@8bytes.org \
--cc=praan@google.com \
--cc=robin.murphy@arm.com \
--cc=smostafa@google.com \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox