[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d85d91f2-25e7-f706-094b-56c417becf1c@intel.com>
Date: Fri, 2 Dec 2022 13:16:47 -0800
From: Reinette Chatre <reinette.chatre@...el.com>
To: Thomas Gleixner <tglx@...utronix.de>,
LKML <linux-kernel@...r.kernel.org>
CC: <x86@...nel.org>, Joerg Roedel <joro@...tes.org>,
Will Deacon <will@...nel.org>, <linux-pci@...r.kernel.org>,
Bjorn Helgaas <bhelgaas@...gle.com>,
Lorenzo Pieralisi <lorenzo.pieralisi@....com>,
"Marc Zyngier" <maz@...nel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Jason Gunthorpe <jgg@...lanox.com>,
Dave Jiang <dave.jiang@...el.com>,
"Alex Williamson" <alex.williamson@...hat.com>,
Kevin Tian <kevin.tian@...el.com>,
Dan Williams <dan.j.williams@...el.com>,
Logan Gunthorpe <logang@...tatee.com>,
Ashok Raj <ashok.raj@...el.com>, Jon Mason <jdmason@...zu.us>,
Allen Hubbe <allenbh@...il.com>,
"Ahmed S. Darwish" <darwi@...utronix.de>
Subject: Re: [patch 33/33] irqchip: Add IDXD Interrupt Message Store driver
Hi Thomas,
On 12/2/2022 11:51 AM, Thomas Gleixner wrote:
> On Fri, Dec 02 2022 at 09:55, Reinette Chatre wrote:
>> On 11/11/2022 5:59 AM, Thomas Gleixner wrote:
>> @@ -33,6 +34,8 @@ struct ims_slot {
>> #define CTRL_PASID_ENABLE BIT(3)
>> /* Position of PASID.LSB in the control word */
>> #define CTRL_PASID_SHIFT 12
>> +/* Valid PASID is 20 bits */
>> +#define CTRL_PASID_VALID GENMASK(19, 0)
>>
>> static inline void iowrite32_and_flush(u32 value, void __iomem *addr)
>> {
>> @@ -93,12 +96,17 @@ static void idxd_prepare_desc(struct irq_domain *domain, msi_alloc_info_t *arg,
>> /* Mask the interrupt for paranoia sake */
>> iowrite32_and_flush(CTRL_VECTOR_MASKBIT, &slot->ctrl);
>>
>> - /*
>> - * The caller provided PASID. Shift it to the proper position
>> - * and set the PASID enable bit.
>> - */
>> - desc->data.icookie.value <<= CTRL_PASID_SHIFT;
>> - desc->data.icookie.value |= CTRL_PASID_ENABLE;
>> + if (pasid_valid((ioasid_t)desc->data.icookie.value)) {
>> + /*
>> + * The caller provided PASID. Shift it to the proper position
>> + * and set the PASID enable bit.
>> + */
>> + desc->data.icookie.value &= CTRL_PASID_VALID;
>> + desc->data.icookie.value <<= CTRL_PASID_SHIFT;
>> + desc->data.icookie.value |= CTRL_PASID_ENABLE;
>> + } else {
>> + desc->data.icookie.value = 0;
>> + }
>
> Looks about right. But that needs some sanity measures at the call sites
> so that we don't end up with an invalid PASID in cases where a valid
> PASID is truly required.
I will take a closer look at this. Current call site is explicit to
set an invalid PASID when PASID use is disabled. I still need to do testing
with valid PASID to learn those flows.
Reinette
Powered by blists - more mailing lists