iommu.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: Joerg Roedel <joro@8bytes.org>
To: Lennert Buytenhek <buytenh@wantstofly.org>
Cc: iommu@lists.linux-foundation.org
Subject: Re: [PATCH v4] iommu/amd: Use report_iommu_fault()
Date: Tue, 28 Sep 2021 11:55:00 +0200	[thread overview]
Message-ID: <YVLmdD7s68r9ngNZ@8bytes.org> (raw)
In-Reply-To: <YU8vmufv54arwMOa@wantstofly.org>

On Sat, Sep 25, 2021 at 05:18:02PM +0300, Lennert Buytenhek wrote:
> +#define IS_IOMMU_MEM_TRANSACTION(flags)		\
> +	(((flags) & EVENT_FLAG_I) == 0)
> +
> +#define IS_WRITE_REQUEST(flags)			\
> +	((flags) & EVENT_FLAG_RW)
> +
>  static void amd_iommu_report_page_fault(u16 devid, u16 domain_id,
>  					u64 address, int flags)
>  {
> @@ -484,6 +490,18 @@ static void amd_iommu_report_page_fault(u16 devid, u16 domain_id,
>  	if (pdev)
>  		dev_data = dev_iommu_priv_get(&pdev->dev);
>  
> +	/*
> +	 * If this is a DMA fault (for which the I(nterrupt) bit will
> +	 * be unset), allow report_iommu_fault() to prevent logging it.
> +	 */
> +	if (dev_data && IS_IOMMU_MEM_TRANSACTION(flags)) {
> +		if (!report_iommu_fault(&dev_data->domain->domain,
> +					&pdev->dev, address,
> +					IS_WRITE_REQUEST(flags) ?
> +					IOMMU_FAULT_WRITE : IOMMU_FAULT_READ))
> +			goto out;

This is better placed inside the 'if (dev_data)' statement below.

Otherwise it looks good to me.


Regards,

	Joerg
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

      reply	other threads:[~2021-09-28  9:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-25 14:18 [PATCH v4] iommu/amd: Use report_iommu_fault() Lennert Buytenhek
2021-09-28  9:55 ` Joerg Roedel [this message]

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=YVLmdD7s68r9ngNZ@8bytes.org \
    --to=joro@8bytes.org \
    --cc=buytenh@wantstofly.org \
    --cc=iommu@lists.linux-foundation.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;
as well as URLs for NNTP newsgroup(s).