public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Gavin Shan <gshan@redhat.com>
To: Jeremy Linton <jeremy.linton@arm.com>,
	linux-arm-kernel@lists.infradead.org
Cc: steven.price@arm.com, suzuki.poulose@arm.com,
	catalin.marinas@arm.com, will@kernel.org, sami.mujawar@arm.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] arm64: rsi: Add automatic arm-cca-guest module loading
Date: Thu, 31 Oct 2024 13:12:25 +1000	[thread overview]
Message-ID: <2e94df8e-ab9b-4214-86d0-e9efaa40aaf8@redhat.com> (raw)
In-Reply-To: <86b2aef1-8926-47c8-8a33-9f02e3dd7d72@arm.com>

Hi Jeremy

On 10/31/24 12:08 PM, Jeremy Linton wrote:
> On 10/30/24 5:48 PM, Gavin Shan wrote:
>> On 10/31/24 1:16 AM, Jeremy Linton wrote:
>>> On 10/29/24 7:23 PM, Gavin Shan wrote:
>>>> On 10/30/24 12:11 AM, Jeremy Linton wrote:
>>>>> The TSM module provides both guest identification as well as
>>>>> attestation when a guest is run in CCA mode. Lets assure by creating a
>>>>> dummy platform device that the module is automatically loaded during
>>>>> boot. Once it is in place it can be used earlier in the boot process
>>>>> to say decrypt a LUKS rootfs.
>>>>>
>>>>> Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
>>>>> ---
>>>>>   arch/arm64/include/asm/rsi.h                    |  2 ++
>>>>>   arch/arm64/kernel/rsi.c                         | 15 +++++++++++++++
>>>>>   drivers/virt/coco/arm-cca-guest/arm-cca-guest.c |  7 +++++++
>>>>>   3 files changed, 24 insertions(+)
>>>>>
>>>>
>>>> I don't understand how the TSM module is automatically loaded and arm_cca_guest_init()
>>>> is triggered because of the newly introduced platform device. Could you please provide
>>>> more details? Apart from it, some nick-picks as below.
>>>
>>> I think your asking how the module boilerplate here works, AKA how the standard uevent/udev/modalias/kmod stuff works? The short version is that the platform bus uevents an add device with a modalias and userspace udev + kmod finds matching modules, and their dependencies, and loads them which triggers the module_init() calls.
>>>
>>> The suse folks have a detailed description of how this works:
>>> https://doc.opensuse.org/documentation/leap/reference/html/book- reference/cha-udev.html#sec-udev-kernel
>>>
>>> So, this is a fairly common misuse of the platform bus, in this case to avoid needing a HWCAP. Assuring the module exists in the initrd will then result in it being loaded along any other modules required for the rootfs pivot.
>>>
>>>
>>
>> Thanks for the explanation and details. The module won't be automatically loaded if
>> udev daemon isn't in place or the DEV_ADD event is ignored for whatever reasons. For
>> example the corresponding ACTION for DEV_ADD of this particular device is null in the
>> udev rules. So it's not guranteed that the module can be automatically loaded until udev
>> is in place and udev rules have been configured properly. It's a best- effort attempt
>> if I don't miss anything.
> 
> This functionality has been standard in all but the most deeply enmbedded linux systems for a couple decades now (AFAIK). The platform and modalias logic should largely just work everywhere that its appropriate to be building this as a module. And to be clear that is without updating any of the existing rules.
> 

Right, it's also what I understood. What I requested is just to mention it
in the change log if you agree, something like below. With this, the change
log looks complete to me.

"The TSM module will be loaded by udev daemon after it receives the device addition event."

>>
>> Could you please update the change log to mention the automatic module loading depends
>> on udev and its rules? In this way, readers will know it's a best-effort attempt at least.
>>

Thanks,
Gavin


  reply	other threads:[~2024-10-31  3:12 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-29 14:11 [PATCH] arm64: rsi: Add automatic arm-cca-guest module loading Jeremy Linton
2024-10-30  0:23 ` Gavin Shan
2024-10-30 15:16   ` Jeremy Linton
2024-10-30 22:48     ` Gavin Shan
2024-10-31  2:08       ` Jeremy Linton
2024-10-31  3:12         ` Gavin Shan [this message]
2024-11-01 17:39 ` kernel test robot
2024-11-01 18:01 ` kernel test robot

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=2e94df8e-ab9b-4214-86d0-e9efaa40aaf8@redhat.com \
    --to=gshan@redhat.com \
    --cc=catalin.marinas@arm.com \
    --cc=jeremy.linton@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sami.mujawar@arm.com \
    --cc=steven.price@arm.com \
    --cc=suzuki.poulose@arm.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox