From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-lj1-f171.google.com (mail-lj1-f171.google.com [209.85.208.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6983D747E for ; Tue, 21 Jun 2022 17:51:13 +0000 (UTC) Received: by mail-lj1-f171.google.com with SMTP id b23so7764804ljh.7 for ; Tue, 21 Jun 2022 10:51:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=/sWmRxaBB/7Gvydpg8oN2fyGVNJ3tXVZl0R1M5vQ/Us=; b=SIUQ2bfTgtqyKzjQXnVabWR9Z3n/VgrhU2riRxw0AgmXz5H2i9bjCSpp+euFcuWuLr btapNTHSb4sb6Dlc8c5EtrlKyvn9xrjsaMXEm7aPioRHs8rBMY+uZERTAzQmLVQnK1vN yKhxZkZUR82fcxHyRRqxyWHUHzDwy9sB8NRvzJ+vl/OwnzuaafTUAnsbscxCWGwt7jMB 59esRMJI0H8QHYn6id6vBjd3uYPVHJcFcswVldGJo9tbKjNdP2YqadzjvdVZprf72/is jTh2NPUKW0DrIwZ3k8Ui1RzbVJGEGC+pQhncUSl4DSXTSJGsx66cmG7eT/EtfXyb3aRj zdMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=/sWmRxaBB/7Gvydpg8oN2fyGVNJ3tXVZl0R1M5vQ/Us=; b=g/QSC7srerr0ZfrYe5cfknWxa96SObr+qI+gcDiZDLawauNtDNyi9JAnrHhDe+qOwU MhAmlTRlentwKMxfhPFKZeSJnhcElKxGg8by58heG2ZbNIgXJRhwQiyQwAzHmaM8sOAH 49282ygZjxT+aJDqxgzz6R7qAlqIxPZEnQdWefP4OjPK2rmNcAP0FyAN4E9ofTQyashM yoF0z0iMzT0t7/DDDvWSiqTIZzVihrTd3quSJfG7cSZTqhdbd1Pis7w1KSIuFKcr3UFW oPDsMlgGXFFYH3mnGBBbDiVPVdSsfxD6ugnG08USMPdI2yBnX32JkhgIcKQ9FoJpRfuV z8ug== X-Gm-Message-State: AJIora/LyZQ6ztggHHTKi/VHh9hH7yhIReobcVQuwIZWox6GGLDNwXs7 h6QIG3Fym9yk3z4E2r8l5+KWFrFXhX38vzKIBqyL7w== X-Google-Smtp-Source: AGRyM1u/rxKy61/kcfa19O8kX+IARHxZ6GtcuY38CjxLPfM7sYm5YakXgDPAfoWdCippLLsbDohcmMAiLcyZQHFOTn4= X-Received: by 2002:a2e:2a43:0:b0:25a:84a9:921c with SMTP id q64-20020a2e2a43000000b0025a84a9921cmr375799ljq.83.1655833871147; Tue, 21 Jun 2022 10:51:11 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-coco@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <12df64394b1788156c8a3c2ee8dfd62b51ab3a81.1655761627.git.ashish.kalra@amd.com> In-Reply-To: From: Peter Gonda Date: Tue, 21 Jun 2022 11:50:59 -0600 Message-ID: Subject: Re: [PATCH Part2 v6 02/49] iommu/amd: Introduce function to check SEV-SNP support To: "Kalra, Ashish" Cc: "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" , "jarkko@kernel.org" Content-Type: text/plain; charset="UTF-8" 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".