Message ID | 20230123152250.26413-6-jpiotrowski@linux.microsoft.com (mailing list archive) |
---|---|
State | Not Applicable |
Delegated to: | Herbert Xu |
Headers | show |
Series | Support ACPI PSP on Hyper-V | expand |
On 1/23/23 09:22, Jeremi Piotrowski wrote: > The PSP in Hyper-V VMs is exposed through the ASP ACPI table and is > represented as a platform_device. Allow the ccp driver to bind to it by > adding an id_table and initing the platform_driver also on x86. At this > point probe is called for the psp device but init fails due to missing > driver data. > > Signed-off-by: Jeremi Piotrowski <jpiotrowski@linux.microsoft.com> > --- > drivers/crypto/ccp/sp-dev.c | 8 ++++++-- > drivers/crypto/ccp/sp-platform.c | 7 +++++++ > 2 files changed, 13 insertions(+), 2 deletions(-) > > diff --git a/drivers/crypto/ccp/sp-dev.c b/drivers/crypto/ccp/sp-dev.c > index 7eb3e4668286..52b8d957d0f6 100644 > --- a/drivers/crypto/ccp/sp-dev.c > +++ b/drivers/crypto/ccp/sp-dev.c > @@ -258,7 +258,11 @@ static int __init sp_mod_init(void) > ret = sp_pci_init(); > if (ret) > return ret; > - Please keep the blank line here. > + ret = sp_platform_init(); > + if (ret) { > + sp_pci_exit(); > + return ret; > + } Add a blank line here. > #ifdef CONFIG_CRYPTO_DEV_SP_PSP > psp_pci_init(); > #endif > @@ -286,7 +290,7 @@ static void __exit sp_mod_exit(void) > #ifdef CONFIG_CRYPTO_DEV_SP_PSP > psp_pci_exit(); > #endif > - Please keep the blank line here. > + sp_platform_exit(); > sp_pci_exit(); > #endif > > diff --git a/drivers/crypto/ccp/sp-platform.c b/drivers/crypto/ccp/sp-platform.c > index 7d79a8744f9a..ea8926e87981 100644 > --- a/drivers/crypto/ccp/sp-platform.c > +++ b/drivers/crypto/ccp/sp-platform.c > @@ -56,6 +56,12 @@ static const struct of_device_id sp_of_match[] = { > MODULE_DEVICE_TABLE(of, sp_of_match); > #endif > > +static const struct platform_device_id sp_plat_match[] = { s/plat/platform/ Thanks, Tom > + { "psp" }, > + { }, > +}; > +MODULE_DEVICE_TABLE(platform, sp_plat_match); > + > static struct sp_dev_vdata *sp_get_of_version(struct platform_device *pdev) > { > #ifdef CONFIG_OF > @@ -212,6 +218,7 @@ static int sp_platform_resume(struct platform_device *pdev) > #endif > > static struct platform_driver sp_platform_driver = { > + .id_table = sp_plat_match, > .driver = { > .name = "ccp", > #ifdef CONFIG_ACPI
On 31/01/2023 20:51, Tom Lendacky wrote: > On 1/23/23 09:22, Jeremi Piotrowski wrote: >> The PSP in Hyper-V VMs is exposed through the ASP ACPI table and is >> represented as a platform_device. Allow the ccp driver to bind to it by >> adding an id_table and initing the platform_driver also on x86. At this >> point probe is called for the psp device but init fails due to missing >> driver data. >> >> Signed-off-by: Jeremi Piotrowski <jpiotrowski@linux.microsoft.com> >> --- >> drivers/crypto/ccp/sp-dev.c | 8 ++++++-- >> drivers/crypto/ccp/sp-platform.c | 7 +++++++ >> 2 files changed, 13 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/crypto/ccp/sp-dev.c b/drivers/crypto/ccp/sp-dev.c >> index 7eb3e4668286..52b8d957d0f6 100644 >> --- a/drivers/crypto/ccp/sp-dev.c >> +++ b/drivers/crypto/ccp/sp-dev.c >> @@ -258,7 +258,11 @@ static int __init sp_mod_init(void) >> ret = sp_pci_init(); >> if (ret) >> return ret; >> - > Please keep the blank line here.> ok >> + ret = sp_platform_init(); >> + if (ret) { >> + sp_pci_exit(); >> + return ret; >> + } > > Add a blank line here. > ok >> #ifdef CONFIG_CRYPTO_DEV_SP_PSP >> psp_pci_init(); >> #endif >> @@ -286,7 +290,7 @@ static void __exit sp_mod_exit(void) >> #ifdef CONFIG_CRYPTO_DEV_SP_PSP >> psp_pci_exit(); >> #endif >> - > > Please keep the blank line here. > ok >> + sp_platform_exit(); > sp_pci_exit(); >> #endif >> diff --git a/drivers/crypto/ccp/sp-platform.c b/drivers/crypto/ccp/sp-platform.c >> index 7d79a8744f9a..ea8926e87981 100644 >> --- a/drivers/crypto/ccp/sp-platform.c >> +++ b/drivers/crypto/ccp/sp-platform.c >> @@ -56,6 +56,12 @@ static const struct of_device_id sp_of_match[] = { >> MODULE_DEVICE_TABLE(of, sp_of_match); >> #endif >> +static const struct platform_device_id sp_plat_match[] = { > > s/plat/platform/ > ok > Thanks, > Tom > >> + { "psp" }, >> + { }, >> +}; >> +MODULE_DEVICE_TABLE(platform, sp_plat_match); >> + >> static struct sp_dev_vdata *sp_get_of_version(struct platform_device *pdev) >> { >> #ifdef CONFIG_OF >> @@ -212,6 +218,7 @@ static int sp_platform_resume(struct platform_device *pdev) >> #endif >> static struct platform_driver sp_platform_driver = { >> + .id_table = sp_plat_match, >> .driver = { >> .name = "ccp", >> #ifdef CONFIG_ACPI
diff --git a/drivers/crypto/ccp/sp-dev.c b/drivers/crypto/ccp/sp-dev.c index 7eb3e4668286..52b8d957d0f6 100644 --- a/drivers/crypto/ccp/sp-dev.c +++ b/drivers/crypto/ccp/sp-dev.c @@ -258,7 +258,11 @@ static int __init sp_mod_init(void) ret = sp_pci_init(); if (ret) return ret; - + ret = sp_platform_init(); + if (ret) { + sp_pci_exit(); + return ret; + } #ifdef CONFIG_CRYPTO_DEV_SP_PSP psp_pci_init(); #endif @@ -286,7 +290,7 @@ static void __exit sp_mod_exit(void) #ifdef CONFIG_CRYPTO_DEV_SP_PSP psp_pci_exit(); #endif - + sp_platform_exit(); sp_pci_exit(); #endif diff --git a/drivers/crypto/ccp/sp-platform.c b/drivers/crypto/ccp/sp-platform.c index 7d79a8744f9a..ea8926e87981 100644 --- a/drivers/crypto/ccp/sp-platform.c +++ b/drivers/crypto/ccp/sp-platform.c @@ -56,6 +56,12 @@ static const struct of_device_id sp_of_match[] = { MODULE_DEVICE_TABLE(of, sp_of_match); #endif +static const struct platform_device_id sp_plat_match[] = { + { "psp" }, + { }, +}; +MODULE_DEVICE_TABLE(platform, sp_plat_match); + static struct sp_dev_vdata *sp_get_of_version(struct platform_device *pdev) { #ifdef CONFIG_OF @@ -212,6 +218,7 @@ static int sp_platform_resume(struct platform_device *pdev) #endif static struct platform_driver sp_platform_driver = { + .id_table = sp_plat_match, .driver = { .name = "ccp", #ifdef CONFIG_ACPI
The PSP in Hyper-V VMs is exposed through the ASP ACPI table and is represented as a platform_device. Allow the ccp driver to bind to it by adding an id_table and initing the platform_driver also on x86. At this point probe is called for the psp device but init fails due to missing driver data. Signed-off-by: Jeremi Piotrowski <jpiotrowski@linux.microsoft.com> --- drivers/crypto/ccp/sp-dev.c | 8 ++++++-- drivers/crypto/ccp/sp-platform.c | 7 +++++++ 2 files changed, 13 insertions(+), 2 deletions(-)