From: Greg KH <gregkh@linuxfoundation.org>
To: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
Cc: Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
x86@kernel.org, Shuah Khan <shuah@kernel.org>,
Jonathan Corbet <corbet@lwn.net>,
"H . Peter Anvin" <hpa@zytor.com>,
"Kirill A . Shutemov" <kirill.shutemov@linux.intel.com>,
Tony Luck <tony.luck@intel.com>,
Wander Lairson Costa <wander@redhat.com>,
Erdem Aktas <erdemaktas@google.com>,
Guorui Yu <GuoRui.Yu@linux.alibaba.com>,
Du Fan <fan.du@intel.com>,
linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
linux-doc@vger.kernel.org
Subject: Re: [PATCH v1 2/3] virt: tdx-guest: Add Quote generation support
Date: Sun, 26 Mar 2023 08:34:53 +0200 [thread overview]
Message-ID: <ZB/njYsTTwgTtAeA@kroah.com> (raw)
In-Reply-To: <20230326062039.341479-3-sathyanarayanan.kuppuswamy@linux.intel.com>
On Sat, Mar 25, 2023 at 11:20:38PM -0700, Kuppuswamy Sathyanarayanan wrote:
> Since GetQuote support requires usage of DMA APIs, convert TDX guest
> driver to a platform driver.
Sorry, but that's not a valid reason to use a platform device for fake
things like this:
> +static struct platform_device *tdx_dev;
Especially a single static one.
> +static int tdx_guest_probe(struct platform_device *pdev)
> +{
> + if (tdx_register_event_irq_cb(attestation_callback_handler, pdev))
> + return -EIO;
> +
> + return misc_register(&tdx_misc_dev);
> +}
> +
> +static int tdx_guest_remove(struct platform_device *pdev)
> +{
> + tdx_unregister_event_irq_cb(attestation_callback_handler, pdev);
> + misc_deregister(&tdx_misc_dev);
> + return 0;
> +}
> +
> +static struct platform_driver tdx_guest_driver = {
> + .probe = tdx_guest_probe,
> + .remove = tdx_guest_remove,
> + .driver.name = KBUILD_MODNAME,
> +};
> +
> static const struct x86_cpu_id tdx_guest_ids[] = {
> X86_MATCH_FEATURE(X86_FEATURE_TDX_GUEST, NULL),
> {}
> @@ -84,16 +310,35 @@ MODULE_DEVICE_TABLE(x86cpu, tdx_guest_ids);
>
> static int __init tdx_guest_init(void)
> {
> + int ret;
> +
> if (!x86_match_cpu(tdx_guest_ids))
> return -ENODEV;
>
> - return misc_register(&tdx_misc_dev);
> + ret = platform_driver_register(&tdx_guest_driver);
> + if (ret) {
> + pr_err("failed to register driver, err=%d\n", ret);
> + return ret;
> + }
No, please do not create a fake platform driver.
> + tdx_dev = platform_device_register_simple(KBUILD_MODNAME,
> + PLATFORM_DEVID_NONE,
> + NULL, 0);
And please do not create a fake platform device.
As always, do not create fake platform devices for things that are NOT
platform devices.
If this device needs DMA (but why?) then make it a real device and tie
it to the bus it belongs to (that it is obviously doing DMA on.)
But as-is, this isn't ok, sorry.
thanks,
greg k-h
next prev parent reply other threads:[~2023-03-26 6:35 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-26 6:20 [PATCH v1 0/3] TDX Guest Quote generation support Kuppuswamy Sathyanarayanan
2023-03-26 6:20 ` [PATCH v1 1/3] x86/tdx: Add TDX Guest event notify interrupt support Kuppuswamy Sathyanarayanan
2023-03-28 2:38 ` Huang, Kai
2023-03-28 2:50 ` Sathyanarayanan Kuppuswamy
2023-03-28 4:02 ` Huang, Kai
2023-04-05 1:02 ` Sathyanarayanan Kuppuswamy
2023-04-05 2:45 ` Huang, Kai
2023-03-26 6:20 ` [PATCH v1 2/3] virt: tdx-guest: Add Quote generation support Kuppuswamy Sathyanarayanan
2023-03-26 6:34 ` Greg KH [this message]
2023-03-26 19:06 ` Sathyanarayanan Kuppuswamy
2023-03-27 6:30 ` Greg KH
2023-03-26 6:20 ` [PATCH v1 3/3] selftests/tdx: Test GetQuote TDX attestation feature Kuppuswamy Sathyanarayanan
2023-03-28 20:24 ` Shuah Khan
2023-03-27 17:36 ` [PATCH v1 0/3] TDX Guest Quote generation support Erdem Aktas
2023-03-28 19:59 ` Dionna Amalie Glaze
2023-03-28 20:43 ` Chong Cai
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=ZB/njYsTTwgTtAeA@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=GuoRui.Yu@linux.alibaba.com \
--cc=bp@alien8.de \
--cc=corbet@lwn.net \
--cc=dave.hansen@linux.intel.com \
--cc=erdemaktas@google.com \
--cc=fan.du@intel.com \
--cc=hpa@zytor.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=sathyanarayanan.kuppuswamy@linux.intel.com \
--cc=shuah@kernel.org \
--cc=tglx@linutronix.de \
--cc=tony.luck@intel.com \
--cc=wander@redhat.com \
--cc=x86@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