Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755152AbdIHNyc (ORCPT ); Fri, 8 Sep 2017 09:54:32 -0400 Received: from mail-sn1nam01on0075.outbound.protection.outlook.com ([104.47.32.75]:27991 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755043AbdIHNy1 (ORCPT ); Fri, 8 Sep 2017 09:54:27 -0400 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=brijesh.singh@amd.com; Cc: brijesh.singh@amd.com, linux-kernel@vger.kernel.org, x86@kernel.org, kvm@vger.kernel.org, Thomas Gleixner , Joerg Roedel , "Michael S . Tsirkin" , Paolo Bonzini , =?UTF-8?B?XCJSYWRpbSBLcsSNbcOhxZlcIg==?= , Tom Lendacky , Herbert Xu , "David S . Miller" , Gary Hook , linux-crypto@vger.kernel.org Subject: Re: [RFC Part2 PATCH v3 02/26] crypto: ccp: Add Platform Security Processor (PSP) device support To: Borislav Petkov References: <20170724200303.12197-1-brijesh.singh@amd.com> <20170724200303.12197-3-brijesh.singh@amd.com> <20170907142737.g4aot7xatyopdfwp@pd.tnic> <9de7139f-676e-e671-13a1-cbc5170cc816@amd.com> <20170908084009.tb7wzm4j63vhgem4@pd.tnic> From: Brijesh Singh Message-ID: <628e9dbd-77ff-b931-50b1-e72d753612ee@amd.com> Date: Fri, 8 Sep 2017 08:54:17 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <20170908084009.tb7wzm4j63vhgem4@pd.tnic> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: MWHPR2201CA0080.namprd22.prod.outlook.com (10.174.103.33) To CY1PR12MB0150.namprd12.prod.outlook.com (10.161.173.20) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: cbc9c2de-73d3-4dbc-66d5-08d4f6c11cb0 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(300000502095)(300135100095)(22001)(2017030254152)(48565401081)(300000503095)(300135400095)(2017052603199)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095);SRVR:CY1PR12MB0150; X-Microsoft-Exchange-Diagnostics: 1;CY1PR12MB0150;3:loNWtfmlaWUEG2g92WbfbglCXixgg/1sbbErl5MxEn47u7ciQn+5Cx5O2w/iVK/9eiB4721l7sM7sWxB6d0z8SvgRqD3KST1BNydJVI/DKj3tVSbZ+5l6fJ6La8E2xBqXDh/+DsMjRsQ8iILnlfONXQdjt9zE13x4v0PJUz8NskBCJmC0QjhMIj5DctXE1CDPTcGzToDOlxj0sv6/SBcycvTvczzQ41OaTr4nIyGi/dQN160neWjWM+sS+rdP5sA;25:Zw2Y9M2CQGD9RRHQjIs7/gCv1fKgCUTrHLEHmc4yDgDmjZ1cWGWU4i6+EQZ61e7Z8tebjEdJT1YBGGF5ZbxPlZ4wXjKcuMzB/k6SSB5NNppCHb7PmFlXVVIyr5zXO9fjwTfcMeyPRlxlKh7XbhKx1gY9wPgFJ/xX3ZdxiGhhQp/Ay2Ju9b/6u7lhujbd4Zqt/oEuOhUTCPVpVyoWpIAYG8LY6f1lnPpKg8cqNAXZS4uRcolxoJNcXkqJDV0VGW2up3a06baAu5KGzSQg8bG7UkwQno9yt3ootNQtadRWQVt0ZR87oAheSnvzhyqY9U2ZbQ1FF/lTNzxxYg7jYU895w==;31:uTGrd9PLkBsKh/idROVfecYJF4f8jETYrYsFWZsYwaLngmvbVF/eqIZK+b0kLVnxtC2NVe6vc4mMN4WGqY3qkQzFVAUXnmr2ml3TI62YhOlFmdXXJMlMdSAV8+uv8UKE1S4Zw9ZW7tpV7vp0qJKZ8YA2ztmA5f0fbnEI5HIakuflH5c9OrBE7w4lO1vkjBHJ+7576DEe9tfgPHpuv9BJEQGj5DpaHwClHw8xn6rIa64= X-MS-TrafficTypeDiagnostic: CY1PR12MB0150: X-Microsoft-Exchange-Diagnostics: 1;CY1PR12MB0150;20:iG1fi5uZwxegBB0Awk2YQXs0ZBCuTyowPtJKlcw/RVZ9+bLgMX7VRkeyuqI0oqhae+lOt+L/dK2DAwC9hRXFqrxKsYI+ADaJWqvtS+xwAj7ccNX8GO0Dx5IEa4MiSFQlSraD84tKcrwU3aJIIjD85zbLkAGtlhjWzqfI+C0Bh/TYzMKy709R8AEdKT/XkNizE779/vmiZ2o+sbsxb8XuEwuIrdwVfDtmfumfQx4wNC/zD22x1ndv09HC3tgHFYsygJZDLUiXL1qGBi8XQ1Ksap3iMPr/If2i01/Ofec6Rs+FN0nKdzjE5HsiNxNBqkbXt7n8N7W3Pk7FXqVK+8rKbsQgYT1Oz4W+tcMsfGbBYr7HcbS8wkn1rrQ4NuQknchz5gkcVpkWC6TtTF0snSKCKU4ByjyF2GDpS4xLNd2mC3wsMLoyyQ79kgrJOkwlNdJH9uEdSN2ZAnpRGZ5HEkKFh4QgQWPbtNUGHIE1l86D8SQJ99xSUQtC0k+TS72i+GEe;4:1PRDHI8frXJgrtG/fpGc3IKpONKfIDFj2ICaKqSR66/kVh+jefBj5PG7m+yamFHbv//sQtYDMyy4uOY16fSEvfo5FzKDmB2fIeSlHRZ4dSqE/lodKrTAzJyKESf3EiQA7VLgQD7ekj/9McdNxvnG1rNYImJQJzqYfOzswUdvO+xfRoS7/r77ePlxF9GBUzi2xLOjJG+ksoYe5tIc62XWgmKj9ZpAZDGheKVtcB5iEt3nSHNy//mVNCGRmSrLk7KDKQkNX3PyeqLxkZH/l31Yib3S9nOcJP/aBPFL93UVFSQS1GEkgQYnc0WcZrzusuKzlxDDwj0iYQaoUxSXLPEjCw== X-Exchange-Antispam-Report-Test: UriScan:(192374486261705)(17755550239193); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(5005006)(8121501046)(10201501046)(93006095)(93001095)(3002001)(100000703101)(100105400095)(6055026)(6041248)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123558100)(20161123555025)(20161123562025)(20161123560025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:CY1PR12MB0150;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:CY1PR12MB0150; X-Forefront-PRVS: 04244E0DC5 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(6049001)(6009001)(39860400002)(51694002)(24454002)(199003)(377454003)(189002)(7416002)(2906002)(305945005)(97736004)(47776003)(31686004)(65806001)(66066001)(5660300001)(81166006)(65956001)(65826007)(6916009)(23676002)(68736007)(4001350100001)(110136004)(4326008)(53936002)(6246003)(189998001)(83506001)(54906002)(478600001)(31696002)(86362001)(50986999)(76176999)(36756003)(8936002)(64126003)(230700001)(54356999)(101416001)(6116002)(3846002)(77096006)(6486002)(33646002)(229853002)(25786009)(2950100002)(106356001)(105586002)(93886005)(81156014)(53546010)(42186005)(90366009)(8676002)(7736002)(50466002)(6666003);DIR:OUT;SFP:1101;SCL:1;SRVR:CY1PR12MB0150;H:[10.236.136.62];FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtDWTFQUjEyTUIwMTUwOzIzOjJCbTEyTFFtdzErNHVORjhIS2VnY2RSaUJY?= =?utf-8?B?Q0lyWTBzZzdwK1ROYTg1YVVnSnVtVzFEYlFCZlpKMzNUQmNLUmwxUnV0Q3FC?= =?utf-8?B?WHV5VmpNd1pJN1ozRzAwaWRTYXQ2NmVLWjE0d3VrMHps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jmysuiLLqC9BUJX9Kvoo3g=3D?= X-Microsoft-Exchange-Diagnostics: 1;CY1PR12MB0150;6:JwtR0jrutRgI52G3XueWkTz0cnSYtv+GSNuSzbtUn3Qwt9ah0bkCOvm/HVoFK0iSuFGe2DC92/xOY7+SKzF26NSSXszIIIn4N6leHDO9eiBsmihRsQgqrOwFjuhAesAPyc+haCbn3zpZCjWCKa8m16YZVKpmn0+q24IY+Rpz8MCWSuvXXFBcYL2fWKoXToghnmXQYfk8NsErAeFEPY3v/kJD/xeREf67dbApEqnDLRgB8BM+GserlTGjaZAiPFZC8yZBPuhI02+WrxxAcjnnnGAXsjdYFknDHWcXWjtprT+5UN8+EW9wwUd3fGmA2WzaE0Nw3DrULQSvpIuy1IfLgg==;5:nVE+zx2z3O7Mc8NDr3Gr/VQDeFD0dVsPK9xwbcUOIwnF8rAYz4HLMutLmm8IP7TsLR81neHGHe8iLa3R++05NFDVJmZvweE4jneCZwl4QkvCYXlaK9RCsmf7mWVh812N0By04+iGFgXRGTlK/OkXXF+vEVsn89FFbB+3UM3RiZk=;24:siN1P1dnZTZkppOBnNdYRRH2t0Tpfvz/JujlYEFNTBzhKCilmrL7dXLgT2uwGjvH8IrxXLXFuboaj/dxuowmFOVze7a+IoMh1lP5PVe9YVM=;7:6Q8KZabG22YUjC0y9x6TJolilZWbUfKeXxFMzubp2ByxRI7oXTjCRtDDNibdKBemHQRZyolr0Ll812PWbcRzUYy3vmmoqr5IEVnODgafAkGvuEOA6k1xlKqVi1WI7ic0bw7TMpyMiNzey7ybghT0El+w50SaFKEuSFZjh8JPifw/T/8699huio4eEYuXzhgRGKVIvTovqFq9If0CSXNHZaXpw3hkVJ5UTkAj6qR86H0= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;CY1PR12MB0150;20:YkiP8KZ7glSYPvEft+HpwDWGgQjowXlr4V9U1HXIvtWav3x8qCpRpfWVqw7aWNSDYVJg2h4NjY4ZtqF/zkB6WsJJClW3utslsOSAOrCJQQpb9zp8T4t7e7+Jg1SaEDG+nxwTbPlDwQ+iKz913CLL0PlL0ibtiR0a3gKOBC11m1FLDpkyNrRzBP3mhopTYdZVLxaUXioqrOy8vhdQ2gGQzuUAcawnTPBWjb/nRI3w/tO9+t8+DBXrMT8PCrF2wPCN X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Sep 2017 13:54:22.3401 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR12MB0150 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2092 Lines: 56 On 09/08/2017 03:40 AM, Borislav Petkov wrote: > On Thu, Sep 07, 2017 at 05:19:32PM -0500, Brijesh Singh wrote: >> At high level, AMD-SP (AMD Secure Processor) (i.e CCP driver) will provide the >> support for CCP, SEV and TEE FW commands. >> >> >> +--- CCP >> | >> AMD-SP --| >> | +--- SEV >> | | >> +---- PSP ---* >> | >> +---- TEE > > I still don't see the need for such finegrained separation, though. > There's no "this is a separate compilation unit because... ". At least > the PSP branch could be a single driver without the interface. > > For example, psp_request_sev_irq() is called only by sev_dev_init(). So > why is sev-dev a separate compilation unit? Is anything else going to > use the PSP interface? > I don't know anything about the TEE support hence I don't have very strong reason for finegrained separation -- I just wanted to ensure that the SEV enablement does not interfere with TEE support in the future. > If not, just put it all in a psp-dev file and that's it. We have a > gazillion config options and having two more just because, is not a good > reason. You can always carve it out later if there's real need. But if > the SEV thing can't function without the PSP thing, then you can just as > well put it inside it. > > This way you can save yourself a bunch of exported functions and the > like. > > Another example for not optimal design is psp_request_tee_irq() - it > doesn't really request an irq by calling into the IRQ core but simply > assigns a handler. Which looks to me like you're simulating an interface > where one is not really needed. Ditto for the sev_irq version, btw. > It's possible that both TEE and SEV share the same interrupt but their interrupt handling approach could be totally different hence I tried to abstract it. I am making several assumption on TEE side without knowing in detail ;) I can go with your recommendation -- we can always crave it out later once the TEE support is visible. -Brijesh