public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
* [PATCH] meta: optee-client: Generalize and update shutdown rule
@ 2023-10-11 14:36 Jan Kiszka
  2023-10-12  7:01 ` Jan Kiszka
  2023-10-12 17:24 ` Uladzimir Bely
  0 siblings, 2 replies; 5+ messages in thread
From: Jan Kiszka @ 2023-10-11 14:36 UTC (permalink / raw)
  To: isar-users
  Cc: Su, Bao Cheng (RC-CN DF FA R&D),
	Lopes Ivo, Diogo Miguel (T CED IFD-PT)

From: Jan Kiszka <jan.kiszka@siemens.com>

First, naming changed somewhere between kernel 5.10 and 6.1 so that
optee-ta-bc50d971... is now optee-ta-supp-bc50d971...

And then we should account for possibly more devices that need to be
unbound. Use POSIX-compliant shell code for this.

The generic loop allows to drop the explicit unmounting of efivarfs
because the corresponding driver will already get unbound.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 .../optee-client/files/debian/tee-supplicant.service           | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/meta/recipes-bsp/optee-client/files/debian/tee-supplicant.service b/meta/recipes-bsp/optee-client/files/debian/tee-supplicant.service
index cc92a5fd..d8b630a4 100644
--- a/meta/recipes-bsp/optee-client/files/debian/tee-supplicant.service
+++ b/meta/recipes-bsp/optee-client/files/debian/tee-supplicant.service
@@ -13,8 +13,7 @@ Type=oneshot
 RemainAfterExit=yes
 # Start if not already started by the initramfs hook
 ExecStart=/bin/sh -c '/usr/bin/pgrep tee-supplicant >/dev/null || /usr/sbin/tee-supplicant -d'
-ExecStop=/bin/sh -c '/usr/bin/findmnt /sys/firmware/efi/efivars >/dev/null && /usr/bin/umount /sys/firmware/efi/efivars || true'
-ExecStop=/bin/sh -c 'echo -n optee-ta-bc50d971-d4c9-42c4-82cb-343fb7f37896 > /sys/bus/tee/drivers/optee-ftpm/unbind || true'
+ExecStop=/bin/sh -c 'for dev in /sys/bus/tee/devices/*; do case "$dev" in *optee-ta-*) basename "$dev" > "$dev"/driver/unbind;; esac done'
 ExecStop=/usr/bin/pkill tee-supplicant
 
 [Install]
-- 
2.35.3

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] meta: optee-client: Generalize and update shutdown rule
  2023-10-11 14:36 [PATCH] meta: optee-client: Generalize and update shutdown rule Jan Kiszka
@ 2023-10-12  7:01 ` Jan Kiszka
  2023-10-12  7:15   ` Uladzimir Bely
  2023-10-12 17:24 ` Uladzimir Bely
  1 sibling, 1 reply; 5+ messages in thread
From: Jan Kiszka @ 2023-10-12  7:01 UTC (permalink / raw)
  To: isar-users
  Cc: Su, Bao Cheng (RC-CN DF FA R&D),
	Lopes Ivo, Diogo Miguel (T CED IFD-PT)

On 11.10.23 16:36, 'Jan Kiszka' via isar-users wrote:
> From: Jan Kiszka <jan.kiszka@siemens.com>
> 
> First, naming changed somewhere between kernel 5.10 and 6.1 so that
> optee-ta-bc50d971... is now optee-ta-supp-bc50d971...
> 
> And then we should account for possibly more devices that need to be
> unbound. Use POSIX-compliant shell code for this.
> 
> The generic loop allows to drop the explicit unmounting of efivarfs
> because the corresponding driver will already get unbound.
> 
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> ---
>  .../optee-client/files/debian/tee-supplicant.service           | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/meta/recipes-bsp/optee-client/files/debian/tee-supplicant.service b/meta/recipes-bsp/optee-client/files/debian/tee-supplicant.service
> index cc92a5fd..d8b630a4 100644
> --- a/meta/recipes-bsp/optee-client/files/debian/tee-supplicant.service
> +++ b/meta/recipes-bsp/optee-client/files/debian/tee-supplicant.service
> @@ -13,8 +13,7 @@ Type=oneshot
>  RemainAfterExit=yes
>  # Start if not already started by the initramfs hook
>  ExecStart=/bin/sh -c '/usr/bin/pgrep tee-supplicant >/dev/null || /usr/sbin/tee-supplicant -d'
> -ExecStop=/bin/sh -c '/usr/bin/findmnt /sys/firmware/efi/efivars >/dev/null && /usr/bin/umount /sys/firmware/efi/efivars || true'
> -ExecStop=/bin/sh -c 'echo -n optee-ta-bc50d971-d4c9-42c4-82cb-343fb7f37896 > /sys/bus/tee/drivers/optee-ftpm/unbind || true'
> +ExecStop=/bin/sh -c 'for dev in /sys/bus/tee/devices/*; do case "$dev" in *optee-ta-*) basename "$dev" > "$dev"/driver/unbind;; esac done'
>  ExecStop=/usr/bin/pkill tee-supplicant
>  
>  [Install]

Would be nice to get this quickly merged as well, then we could drop all
isar patches again downstream.

Jan

-- 
Siemens AG, Technology
Linux Expert Center


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] meta: optee-client: Generalize and update shutdown rule
  2023-10-12  7:01 ` Jan Kiszka
@ 2023-10-12  7:15   ` Uladzimir Bely
  2023-10-12  7:23     ` Jan Kiszka
  0 siblings, 1 reply; 5+ messages in thread
From: Uladzimir Bely @ 2023-10-12  7:15 UTC (permalink / raw)
  To: Jan Kiszka, isar-users
  Cc: Su, Bao Cheng (RC-CN DF FA R&D),
	Lopes Ivo, Diogo Miguel (T CED IFD-PT)

On Thu, 2023-10-12 at 09:01 +0200, 'Jan Kiszka' via isar-users wrote:
> On 11.10.23 16:36, 'Jan Kiszka' via isar-users wrote:
> > From: Jan Kiszka <jan.kiszka@siemens.com>
> > 
> > First, naming changed somewhere between kernel 5.10 and 6.1 so that
> > optee-ta-bc50d971... is now optee-ta-supp-bc50d971...
> > 
> > And then we should account for possibly more devices that need to
> > be
> > unbound. Use POSIX-compliant shell code for this.
> > 
> > The generic loop allows to drop the explicit unmounting of efivarfs
> > because the corresponding driver will already get unbound.
> > 
> > Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> > ---
> >  .../optee-client/files/debian/tee-supplicant.service           | 3
> > +--
> >  1 file changed, 1 insertion(+), 2 deletions(-)
> > 
> > diff --git a/meta/recipes-bsp/optee-client/files/debian/tee-
> > supplicant.service b/meta/recipes-bsp/optee-
> > client/files/debian/tee-supplicant.service
> > index cc92a5fd..d8b630a4 100644
> > --- a/meta/recipes-bsp/optee-client/files/debian/tee-
> > supplicant.service
> > +++ b/meta/recipes-bsp/optee-client/files/debian/tee-
> > supplicant.service
> > @@ -13,8 +13,7 @@ Type=oneshot
> >  RemainAfterExit=yes
> >  # Start if not already started by the initramfs hook
> >  ExecStart=/bin/sh -c '/usr/bin/pgrep tee-supplicant >/dev/null ||
> > /usr/sbin/tee-supplicant -d'
> > -ExecStop=/bin/sh -c '/usr/bin/findmnt /sys/firmware/efi/efivars
> > >/dev/null && /usr/bin/umount /sys/firmware/efi/efivars || true'
> > -ExecStop=/bin/sh -c 'echo -n optee-ta-bc50d971-d4c9-42c4-82cb-
> > 343fb7f37896 > /sys/bus/tee/drivers/optee-ftpm/unbind || true'
> > +ExecStop=/bin/sh -c 'for dev in /sys/bus/tee/devices/*; do case
> > "$dev" in *optee-ta-*) basename "$dev" > "$dev"/driver/unbind;;
> > esac done'
> >  ExecStop=/usr/bin/pkill tee-supplicant
> >  
> >  [Install]
> 
> Would be nice to get this quickly merged as well, then we could drop
> all
> isar patches again downstream.
> 

The patch (as soon as another optee-client patch) are currently under
CI testing (together with 3rd version of HOST_ARCH* patchset which now
is OK with repro_test). If it passes OK (I expect by the end of the
day) the patches will be merged.

If there are some problems, I'll then check them separately.

> Jan
> 
> -- 
> Siemens AG, Technology
> Linux Expert Center
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] meta: optee-client: Generalize and update shutdown rule
  2023-10-12  7:15   ` Uladzimir Bely
@ 2023-10-12  7:23     ` Jan Kiszka
  0 siblings, 0 replies; 5+ messages in thread
From: Jan Kiszka @ 2023-10-12  7:23 UTC (permalink / raw)
  To: Uladzimir Bely, isar-users
  Cc: Su, Bao Cheng (RC-CN DF FA R&D),
	Lopes Ivo, Diogo Miguel (T CED IFD-PT)

On 12.10.23 09:15, Uladzimir Bely wrote:
> On Thu, 2023-10-12 at 09:01 +0200, 'Jan Kiszka' via isar-users wrote:
>> On 11.10.23 16:36, 'Jan Kiszka' via isar-users wrote:
>>> From: Jan Kiszka <jan.kiszka@siemens.com>
>>>
>>> First, naming changed somewhere between kernel 5.10 and 6.1 so that
>>> optee-ta-bc50d971... is now optee-ta-supp-bc50d971...
>>>
>>> And then we should account for possibly more devices that need to
>>> be
>>> unbound. Use POSIX-compliant shell code for this.
>>>
>>> The generic loop allows to drop the explicit unmounting of efivarfs
>>> because the corresponding driver will already get unbound.
>>>
>>> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
>>> ---
>>>  .../optee-client/files/debian/tee-supplicant.service           | 3
>>> +--
>>>  1 file changed, 1 insertion(+), 2 deletions(-)
>>>
>>> diff --git a/meta/recipes-bsp/optee-client/files/debian/tee-
>>> supplicant.service b/meta/recipes-bsp/optee-
>>> client/files/debian/tee-supplicant.service
>>> index cc92a5fd..d8b630a4 100644
>>> --- a/meta/recipes-bsp/optee-client/files/debian/tee-
>>> supplicant.service
>>> +++ b/meta/recipes-bsp/optee-client/files/debian/tee-
>>> supplicant.service
>>> @@ -13,8 +13,7 @@ Type=oneshot
>>>  RemainAfterExit=yes
>>>  # Start if not already started by the initramfs hook
>>>  ExecStart=/bin/sh -c '/usr/bin/pgrep tee-supplicant >/dev/null ||
>>> /usr/sbin/tee-supplicant -d'
>>> -ExecStop=/bin/sh -c '/usr/bin/findmnt /sys/firmware/efi/efivars
>>>> /dev/null && /usr/bin/umount /sys/firmware/efi/efivars || true'
>>> -ExecStop=/bin/sh -c 'echo -n optee-ta-bc50d971-d4c9-42c4-82cb-
>>> 343fb7f37896 > /sys/bus/tee/drivers/optee-ftpm/unbind || true'
>>> +ExecStop=/bin/sh -c 'for dev in /sys/bus/tee/devices/*; do case
>>> "$dev" in *optee-ta-*) basename "$dev" > "$dev"/driver/unbind;;
>>> esac done'
>>>  ExecStop=/usr/bin/pkill tee-supplicant
>>>  
>>>  [Install]
>>
>> Would be nice to get this quickly merged as well, then we could drop
>> all
>> isar patches again downstream.
>>
> 
> The patch (as soon as another optee-client patch) are currently under
> CI testing (together with 3rd version of HOST_ARCH* patchset which now
> is OK with repro_test). If it passes OK (I expect by the end of the
> day) the patches will be merged.
> 
> If there are some problems, I'll then check them separately.
> 

Great, thanks!

Jan

-- 
Siemens AG, Technology
Linux Expert Center


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] meta: optee-client: Generalize and update shutdown rule
  2023-10-11 14:36 [PATCH] meta: optee-client: Generalize and update shutdown rule Jan Kiszka
  2023-10-12  7:01 ` Jan Kiszka
@ 2023-10-12 17:24 ` Uladzimir Bely
  1 sibling, 0 replies; 5+ messages in thread
From: Uladzimir Bely @ 2023-10-12 17:24 UTC (permalink / raw)
  To: Jan Kiszka, isar-users

On Wed, 2023-10-11 at 16:36 +0200, 'Jan Kiszka' via isar-users wrote:
> From: Jan Kiszka <jan.kiszka@siemens.com>
> 
> First, naming changed somewhere between kernel 5.10 and 6.1 so that
> optee-ta-bc50d971... is now optee-ta-supp-bc50d971...
> 
> And then we should account for possibly more devices that need to be
> unbound. Use POSIX-compliant shell code for this.
> 
> The generic loop allows to drop the explicit unmounting of efivarfs
> because the corresponding driver will already get unbound.
> 
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> ---
>  .../optee-client/files/debian/tee-supplicant.service           | 3
> +--
>  1 file changed, 1 insertion(+), 2 deletions(-)

Applied to next, thanks.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-10-12 17:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-11 14:36 [PATCH] meta: optee-client: Generalize and update shutdown rule Jan Kiszka
2023-10-12  7:01 ` Jan Kiszka
2023-10-12  7:15   ` Uladzimir Bely
2023-10-12  7:23     ` Jan Kiszka
2023-10-12 17:24 ` Uladzimir Bely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox