Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp116132rwe; Wed, 24 Aug 2022 18:31:30 -0700 (PDT) X-Google-Smtp-Source: AA6agR7gPYIu/lVPg1OnqmTSv7hPbaLa6O7d7kb/k0+WBmjXhwOnnr6aMqxVn0WcuElQ4AtIBITP X-Received: by 2002:a17:90b:4c4a:b0:1fb:3c1b:b7f8 with SMTP id np10-20020a17090b4c4a00b001fb3c1bb7f8mr10923795pjb.98.1661391090267; Wed, 24 Aug 2022 18:31:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661391090; cv=none; d=google.com; s=arc-20160816; b=XkCC9qJ8XYtHm3cg7VHjFMQGGFfu5owToW88ctDn+c45t/mrfpkj3oGvtsRjzoP7IW CsJnKpJGDsmLAvdd/4hs3LUHNt87AjLJezu1RNPAX7DwWi+zpsWzNGh2w46dEY6ofkT4 9E6Dj3Zel66m7SBInvzKyfCXfF2NqVfLlR/qYeWT8u7n4LTw4q4pNgdM4wIrB1Y4fLtx pRe22fJm5ZY/z2r3J5uJQw/dR6JOJ7tt5yemSfvkBVAeSKhwCeOUhix2Bb7B3aygusRN swE6nlwVavRjxJ+9q6/tKPrCJHIx0sk/V2wDbXB4BNmY8oRRR1UaXNROs/9JHe+/npEx j3Kg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=9ui/Yw6byL2LoJsMiEYL4aFturK9lhk3UzGzRPF2vJI=; b=WeoqS5k1rb6MWNHvTHC9ozBMW1DO/YVHKU7UsDtNaO8DYQtHaxMTNHSsGxdGgBiVDk 4BMXLyp4QKQs13Ncnwh2VRhxMb+LQ1Gk5dxuewd+fhH1eq6MIQdc2pTRQgI9ExQO25Ap FDPCBXeSJ4nWcJEBvXOY+NiLJYf185gXhAUNoD4zR82v3gCW1unHoGma9u0o6W+T5Zvz eWSLj8rQNr1QWupcFy2eNuYzgtbdKJHqZyvP33VzBO42iLSIUL6Hmg/OZZKn1e0TrdY7 yuJb/e14bcbGGZei9jUOE5olJ8gQrusTYQTnWrVuGRqqn6dvzrpf88m6DVZv8wYhjozu qJqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=YAQB5VWX; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id oa5-20020a17090b1bc500b001facd1e581dsi2713395pjb.14.2022.08.24.18.31.17; Wed, 24 Aug 2022 18:31:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-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=@kernel.org header.s=k20201202 header.b=YAQB5VWX; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229573AbiHYBan (ORCPT + 99 others); Wed, 24 Aug 2022 21:30:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47512 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229463AbiHYBak (ORCPT ); Wed, 24 Aug 2022 21:30:40 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5DDD082D20; Wed, 24 Aug 2022 18:30:39 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E3C91B824CF; Thu, 25 Aug 2022 01:30:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 28307C433D6; Thu, 25 Aug 2022 01:30:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1661391036; bh=AIi+WB+TlhHAhAH6LiPvV1XFm+WV2u4SODERl2ylZH4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=YAQB5VWXYYKZ8tErqSiheGgiURg99+M043/Yb9HrvZCkWeiVR3iWc7+LvhFmTn+e8 HbHRXTt917nXlviebHmNlN+AaqWsirwij7iaaCwJdqghmYdMXcjvLfNwz2bX99ZeeF Mca1vW8EQQsrCTnFvLnpJqSjCTI3G92AYbjBcJ+2joeEZwMPuiePy5VwMZHm22I3kJ YQrKtVjJIENDlaug6amebL0DZbGC2VSH28nkDcr9h4yHUSxF2vKaMfXvHGmllYv8Eq ugR8IrvUtBgJvO0z3i8X/cpcG1guIFJ/1v6Z3AW+Qw643aXXYfVz9pMoW01H/YGK3O aQVm9iDHl/4HA== Date: Thu, 25 Aug 2022 04:30:29 +0300 From: Jarkko Sakkinen To: Peter Gonda Cc: "Kalra, Ashish" , the arch/x86 maintainers , LKML , kvm list , "linux-coco@lists.linux.dev" , "linux-mm@kvack.org" , Linux Crypto Mailing List , Thomas Gleixner , Ingo Molnar , Joerg Roedel , "Lendacky, Thomas" , "H. Peter Anvin" , Ard Biesheuvel , Paolo Bonzini , Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Andy Lutomirski , Dave Hansen , Sergio Lopez , Peter Zijlstra , Srinivas Pandruvada , David Rientjes , Dov Murik , Tobin Feldman-Fitzthum , Borislav Petkov , "Roth, Michael" , Vlastimil Babka , "Kirill A . Shutemov" , Andi Kleen , Tony Luck , Marc Orr , Sathyanarayanan Kuppuswamy , Alper Gun , "Dr. David Alan Gilbert" Subject: Re: [PATCH Part2 v6 02/49] iommu/amd: Introduce function to check SEV-SNP support Message-ID: References: <12df64394b1788156c8a3c2ee8dfd62b51ab3a81.1655761627.git.ashish.kalra@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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: X-Mailing-List: linux-crypto@vger.kernel.org On Thu, Aug 25, 2022 at 04:28:12AM +0300, jarkko@kernel.org wrote: > On Tue, Jun 21, 2022 at 11:50:59AM -0600, Peter Gonda wrote: > > On Tue, Jun 21, 2022 at 11:45 AM Kalra, Ashish wrote: > > > > > > [AMD Official Use Only - General] > > > > > > Hello Peter, > > > > > > >> +bool iommu_sev_snp_supported(void) > > > >> +{ > > > >> + struct amd_iommu *iommu; > > > >> + > > > >> + /* > > > >> + * The SEV-SNP support requires that IOMMU must be enabled, and is > > > >> + * not configured in the passthrough mode. > > > >> + */ > > > >> + if (no_iommu || iommu_default_passthrough()) { > > > >> + pr_err("SEV-SNP: IOMMU is either disabled or > > > >> + configured in passthrough mode.\n"); > > > > > > > Like below could this say something like snp support is disabled because of iommu settings. > > > > > > Here we may need to be more precise with the error information indicating why SNP is not enabled. > > > Please note that this patch may actually become part of the IOMMU + SNP patch series, where > > > additional checks are done, for example, not enabling SNP if IOMMU v2 page tables are enabled, > > > so precise error information will be useful here. > > > > I agree we should be more precise. I just thought we should explicitly > > state something like: "SEV-SNP: IOMMU is either disabled or configured > > in passthrough mode, SNP cannot be supported". > > It really should be, in order to have any practical use: > > if (no_iommu) { > pr_err("SEV-SNP: IOMMU is disabled.\n"); > return false; > } > > if (iommu_default_passthrough()) { > pr_err("SEV-SNP: IOMMU is configured in passthrough mode.\n"); > return false; > } > > The comment is *completely* redundant, it absolutely does > not serve any sane purpose. It just tells what the code > already clearly stating. > > The combo error message on the other hand leaves you to > the question "which one was it", and for that reason > combining the checks leaves you to a louse debugging > experience. Also, are those really *errors*? That implies that there is something wrong. Since you can have a legit configuration, IMHO they should be either warn or info. What do you think? They are definitely not errors. BR, Jarkko