mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@ziepe.ca>
To: Mostafa Saleh <smostafa@google.com>
Cc: linux-kernel@vger.kernel.org, iommu@lists.linux.dev,
	linux-arm-kernel@lists.infradead.org, will@kernel.org,
	robin.murphy@arm.com, joro@8bytes.org, jean-philippe@linaro.org,
	nicolinc@nvidia.com, mshavit@google.com
Subject: Re: [PATCH v2] iommu/arm-smmu-v3: Match Stall behaviour for S2
Date: Wed, 14 Aug 2024 12:51:51 -0300	[thread overview]
Message-ID: <20240814155151.GB3468552@ziepe.ca> (raw)
In-Reply-To: <20240814145633.2565126-1-smostafa@google.com>

On Wed, Aug 14, 2024 at 02:56:33PM +0000, Mostafa Saleh wrote:

> Also described in the pseudocode “SteIllegal()”
>     if eff_idr0_stall_model == '10' && STE.S2S == '0' then
>         // stall_model forcing stall, but S2S == 0
>         return TRUE;

This clips out an important bit:

if STE.Config == '11x' then
  [..]
  if eff_idr0_stall_model == '10' && STE.S2S == '0' then
      // stall_model forcing stall, but S2S == 0
      return TRUE;

And here we are using STRTAB_STE_0_CFG_S1_TRANS which is 101 and won't
match the STE.Config qualification.

The plain text language said the S2S is only required if the S2 is
translating, STRTAB_STE_0_CFG_S1_TRANS puts it in bypass.

> +	/*
> +	 * S2S is ignored if stage-2 exists but not enabled.
> +	 * S2S is not compatible with ATS.
> +	 */
> +	if (master->stall_enabled && !ats_enabled &&
> +	    smmu->features & ARM_SMMU_FEAT_TRANS_S2)
> +		target->data[2] |= STRTAB_STE_2_S2S;

We can't ignore ATS if it was requested here.

I think that does point to an issue, ATS should be fixed up here:

--- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
+++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
@@ -2492,6 +2492,9 @@ static bool arm_smmu_ats_supported(struct arm_smmu_master *master)
        if (!(fwspec->flags & IOMMU_FWSPEC_PCI_RC_ATS))
                return false;
 
+       if (master->stall_enabled)
+               return false;
+
        return dev_is_pci(dev) && pci_ats_supported(to_pci_dev(dev));
 }

And your hunk above should be placed in arm_smmu_make_s2_domain_ste()
not arm_smmu_make_cdtable_ste()

Not ignoring the event still makes sense to me, but I didn't check it
carefully. We can decode the S2 event right?

Jason

  reply	other threads:[~2024-08-14 15:51 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-14 14:56 Mostafa Saleh
2024-08-14 15:51 ` Jason Gunthorpe [this message]
2024-08-15 11:30   ` Mostafa Saleh
2024-08-15 12:05     ` Jason Gunthorpe
2024-08-15 12:16     ` Robin Murphy
2024-08-15 12:26       ` Mostafa Saleh
2024-08-15 12:59         ` Jason Gunthorpe
2024-08-15 13:41           ` Robin Murphy
2024-08-15 13:59             ` Jason Gunthorpe
2024-08-16  9:49               ` Mostafa Saleh

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=20240814155151.GB3468552@ziepe.ca \
    --to=jgg@ziepe.ca \
    --cc=iommu@lists.linux.dev \
    --cc=jean-philippe@linaro.org \
    --cc=joro@8bytes.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mshavit@google.com \
    --cc=nicolinc@nvidia.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

all inboxes | Powered by JetHome®