[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ZqvIp/nEz8jnKaH2@Asurada-Nvidia>
Date: Thu, 1 Aug 2024 10:40:55 -0700
From: Nicolin Chen <nicolinc@...dia.com>
To: "Tian, Kevin" <kevin.tian@...el.com>
CC: "jgg@...dia.com" <jgg@...dia.com>, "Liu, Yi L" <yi.l.liu@...el.com>,
"iommu@...ts.linux.dev" <iommu@...ts.linux.dev>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] iommufd: Enforce IOMMU_RESV_SW_MSI upon hwpt_paging
allocation
On Thu, Aug 01, 2024 at 08:10:57AM +0000, Tian, Kevin wrote:
> > From: Nicolin Chen <nicolinc@...dia.com>
> > Sent: Thursday, August 1, 2024 5:22 AM
> >
> > @@ -316,7 +316,9 @@ static inline bool hwpt_is_paging(struct
> > iommufd_hw_pagetable *hwpt)
> > static inline struct iommufd_hwpt_paging *
> > to_hwpt_paging(struct iommufd_hw_pagetable *hwpt)
> > {
> > - return container_of(hwpt, struct iommufd_hwpt_paging, common);
> > + if (hwpt_is_paging(hwpt))
> > + return container_of(hwpt, struct iommufd_hwpt_paging,
> > common);
> > + return container_of(hwpt, struct iommufd_hwpt_nested, common)-
> > >parent;
> > }
> >
>
> hmm this doesn't work with future new hwpt types.
Was trying to make it a smaller change, but short-sighted.
> It's clearer to pass hwpt into earlier helpers and then do the type check
> insided and make it a nop for types other than paging/nesting.
Ack.
Thanks
Nicolin
Powered by blists - more mailing lists