Re: [RFC PATCH v1 11/38] KVM: arm64: CCA: register host tsm platform device

Jeremy Linton
2025-10-10T15:14:21Z

Hi,

On 10/10/25 7:38 AM, Greg KH wrote:
> On Fri, Oct 10, 2025 at 07:10:58AM -0500, Jeremy Linton wrote:
>> Hi,
>>
>>
>> On 7/30/25 8:07 AM, Greg KH wrote:
>>> On Wed, Jul 30, 2025 at 01:23:33PM +0100, Jonathan Cameron wrote:
>>>> On Wed, 30 Jul 2025 11:38:27 +0100
>>>> Jonathan Cameron <Jonathan.Cameron@huawei.com> wrote:
>>>>
>>>>> On Wed, 30 Jul 2025 14:12:26 +0530
>>>>> "Aneesh Kumar K.V" <aneesh.kumar@kernel.org> wrote:
>>>>>
>>>>>> Jason Gunthorpe <jgg@ziepe.ca> writes:
>>>>>>> On Tue, Jul 29, 2025 at 06:10:45PM +0100, Jonathan Cameron wrote:
>>>>>>>>> +static struct platform_device cca_host_dev = {
>>>>>>>> Hmm. Greg is getting increasingly (and correctly in my view) grumpy with
>>>>>>>> platform devices being registered with no underlying resources etc as glue
>>>>>>>> layers. Maybe some of that will come later.
>>>>>>>
>>>>>>> Is faux_device a better choice? I admit to not knowing entirely what
>>>>>>> it is for..
>>>>>
>>>>> I'll go with a cautious yes to faux_device. This case of a glue device
>>>>> with no resources and no reason to be on a particular bus was definitely
>>>>> the intent but I'm not 100% sure without trying it that we don't run
>>>>> into any problems.
>>>>>
>>>>> Not that many examples yet, but cpuidle-psci.c looks like a vaguely similar
>>>>> case to this one.
>>>>>
>>>>> All it really does is move the location of the device and
>>>>> smash together the device registration with probe/remove.
>>>>> That means the device disappears if probe() fails, which is cleaner
>>>>> in many ways than leaving a pointless stub behind.
>>>>>
>>>>> Maybe it isn't appropriate it if is actually useful to rmmod/modprobe the
>>>>> driver.
>>>>>
>>>>> +CC Greg on basis I may have wrong end of the stick ;)
>>>> This time with at least one less typo in Greg's email address.
>>>
>>> Yes, use faux_device if you need/want a struct device to represent
>>> something in the tree and it does NOT have any real platform resources
>>> behind it. That's explicitly what it was designed for.
>>
>> Right, but this code is intended to trigger the kmod/userspace module
>> loader.
>
> Why?

Originally it was because without the tsm drivers loaded there wasn't
any way for a CCA guest to know it is running in a confidential compute
environment. That is a bit of a problem for generic distro kernels which
don't want to load a bunch of functionality on devices that don't
support it. So, this triggers the tsm module load, which in turn
provides enough metadata for userspace to start attestation/whatever it
needs. (Ex: systemd-detect-virt --cvm).

I think Jason clarifies whats going on too.

>
>> AFAIK, the faux device is currently missing a faux_device_id in
>> mod_devicetable, alias matching logic in file2alias, and probably a few
>> other things which keeps it from performing this function.
>
> How would a faux device ever expect to get auto-loaded? That's not what
> is supposed to be happening here at all.
>
> If you have real hardware backing something, then use the real driver
> type. that is NOT a faux driver, which is, as the name says, for "fake"
> devices that you wish to add to the device/driver tree.
>
> thanks,
>
> greg k-h