All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pranjal Shrivastava <praan@google.com>
To: Nicolin Chen <nicolinc@nvidia.com>
Cc: Joerg Roedel <joro@8bytes.org>, Will Deacon <will@kernel.org>,
	Robin Murphy <robin.murphy@arm.com>,
	Mostafa Saleh <smostafa@google.com>,
	iommu@lists.linux.dev, Jason Gunthorpe <jgg@nvidia.com>,
	Daniel Mentz <danielmentz@google.com>
Subject: Re: [PATCH v5 1/3] iommu/arm-smmu-v3: Introduce struct arm_smmu_event
Date: Fri, 15 Nov 2024 13:13:36 +0000	[thread overview]
Message-ID: <ZzdJAFc_8h6LfVL7@google.com> (raw)
In-Reply-To: <ZzPlMlE2gpH9DQQ4@Asurada-Nvidia>

On Tue, Nov 12, 2024 at 03:30:58PM -0800, Nicolin Chen wrote:
> On Tue, Nov 12, 2024 at 08:30:16AM +0000, Pranjal Shrivastava wrote:
> > +static void arm_smmu_decode_event(u64 *raw, struct arm_smmu_event *event)
> ..
> > +static int arm_smmu_handle_evt(struct arm_smmu_device *smmu,
> > +                              struct arm_smmu_event *event)
> 
> s/arm_smmu_handle_evt/arm_smmu_handle_event
> 
> Also, given that these two define "struct arm_smmu_event *event"
> nicely, ...
> 

Ack.

> > @@ -1820,25 +1836,26 @@ static int arm_smmu_handle_evt(struct arm_smmu_device *smmu, u64 *evt)
> >  static irqreturn_t arm_smmu_evtq_thread(int irq, void *dev)
> >  {
> >         int i, ret;
> > +       u64 raw_evt[EVTQ_ENT_DWORDS];
> > +       struct arm_smmu_event evt = {0};
> 
> I think we can keep the existing "evt" for raw and simply add:
> 	struct arm_smmu_event event = { };
> 
> So the patch could look cleaner, less the "s/evt/raw_evt" part.
> 

Ack. Makes sense. Will rename accordingly.

> >         struct arm_smmu_device *smmu = dev;
> >         struct arm_smmu_queue *q = &smmu->evtq.q;
> >         struct arm_smmu_ll_queue *llq = &q->llq;
> >         static DEFINE_RATELIMIT_STATE(rs, DEFAULT_RATELIMIT_INTERVAL,
> >                                       DEFAULT_RATELIMIT_BURST);
> > -       u64 evt[EVTQ_ENT_DWORDS];
> > 
> >         do {
> > -               while (!queue_remove_raw(q, evt)) {
> > -                       u8 id = FIELD_GET(EVTQ_0_ID, evt[0]);
> > +               while (!queue_remove_raw(q, raw_evt)) {
> > 
> > -                       ret = arm_smmu_handle_evt(smmu, evt);
> > +                       arm_smmu_decode_event(raw_evt, &evt);
> 
> Drop the empty line in-between please.

Ack.

> 
> > +                       ret = arm_smmu_handle_evt(smmu, &evt);
> >                         if (!ret || !__ratelimit(&rs))
> >                                 continue;
> > 
> > -                       dev_info(smmu->dev, "event 0x%02x received:\n", id);
> > -                       for (i = 0; i < ARRAY_SIZE(evt); ++i)
> > +                       dev_info(smmu->dev, "event 0x%02x received:\n", evt.id);
> > +                       for (i = 0; i < EVTQ_ENT_DWORDS; ++i)
> >                                 dev_info(smmu->dev, "\t0x%016llx\n",
> > -                                        (unsigned long long)evt[i]);
> > +                                       (unsigned long long)raw_evt[i]);
> 
> Please keep the previous indentations.

Ack

>
> > 
> >                         cond_resched();
> >                 }
> > diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h
> > index 1e9952ca989f..abb543d987f6 100644
> > --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h
> > +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h
> > @@ -771,6 +771,22 @@ struct arm_smmu_stream {
> >         struct rb_node                  node;
> >  };
> > 
> > +struct arm_smmu_event {
> > +       u8                              stall           : 1,
> > +                                       ssv             : 1,
> > +                                       privileged      : 1,
> > +                                       instruction     : 1,
> > +                                       s2              : 1,
> > +                                       read            : 1;
> 
> Feels odd to do so...should all of them be:
> 	u8			name : 1;
> ?

Hmmm, do you mean something like the following?

struct arm_smmu_event {
	u8				stall           : 1,
	u8				ssv             : 1,
	u8				privileged      : 1,
	u8				instruction     : 1,
	u8				s2              : 1,
	u8				read            : 1;
}

> 
> Thanks
> Nicolin

Thanks,
Praan

  reply	other threads:[~2024-11-15 13:13 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-12  8:30 [PATCH v5 0/3] iommu/arm-smmu-v3: Parse out event records Pranjal Shrivastava
2024-11-12  8:30 ` [PATCH v5 1/3] iommu/arm-smmu-v3: Introduce struct arm_smmu_event Pranjal Shrivastava
2024-11-12 23:30   ` Nicolin Chen
2024-11-15 13:13     ` Pranjal Shrivastava [this message]
2024-11-15 21:34       ` Nicolin Chen
2024-11-18 16:24         ` Jason Gunthorpe
2024-11-19  9:03           ` Will Deacon
2024-11-19  9:27             ` Pranjal Shrivastava
2024-11-20  9:56               ` Will Deacon
2024-11-20 11:46                 ` Pranjal Shrivastava
2024-11-27  3:25   ` Daniel Mentz
2024-11-27  9:25     ` Pranjal Shrivastava
2024-11-27 19:42       ` Daniel Mentz
2024-11-27 20:53         ` Pranjal Shrivastava
2024-11-28 23:40           ` Daniel Mentz
2024-11-29 12:56             ` Pranjal Shrivastava
2024-11-12  8:30 ` [PATCH v5 2/3] iommu/arm-smmu-v3: Log better event records Pranjal Shrivastava
2024-11-12  8:30 ` [PATCH v5 3/3] iommu/arm-smmu-v3: Avoid redundant master lookup in events Pranjal Shrivastava
2024-11-12 23:52   ` Nicolin Chen
2024-11-15 13:26     ` Pranjal Shrivastava
2024-11-15 21:46       ` Nicolin Chen
2024-11-20  4:45 ` [PATCH v5 0/3] iommu/arm-smmu-v3: Parse out event records Daniel Mentz
2024-11-20  6:54   ` Pranjal Shrivastava
2024-11-20  7:12     ` Pranjal Shrivastava
2024-11-20 11:43     ` Pranjal Shrivastava
2024-11-22 23:33       ` Daniel Mentz
2024-11-26  9:30         ` 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=ZzdJAFc_8h6LfVL7@google.com \
    --to=praan@google.com \
    --cc=danielmentz@google.com \
    --cc=iommu@lists.linux.dev \
    --cc=jgg@nvidia.com \
    --cc=joro@8bytes.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.