Re: [PATCH 0/7] Add TPMI support

From: Hans de Goede
Date: Mon Feb 06 2023 - 07:55:55 EST


Hi,

On 2/6/23 13:49, Hans de Goede wrote:

> Thank you for your patch-series, I've applied the series to my
> review-hans branch:
> https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=review-hans
>
> Note it will show up in my review-hans branch once I've pushed my
> local branch there, which might take a while.
>
> Once I've run some tests on this branch the patches there will be
> added to the platform-drivers-x86/for-next branch and eventually
> will be included in the pdx86 pull-request to Linus for the next
> merge-window.

One thing which I did notice, which is a pre-existing problem
is that the IDA accesses in drivers/platform/x86/intel/vsec.c
are not protected by any locking.

This is likely ok for now because there is only 1 PCI device
per type of ida and the enumeration of the vsec devices
under the PCI device is done in a single loop, so all
IDA accesses are single threaded atm.

But still IMHO it would be good to protect the IDA accesses
(ida_alloc() / ida_free()) with a mutex to protect against
any future races.

I think that a single global static mutex inside
drivers/platform/x86/intel/vsec.c to protect the
ida calls there should suffice for this.

Regards,

Hans