Message ID | 20230123152250.26413-8-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 s9csp1673507wrn; Mon, 23 Jan 2023 07:38:51 -0800 (PST) X-Google-Smtp-Source: AMrXdXuMsR1CXzwJA2UjBBqpvosnG9utyAtBshLglpX/i2Mn1WFkpLNuuk0Rrl/ViQSOxduPDAr+ X-Received: by 2002:a17:907:2135:b0:86f:fe8a:be with SMTP id qo21-20020a170907213500b0086ffe8a00bemr25788416ejb.4.1674488331172; Mon, 23 Jan 2023 07:38:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674488331; cv=none; d=google.com; s=arc-20160816; b=xEcrZNJdlDve3Jd+yvzA1zyGoyng9qIAVHShgmmr4NYxY0vEsVvRRH3w5LSfVqzrep 8aON6F2aifEqd/ZHnuAA1WWLmajegw/PMAH4FH0IVBkAm0zdLpqIyvKseLnW1ar69WpB r8p9R0nQj3ZiqTecGwfQibnnIfQ0WiDdRUOhKkxyVhzRn6EXCaYUbzy1dvPn1ERWoESa jod7EZ+FXzkZmpHXMFCF7lm5DT5/XGJ/bWFmYAR3ilNqLl//G9TQIFJBtroe7asbR4AJ Bu99s6so7eqTeR+UtmZxnjsCxAIn40SF1KIrxwz+j69qYKepJeg9rAC2Yv2fOZzDT86I AHWg== 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=f6pZHu6WA/l0Wr6r6xjwOggDdU/mGOH5y0VgIu48aRI=; b=PjIDCoUQGmhruykmWarLn9GF/t6n7arjLI61ljP2nmbABKlwGTWOFd/gk1uDHN3bJi qFkjugSmgm6KPoEq9wxBjBG0Zz5Xzc1m1gmYZFkDmeKlzHiXMIkL7GDogexEl0KpsCWg DWypDY4xyYkdJlFMR0fREYXc0heScKkU0xXD+eSSACXYFvy+hf5cfcYZIMsUAYNYLADl dxAzuHu3lfXkSdKsVRYh1gkQLuUT7+UHp21yDOY4LNlJSAuIG1vuZCW7lZAG9L7g1Cn5 KY7ruwk0G3MF7eacJJVFekut3TAItj+yu98wFzNeQi1LOifOVv9I1a9VGL1i4D0zWN+o KSTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=CTpL+hP1; 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 hd8-20020a170907968800b0086b6a3fd247si15452686ejc.557.2023.01.23.07.38.27; Mon, 23 Jan 2023 07:38:51 -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=CTpL+hP1; 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 S232515AbjAWPZT (ORCPT <rfc822;liningstudo@gmail.com> + 99 others); Mon, 23 Jan 2023 10:25:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55656 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232755AbjAWPYs (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 23 Jan 2023 10:24:48 -0500 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 71EEA2A990; Mon, 23 Jan 2023 07:24:26 -0800 (PST) Received: from vm02.corp.microsoft.com (unknown [167.220.196.155]) by linux.microsoft.com (Postfix) with ESMTPSA id 45FBE20E2D1C; Mon, 23 Jan 2023 07:23:40 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 45FBE20E2D1C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1674487421; bh=f6pZHu6WA/l0Wr6r6xjwOggDdU/mGOH5y0VgIu48aRI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CTpL+hP1jfHwJgIWyL5E02ar+Ivbg7F3vb3yLQyVIcOQ1EDXh1m4ST7PyAUL2S7Eo Ke9aI0JmACwIMQToFpulqUUS+D2RpYR/H7yKH4hwSNaPWlXbaDcYA+YFz8omtw+XMd 3mPd6S6VqHES18GPFY8B/pjM2NqtWQoY77jGuvlw= 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 7/8] crypto: ccp - Skip DMA coherency check for platform psp Date: Mon, 23 Jan 2023 15:22:49 +0000 Message-Id: <20230123152250.26413-8-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?1755828276066668809?= X-GMAIL-MSGID: =?utf-8?q?1755828276066668809?= |
Series |
Support ACPI PSP on Hyper-V
|
|
Commit Message
Jeremi Piotrowski
Jan. 23, 2023, 3:22 p.m. UTC
The value of device_get_dma_attr() is only relevenat for ARM64 and CCP
devices to configure the value of the axcache attribute used to access
memory by the coprocessor. None of this applies to the platform psp so
skip it.
Signed-off-by: Jeremi Piotrowski <jpiotrowski@linux.microsoft.com>
---
drivers/crypto/ccp/sp-platform.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
Comments
On 1/23/23 09:22, Jeremi Piotrowski wrote: > The value of device_get_dma_attr() is only relevenat for ARM64 and CCP > devices to configure the value of the axcache attribute used to access > memory by the coprocessor. None of this applies to the platform psp so > skip it. > > Signed-off-by: Jeremi Piotrowski <jpiotrowski@linux.microsoft.com> > --- > drivers/crypto/ccp/sp-platform.c | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/drivers/crypto/ccp/sp-platform.c b/drivers/crypto/ccp/sp-platform.c > index 281dbf6b150c..b74f16e0e963 100644 > --- a/drivers/crypto/ccp/sp-platform.c > +++ b/drivers/crypto/ccp/sp-platform.c > @@ -29,6 +29,7 @@ > struct sp_platform { > int coherent; > unsigned int irq_count; > + bool is_platform; s/is_platform/is_platform_device/ > }; > > #ifdef CONFIG_CRYPTO_DEV_SP_PSP > @@ -190,8 +191,10 @@ static int sp_platform_probe(struct platform_device *pdev) > sp->dev_specific = sp_platform; > sp->dev_vdata = pdev->dev.of_node ? sp_get_of_version(pdev) > : sp_get_acpi_version(pdev); > - if (!sp->dev_vdata && pdev->id_entry) > + if (!sp->dev_vdata && pdev->id_entry) { > + sp_platform->is_platform = true; Move this into the sp_get_plat_version() function. > sp->dev_vdata = sp_get_plat_version(pdev); And I probably should have made this comment in the previous patch, but you should probably spell out platform here. > + } > if (!sp->dev_vdata) { > ret = -ENODEV; > dev_err(dev, "missing driver data\n"); > @@ -205,7 +208,7 @@ static int sp_platform_probe(struct platform_device *pdev) > } > > attr = device_get_dma_attr(dev); > - if (attr == DEV_DMA_NOT_SUPPORTED) { > + if (!sp_platform->is_platform && attr == DEV_DMA_NOT_SUPPORTED) { Just a nit but I'd prefer to see this as: if (attr == DEV_DMA_NOT_SUPPORTED && !sp_platform->is_platform) { The diff is easier to see that way. Thanks, Tom > dev_err(dev, "DMA is not supported"); > goto e_err; > }
On 31/01/2023 21:42, Tom Lendacky wrote: > On 1/23/23 09:22, Jeremi Piotrowski wrote: >> The value of device_get_dma_attr() is only relevenat for ARM64 and CCP >> devices to configure the value of the axcache attribute used to access >> memory by the coprocessor. None of this applies to the platform psp so >> skip it. >> >> Signed-off-by: Jeremi Piotrowski <jpiotrowski@linux.microsoft.com> >> --- >> drivers/crypto/ccp/sp-platform.c | 7 +++++-- >> 1 file changed, 5 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/crypto/ccp/sp-platform.c b/drivers/crypto/ccp/sp-platform.c >> index 281dbf6b150c..b74f16e0e963 100644 >> --- a/drivers/crypto/ccp/sp-platform.c >> +++ b/drivers/crypto/ccp/sp-platform.c >> @@ -29,6 +29,7 @@ >> struct sp_platform { >> int coherent; >> unsigned int irq_count; >> + bool is_platform; > > s/is_platform/is_platform_device/ > ok >> }; >> #ifdef CONFIG_CRYPTO_DEV_SP_PSP >> @@ -190,8 +191,10 @@ static int sp_platform_probe(struct platform_device *pdev) >> sp->dev_specific = sp_platform; >> sp->dev_vdata = pdev->dev.of_node ? sp_get_of_version(pdev) >> : sp_get_acpi_version(pdev); >> - if (!sp->dev_vdata && pdev->id_entry) >> + if (!sp->dev_vdata && pdev->id_entry) { >> + sp_platform->is_platform = true; > > Move this into the sp_get_plat_version() function. > >> sp->dev_vdata = sp_get_plat_version(pdev); > > And I probably should have made this comment in the previous patch, but you should probably spell out platform here. > ok (i had done that before i got to this comment for consistency) >> + } >> if (!sp->dev_vdata) { >> ret = -ENODEV; >> dev_err(dev, "missing driver data\n"); >> @@ -205,7 +208,7 @@ static int sp_platform_probe(struct platform_device *pdev) >> } >> attr = device_get_dma_attr(dev); >> - if (attr == DEV_DMA_NOT_SUPPORTED) { >> + if (!sp_platform->is_platform && attr == DEV_DMA_NOT_SUPPORTED) { > > Just a nit but I'd prefer to see this as: > > if (attr == DEV_DMA_NOT_SUPPORTED && !sp_platform->is_platform) { > > The diff is easier to see that way. makes sense > > Thanks, > Tom > >> dev_err(dev, "DMA is not supported"); >> goto e_err; >> }
diff --git a/drivers/crypto/ccp/sp-platform.c b/drivers/crypto/ccp/sp-platform.c index 281dbf6b150c..b74f16e0e963 100644 --- a/drivers/crypto/ccp/sp-platform.c +++ b/drivers/crypto/ccp/sp-platform.c @@ -29,6 +29,7 @@ struct sp_platform { int coherent; unsigned int irq_count; + bool is_platform; }; #ifdef CONFIG_CRYPTO_DEV_SP_PSP @@ -190,8 +191,10 @@ static int sp_platform_probe(struct platform_device *pdev) sp->dev_specific = sp_platform; sp->dev_vdata = pdev->dev.of_node ? sp_get_of_version(pdev) : sp_get_acpi_version(pdev); - if (!sp->dev_vdata && pdev->id_entry) + if (!sp->dev_vdata && pdev->id_entry) { + sp_platform->is_platform = true; sp->dev_vdata = sp_get_plat_version(pdev); + } if (!sp->dev_vdata) { ret = -ENODEV; dev_err(dev, "missing driver data\n"); @@ -205,7 +208,7 @@ static int sp_platform_probe(struct platform_device *pdev) } attr = device_get_dma_attr(dev); - if (attr == DEV_DMA_NOT_SUPPORTED) { + if (!sp_platform->is_platform && attr == DEV_DMA_NOT_SUPPORTED) { dev_err(dev, "DMA is not supported"); goto e_err; }