Message ID | 20230123152250.26413-6-jpiotrowski@linux.microsoft.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1673395wrn; Mon, 23 Jan 2023 07:38:37 -0800 (PST) X-Google-Smtp-Source: AMrXdXv7y9BSgWyGFcXNwyuFHxZZP0cYTlAEEcdIUWeFDToDAKiBekpESfJrzX4zp+WqdJW0XTJZ X-Received: by 2002:aa7:cd59:0:b0:494:912d:303b with SMTP id v25-20020aa7cd59000000b00494912d303bmr24447566edw.17.1674488317094; Mon, 23 Jan 2023 07:38:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674488317; cv=none; d=google.com; s=arc-20160816; b=G4j+/A/nUpSaDq46GFzVlP+lnD1+yatFbnNiQj1DE0dqMBQkgtkvXIJ40GELber4mD +7D+GCIXG9YQUAyOED7gKMz0u4ffYgygiuXrkpnQRT3U7JQn6yTOFata4mBQYz1RifQQ wXeDKl0bDWIP9zlQLrp3ym5vRzYEluc68dnjIF0Y+q2lkjx4OtIdSaecL2Gglm0gxZPe YBjHaTfkMjkdciW3tU3EK+tC3uuMZJ4ZwJzTFDhBm9htHsUZlFMjxqT81/s1qSaE3bMY CcLQB57zvauaTvew4liphfelsbXQZPDA8GedXeiVKkEb1wAAYJ1GY4y0uRYaTK2+7d8Z D+5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=ZRr5emoAjwsKHLORaeHN0pRgcw3vJaLO85YWOsHBP7M=; b=JsczSFvhn32jk2q0n35gd/h0LnPCjhPf1SDmHmWnQ6+kLpdjsomm+KwiibI5EnQ4Br gB+IFfWNc5uZdF/jvAyoC9wuXIMg5jQWf2ZllHFhGPzSwmEBs4Jhox1d4/xZ6dDaXN0J kRg02tSR/9J23ZT5IKH/Y3YAjforOeBm9nGp74stc2+nXRUEByJIL/QYGPxHWGe9aIpP aGD9o7gbmK4xoAfVVLMC1/+RBmaUMd8kTkBovm2/aJpkKYqcvdTs9omLlgalxmlL/YbL KPC42us0T0ieB8dGPOQqCdDqiSVjFjrB7xRUfEa3h4zfUFdfIGCGyro8QuZdQ2ZRCcte gTHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=BWIKbfSO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ds18-20020a170907725200b007fed8db38a8si3112464ejc.114.2023.01.23.07.38.13; Mon, 23 Jan 2023 07:38:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=BWIKbfSO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232036AbjAWPZQ (ORCPT <rfc822;liningstudo@gmail.com> + 99 others); Mon, 23 Jan 2023 10:25:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55518 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232747AbjAWPYq (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 23 Jan 2023 10:24:46 -0500 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id CD9D429E14; Mon, 23 Jan 2023 07:24:25 -0800 (PST) Received: from vm02.corp.microsoft.com (unknown [167.220.196.155]) by linux.microsoft.com (Postfix) with ESMTPSA id CFB7320E2D17; Mon, 23 Jan 2023 07:23:35 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com CFB7320E2D17 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1674487416; bh=ZRr5emoAjwsKHLORaeHN0pRgcw3vJaLO85YWOsHBP7M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BWIKbfSO9UWd7qMXcBTSiPeJnP/HB4O6zvUwhR8md4LIvss8UxStEY6iOg4rq3GJy XMLY9NJLgoKvARIO6sHAJmgJC19D4EZwbyVdqYiqVw6jxNo98NaKaz9mt6sMxOxd2O pQJwIIuO2wbw3SjO9y9yLwaTE00Xg4Sta9cCOP4M= From: Jeremi Piotrowski <jpiotrowski@linux.microsoft.com> To: linux-kernel@vger.kernel.org Cc: "Brijesh Singh" <brijesh.singh@amd.com>, "Tom Lendacky" <thomas.lendacky@amd.com>, "Kalra, Ashish" <ashish.kalra@amd.com>, linux-crypto@vger.kernel.org, Jeremi Piotrowski <jpiotrowski@linux.microsoft.com> Subject: [PATCH v1 5/8] crypto: cpp - Bind to psp platform device on x86 Date: Mon, 23 Jan 2023 15:22:47 +0000 Message-Id: <20230123152250.26413-6-jpiotrowski@linux.microsoft.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230123152250.26413-1-jpiotrowski@linux.microsoft.com> References: <20230123152250.26413-1-jpiotrowski@linux.microsoft.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-19.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755828261606153544?= X-GMAIL-MSGID: =?utf-8?q?1755828261606153544?= |
Series |
Support ACPI PSP on Hyper-V
|
|
Commit Message
Jeremi Piotrowski
Jan. 23, 2023, 3:22 p.m. UTC
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(-)
Comments
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