iommu.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: Joerg Roedel <joro@8bytes.org>
To: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Cc: iommu@lists.linux-foundation.org, Jon.Grimm@amd.com,
	brijesh.singh@amd.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/3] iommu: amd: Add support for RMP_PAGE_FAULT and RMP_HW_ERR
Date: Fri, 18 Sep 2020 11:31:18 +0200	[thread overview]
Message-ID: <20200918093117.GO31590@8bytes.org> (raw)
In-Reply-To: <20200916135549.146468-3-suravee.suthikulpanit@amd.com>

Hi Suravee,

On Wed, Sep 16, 2020 at 01:55:48PM +0000, Suravee Suthikulpanit wrote:
> +static void amd_iommu_report_rmp_hw_error(volatile u32 *event)
> +{
> +	struct pci_dev *pdev;
> +	struct iommu_dev_data *dev_data = NULL;
> +	int devid     = (event[0] >> EVENT_DEVID_SHIFT) & EVENT_DEVID_MASK;
> +	int vmg_tag   = (event[1]) & 0xFFFF;
> +	int flags     = (event[1] >> EVENT_FLAGS_SHIFT) & EVENT_FLAGS_MASK;
> +	u64 spa       = ((u64)event[3] << 32) | (event[2] & 0xFFFFFFF8);

Please write this as:

	struct iommu_dev_data *dev_data = NULL;
	int devid, vmg_tag, flags;
	struct pci_dev *pdev;
	u64 spa;

	devid   = (event[0] >> EVENT_DEVID_SHIFT) & EVENT_DEVID_MASK;
	vmg_tag = (event[1]) & 0xFFFF;
	flags   = (event[1] >> EVENT_FLAGS_SHIFT) & EVENT_FLAGS_MASK;
	spa     = ((u64)event[3] << 32) | (event[2] & 0xFFFFFFF8);

Same applied the the next function.

> +
> +	pdev = pci_get_domain_bus_and_slot(0, PCI_BUS_NUM(devid),
> +					   devid & 0xff);
> +	if (pdev)
> +		dev_data = dev_iommu_priv_get(&pdev->dev);
> +
> +	if (dev_data && __ratelimit(&dev_data->rs)) {
> +		pci_err(pdev, "Event logged [RMP_HW_ERROR devid=0x%04x, vmg_tag=0x%04x, spa=0x%llx, flags=0x%04x]\n",
> +			devid, vmg_tag, spa, flags);

Printing the devid is not really needed here, no? Same issue in the next
function.

Regards,

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

  reply	other threads:[~2020-09-18  9:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-16 13:55 [PATCH 0/3] amd : iommu : Initial IOMMU support for SNP Suravee Suthikulpanit
2020-09-16 13:55 ` [PATCH 1/3] iommu: amd: Use 4K page for completion wait write-back semaphore Suravee Suthikulpanit
2020-09-16 13:55 ` [PATCH 2/3] iommu: amd: Add support for RMP_PAGE_FAULT and RMP_HW_ERR Suravee Suthikulpanit
2020-09-18  9:31   ` Joerg Roedel [this message]
2020-09-23 11:04     ` Suravee Suthikulpanit
2020-09-16 13:55 ` [PATCH 3/3] iommu: amd: Re-purpose Exclusion range registers to support SNP CWWB Suravee Suthikulpanit

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=20200918093117.GO31590@8bytes.org \
    --to=joro@8bytes.org \
    --cc=Jon.Grimm@amd.com \
    --cc=brijesh.singh@amd.com \
    --cc=iommu@lists.linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=suravee.suthikulpanit@amd.com \
    /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).