Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754779AbdIHQGk (ORCPT ); Fri, 8 Sep 2017 12:06:40 -0400 Received: from mail-co1nam03on0069.outbound.protection.outlook.com ([104.47.40.69]:45472 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751166AbdIHQGh (ORCPT ); Fri, 8 Sep 2017 12:06:37 -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: <32a123d5-0d7e-3864-c414-45d190e9d848@amd.com> Date: Fri, 8 Sep 2017 11:06:27 -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: CO2PR07CA0072.namprd07.prod.outlook.com (10.174.192.40) To SN1PR12MB0159.namprd12.prod.outlook.com (10.162.3.146) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 41ff55b3-a36e-4135-5897-08d4f6d393a4 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(48565401081)(300000503095)(300135400095)(2017052603199)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095);SRVR:SN1PR12MB0159; X-Microsoft-Exchange-Diagnostics: 1;SN1PR12MB0159;3:+WV1osqJnAu0+nbbPf6E0stpvv5ew9u3MVe4P+y+2fWIpJEqWsbEg/p/JflYH66wJrkAak6g6vTwLNbmP8iHPJTpBOytCz2JocSfGyti/v88PnLjTby0TYyb39xg7LUXCrqyN04kV1UZT2UBJEYhwbh2TkjHh21mm6qtwXLkP9N/qt+/bf7u5LOyU5OHxW+SHlUvEsLRwdHqQ5ljAyvKJp6FPRiDEqsZDpUKKzrpaCx2uGAnjbaUYHhAQXb3szrD;25:1luzLVbz+9kKJ354//LlSg/BxacuFXdKuEMxzz+AT+DDOoGvLIuHDCNOaVGL8gGZo5LJ3U9oyiuniTLQFAuq+tNaPvmJ0QQqKqmBxCcD86vlUqqX/LjPL4+kzYMOY/5EARNqHVttWiobxAUkVUyfffCuX05sjA6bZFESButl123zsLbHXY+dccbIZv7iRlxdXjOfHmOy2MCw0y724c513Ojy0z91tEMHn8crkDQk+W7ZVfSEOUKswXtZyVlPeHjGSJ3WAJD+GY5QKuvsFWN5tiIS0u87qpNTcRVYt13FGKmelBzE8f74++beXGzNbBW+hWJXDANw/3+LUWvnFMkZgQ==;31:DC+zASRScrqI7MX7Z63Y/KGcRiS5zN8n5rSZfm67DC8g6G30YlXjfytmfJ0feaxlnT/JVGbvGi4GoYPwcZqQ7zeePIBM5oGzuQK1FpmCy3NRisWlrvsbZqJc4G0JxpwgXP1YukmsDKlDrz9UQIrcZtnz676cG+4Q3mknwCKaCltjeHmBu3USMjqPv3GtWtl3k7L5YZi4iA91OdFPSk00CEGe9HtRRkzxetREnlDhTqw= X-MS-TrafficTypeDiagnostic: SN1PR12MB0159: X-Microsoft-Exchange-Diagnostics: 1;SN1PR12MB0159;20:z0aRQcNWKtQ80VQfTgIbpuaVW4XaXoy5fjEQqH6wHfawAmOj9top746nzLKwfzFR4PtKhonZgVeTxTUU6xoSZU3qbGWWoXEfcIfgi0IpVlyF4laQ00Tl5lNsTroCR7jZ+mD7/FPobFeLQIvB61nSM2qy9BU52wMY049UFMMSm8VHTDoMurQhsx7Ox69WZVBtYMP4o6rYtN/0NzrSFjExut5QMOclEh8bEtaQ9ZFr43m1rerz2hEITG0rvqDmp6bdfxWk7J+dTMAFMXCo/gjutDjnhVCcyYt8CiScFG3QidFKWuiLGaKbORPTBbr3OLQsMI08qXiu/AF3W7GY5nlzOT4RVLktSJaBNM5j59pLNAHkvsk0NCCYbloT397wdJ6yLg0l7p5/s0Z1E8LaBVLE1YDfhKXQAF4k59FQxMBvalN8i1AifBXzqES3JVoIyXS0NQaqzEphsljzpyvTWETYxM4F2Uy+YqqVLMqqsidzD0M5Vkjy4y1+q5uHgfC6ypo8;4:DFH2F8v/c2RsW/4RpaCMLZTUpqpuW/Q6PCxV2SMBXGDF5NMQrOavVeRqEnGkEFLbzif3Wv1Vm9eWKGhAtSziNIPCvY5tunLaI8yPaSH0qj77Qa1RwpdwCCSec0UaurL10lj28x9YYzLn30/GURhBPTFpBZVQpcIoxZ1xgrCnoT3FhZZqifHnxN3NB0TGWe/DDnemCKALddgl50gbmI7No4hFXobN2zVhtBhN/VChFi9QyFHlo+CkID5RGJWT62ygUGdXquOrwXJXnXF3oDV+R33Dann6Iu2nHP5vyX7+cafMfu700E62XJAjfhK4nNWb5u6NmY1vlR24j8zIlEPftw== 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)(8121501046)(5005006)(93006095)(93001095)(3002001)(10201501046)(100000703101)(100105400095)(6055026)(6041248)(20161123562025)(20161123564025)(20161123560025)(20161123558100)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:SN1PR12MB0159;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:SN1PR12MB0159; X-Forefront-PRVS: 04244E0DC5 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(6049001)(6009001)(39860400002)(24454002)(377454003)(199003)(51694002)(189002)(50466002)(7416002)(53546010)(83506001)(81166006)(81156014)(65826007)(106356001)(23676002)(4326008)(47776003)(5660300001)(77096006)(230700001)(64126003)(2906002)(6916009)(93886005)(229853002)(97736004)(6116002)(3846002)(6486002)(8936002)(2950100002)(90366009)(4001350100001)(8676002)(6666003)(6246003)(305945005)(86362001)(68736007)(53936002)(110136004)(54356999)(189998001)(76176999)(478600001)(31696002)(36756003)(42186005)(25786009)(7736002)(33646002)(105586002)(54906002)(65956001)(65806001)(31686004)(66066001)(50986999)(101416001);DIR:OUT;SFP:1101;SCL:1;SRVR:SN1PR12MB0159;H:[10.236.136.62];FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtTTjFQUjEyTUIwMTU5OzIzOm1ob2dySytwS0FadW1MYXBwYjFsbW1Yd3hP?= =?utf-8?B?ei9ITEFpYzNBS2h5R1NONG1sUWNkTDFkVlV1QldNNk1NcVBYWDJOdTUvRXVo?= =?utf-8?B?bFE2cW94RjZ4c0owcUQ2WmJaS3U1U2lnck0wYXVXa2lCblh4R2V6YlFFaXB1?= =?utf-8?B?RXEyUHlvVm5SR09hZ1M0Q3VQanFPdDkrKzdhRStHeH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gG0hIx+IB7fV2f3h9B9yVLXaR4c+JPHVfYv8hQ/nC6K6kI11s3rj/6p7VfqRP7llACDTC4fC5B5ZUEi76eanoQfdZvd6n7X1CtgO X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Sep 2017 16:06:32.3510 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR12MB0159 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2091 Lines: 58 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