Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp3648756pxb; Fri, 4 Feb 2022 13:14:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJxzUoLnwubVNsA+OQWxPm/QahMZxOPMJUW9VMtoTl44IRLSDHmcwi4HIhqxIfdOFh5/pIh5 X-Received: by 2002:a17:902:dac8:: with SMTP id q8mr5019704plx.41.1644009271937; Fri, 04 Feb 2022 13:14:31 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1644009271; cv=pass; d=google.com; s=arc-20160816; b=MTnbpTGPVKFonWOAE0HXU7IQ4fsAydsuYUZIddpPmQGkRuHJWE0ipnxKqxYw4rtZqe WXmZUSapIYZ9Sg6q0eu1LTVugdpOkdBLbuvDMPH6eehDf/pBlOPD15Lt0EKIIuBeMxlT r+iAdjdIiWowoiQ3dWLuY/QO8ROZnkYoAuA07YXBJ1e5TZSqxYdZQENwhK+iAAzk0JKg j+zvcNNaRqEePDRKiw8uWN9CcWRkyqf8mCKGAT/l1Wr5CCeVff7Mj6AzTVNhw1MO/MT8 Z1KOX9Zku+71vAnDszpfcYpcgljGq1/y4heaGnAGomR4VFc2F5wTetJ9QChBz5OlAZRu OewQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :in-reply-to:from:references:cc:to:content-language:subject :user-agent:date:message-id:dkim-signature; bh=WRnAnjnHUGz91ffWoU6zpSoCpSQI1c5xMtwpfXY9KsI=; b=e2SAMPAV7PmCE+OEdADUh5QaCGdrVHCiaCfze2J3RGSItEm2uPpU++jeTF7MnuUEK/ EfXj1NVDkbW7mCyxA76ijjxczGO0/NchTuFZ53iBacPFwxGL/dneA4uyqSpclfgR674A kes64LN2nTVPWvsvzKtsoFNp8R0HSl6zurmJpL/qKPcMKx2q3SvJZOZSW2uBgJud/VSe NxA5dWHk0VMg8lp53uAaoqEXVC/Ts2leVGPIwHTn3jGueOf1SHMDYrWB4QeIE7/O8/vD LUW7ukH1OBZqK5a85m+7trzH2NtXZEZIbQ0p1Pcjpz7LPvfH3ma6MkZjAmhL9OHZA4dJ cULQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=aJ7xEZX3; arc=pass (i=1); 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l184si3017401pge.75.2022.02.04.13.14.20; Fri, 04 Feb 2022 13:14:31 -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=@amd.com header.s=selector1 header.b=aJ7xEZX3; arc=pass (i=1); 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235518AbiBDRt3 (ORCPT + 99 others); Fri, 4 Feb 2022 12:49:29 -0500 Received: from mail-dm6nam12on2044.outbound.protection.outlook.com ([40.107.243.44]:59242 "EHLO NAM12-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S241900AbiBDRt2 (ORCPT ); Fri, 4 Feb 2022 12:49:28 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=a+u8XqLHwIZgdy7+0SNGbzaDYNIT7YbqAnFiukmPvM4g8kEWR+8D1pVheBzSXnN+Y8B71UccFsaj4n+lqyscJbwR0jn5lgfdeT246jqcKJC13/dTxt1knkF44MoDQZ81zSuqWVP/EodsA1GL8CyhOyiRjNz51MT/yngZxUYrNobNmxWjvbO+p2GwjWfwTBy6j7N5vd6d6KMsI756ib/qIJPdkN0oA00xy8xoCwas7kwUKDvY4AyCPDZaquqefaWCOFFUXEX3sMaIuElK4pDGjnFYG8SE6OkH004xZqOHCrtZLAfG/FsStKUHEqFCylPx4OdpkqHCGIcKivjRG+cw9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=WRnAnjnHUGz91ffWoU6zpSoCpSQI1c5xMtwpfXY9KsI=; b=h5/zaKUCBYM04eHCXKUZcWpG37cKIxMkr9Sy4ZFI+83KuxTAB5tv43Atk3EJSoiTMOEWjJGM5HIJ3cbIIR6oTxO4a7beaBM3ZXB9krLgP7XSgnlz3/qsWFmTq9/v0p+APjc2ji/HegYcFTVoYlPjmO3HvSiKkQzTDOmkq63JnEeGXEzCIs8UH1gXAm87tqp9mGecLgY5/g0cZF2d2irrmsV9sBXSvTNkXb2Z5QG7vM8lzOoVOIGtAo53ITns8iFAzzfcF8u4UIlqjMgugX2y00cFR9nwV0SwRk4DfIfT1P9Tx/FnFx5FTiU/KO1ZMnZ+ONaYYkDVu4wcndowJPCxdQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WRnAnjnHUGz91ffWoU6zpSoCpSQI1c5xMtwpfXY9KsI=; b=aJ7xEZX36JsHE2ARRx6/BRU9QgCTigvHFr1kpmu6r1UF+0Op+hGVhGz+qZVvkxVAzjFMn8Lr0HGDDrgExMp2CjQLr5brgNb31EEe2zU3pIsxlT7p+SDs6YN3zPejzY1bfmXRNfjDXVJQJ8kMdlFm2RHne/7/Dbxwe35OCCZ6WuE= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from BL1PR12MB5157.namprd12.prod.outlook.com (2603:10b6:208:308::15) by DM5PR12MB1593.namprd12.prod.outlook.com (2603:10b6:4:10::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4951.12; Fri, 4 Feb 2022 17:49:25 +0000 Received: from BL1PR12MB5157.namprd12.prod.outlook.com ([fe80::42f:534d:e82:b59f]) by BL1PR12MB5157.namprd12.prod.outlook.com ([fe80::42f:534d:e82:b59f%4]) with mapi id 15.20.4951.014; Fri, 4 Feb 2022 17:49:24 +0000 Message-ID: Date: Fri, 4 Feb 2022 11:49:21 -0600 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.5.1 Subject: Re: [PATCH v6 6/6] drivers/node: Show in sysfs node's crypto capabilities Content-Language: en-US To: Tom Lendacky , Borislav Petkov Cc: Martin Fernandez , linux-kernel@vger.kernel.org, linux-efi@vger.kernel.org, platform-driver-x86@vger.kernel.org, linux-mm@kvack.org, tglx@linutronix.de, mingo@redhat.com, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, ardb@kernel.org, dvhart@infradead.org, andy@infradead.org, gregkh@linuxfoundation.org, rafael@kernel.org, rppt@kernel.org, akpm@linux-foundation.org, daniel.gutson@eclypsium.com, hughsient@gmail.com, alex.bazhaniuk@eclypsium.com, alison.schofield@intel.com, keescook@chromium.org References: <20220203164328.203629-1-martin.fernandez@eclypsium.com> <20220203164328.203629-7-martin.fernandez@eclypsium.com> <67d2711b-200c-0894-4ff7-beb3eb304399@amd.com> <5c5ffe29-d3d3-2955-cf78-ad275110f012@amd.com> <5ee34cad-8daf-6282-f2ed-cbc92a89d013@amd.com> From: "Limonciello, Mario" In-Reply-To: <5ee34cad-8daf-6282-f2ed-cbc92a89d013@amd.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: CH0PR13CA0054.namprd13.prod.outlook.com (2603:10b6:610:b2::29) To BL1PR12MB5157.namprd12.prod.outlook.com (2603:10b6:208:308::15) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: fe28ad1f-ba9a-4a52-1ab4-08d9e806ae87 X-MS-TrafficTypeDiagnostic: DM5PR12MB1593:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: NxQfpNMSWo2rFresnSsE3EeqqYZmguO+kyigZbRZxgS9ZmGxLWKl68/qHmMQBjbDmJoO1VLb3z6aA24cw6TgXXt5ksgkEbMjb7ksGUVc235bsBYvk9L3S5Q2Tnc7nemIIVNRBVYbLdIO4tDaWPbCEP4Vl4ADsvJMGc1o/9XPqEnF+JWo6R50FIft7dPbUv6gFvbAUGtSnl2nIhR38mTdHsUSeEynsQavMNRwxEkc59vq9vXGE2Ylv/TgXwFWFK/nDMJjEoINjr1XqZp8vwRzAg6U1nnjxZ2MjJ13QZ/0yBMElWtgtANFsZwL0Mx+fnvAqEej/hQociZRH12pkLG0AnhBrtXVKHfouHXYmadOR+wz1Fyk2ANpqoSijqLS6P2OBkwGdLmtKsM/UoWMOj78mbnfXxd8bMuf/vRmYpFtXp/4QWzfyt1ssB88lLstzxjnUEApLUYu5C8nJ0Wwje25YY7PH1S7dtvmkHTYg6WHNiiBD2qgSs20/bt1qjHkOd3fArinDbOUIP97S4/lAB71BRQxsKzQ150ybcbZoky7db9ZNLTKWWySbOndgKg4NGNA/YAcSsvqke3Sj2cDDE56NPIn1oXYOhrSnjM9/Jbpkf9b04mu4ywW9NXGqWyN5LeUZGZYNRqmqMsZROXghnJ73CX5t7KS61EFqTtbBQmOYgjzgOXMKVej9AQ47B63Kpb0u97OsEcMcXzUF0Q/Pve68xwnmo83AOgC7gTzxHKKJ69HTLAhMaYYgYqlg94aihPYb3iwOwS91//eGRVtL0zP48105uaQyPexMIBkIGIQ1ZUqiVUTH7QwK9yrWThMW3CR X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BL1PR12MB5157.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(8676002)(36756003)(5660300002)(66476007)(2906002)(66556008)(83380400001)(4326008)(7416002)(6486002)(86362001)(38100700002)(66946007)(8936002)(31696002)(508600001)(186003)(316002)(966005)(6506007)(53546011)(2616005)(6512007)(6666004)(26005)(110136005)(31686004)(45980500001)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?R3pWSEE3eVBpamJuTVc1WE55dVRjc01qOGJFaGt0cHZGTTA1S1c0WmMrVzZU?= =?utf-8?B?NW1iYW1aR2hHTXo5ZzBGa0t6Umwvek51SzBFVExYSDZVNGVlMzVXZHJ0cmRY?= =?utf-8?B?ZmpBdjYrSWIxWGUzV2N0VGF3QTFxY3JkTTRPUkdXQk4vY1pWdUNWaHRkS0pG?= =?utf-8?B?dVZiSUIya1NGZXVhUXBYaHNEZTR0UEl5TVEyc09JK3NPTHQ4SnRucy94MFRC?= =?utf-8?B?UXprakphaWNnS3FUdXh5S25hMWl2UCthWWtBU0xUMGdQeE1ZNmFZQXRTWjJn?= =?utf-8?B?RUpiUS9GV251WkRETnRvZk1jU3hHK0Y5cDFtYzZwMENkNnpHYU5ReXB5SEhQ?= =?utf-8?B?WUpvY3l0UnovSENaQncvVVl3YW9tMDZld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utf-8?Q?El1hMbaQnuV4xmWlgjpkXac=3D?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: fe28ad1f-ba9a-4a52-1ab4-08d9e806ae87 X-MS-Exchange-CrossTenant-AuthSource: BL1PR12MB5157.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Feb 2022 17:49:24.8141 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: xG4voZdzF/sQG/zRjA0nrEQ0nIWEFkkkoOrrPkkZkDd7sZXcHAQ+u4HpYRVLfOe7BzR4I7UTqh48HXFgIKHGdw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB1593 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2/4/2022 11:12, Tom Lendacky wrote: > On 2/4/22 10:28, Borislav Petkov wrote: >> On Fri, Feb 04, 2022 at 10:23:22AM -0600, Limonciello, Mario wrote: >>>>>> As there is interest in seeing these capabilities from userspace, it >> >> This needs to be explained in a lot more detail: why, what is going to >> use it, how, etc. >> >> We don't do user-visible APIs just because. The fwupd daemon has a feature that measures various security aspects of the system hardware, software and firmware and reflects it out to consumers (fwupd clients) in an easily consumable format, in some cases with actionable notes. In this case the information would be used to make a check about memory encryption support and enablement. If a sysfs file was made then it could be something like this: 1) fwupd checks /sys/security/memory_encryption 1: You're encrypted, here's a gold star. 0: keep checking 2) fwupd checks does /proc/cpuinfo have sme, sev_es, or mktme? No: Your hardware doesn't support encryption, tell the user. Yes: keep going. 3)AMD? Check /proc/cmdline, Did user set mem_encrypt=off on explicitly? That's why. Tell user they can enable it with mem_encrypt=on or CONFIG_AMD_MEM_ENCRYPT_ACTIVE_BY_DEFAULT mem_encrypt=on/CONFIG_AMD_MEM_ENCRYPT_ACTIVE_BY_DEFAULT? We've got a kernel or hardware problem. 4) Intel? Document Intel's path to turn it on. >> >>> As Tom agreed in previous post, Boris is mistaken here.  I just double >>> checked on my side on a workstation that supports SME and comparing >>> /proc/cpuinfo before and after SME is enabled via mem_encrypt=on.  I >>> confirmed that nothing changed. >> >> Then we should clear that "sme" flag if memory encryption is not >> enabled. Like we do for all other flags. > > If we do that, then this will have to be re-worked: > > https://elixir.bootlin.com/linux/latest/source/arch/x86/kernel/process.c#L761 > I guess if sme/sev/sev_es "are" torn out of cpuinfo when encryption is turned off then that "could" instead do the MSR read perhaps? > > Thanks, > Tom > >>