Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp4188087rwi; Wed, 12 Oct 2022 11:55:56 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4/Rd8bpc/P1JDvGDCT+RTYwTzljhUYmr7qu7oa5uiKoNKGL//s1DrDWsjO0aC5ViA42Ofx X-Received: by 2002:a17:906:6791:b0:78d:4051:fcf0 with SMTP id q17-20020a170906679100b0078d4051fcf0mr23203051ejp.591.1665600955938; Wed, 12 Oct 2022 11:55:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665600955; cv=none; d=google.com; s=arc-20160816; b=qIOgSeVkDzbzUqTHpHLH9S7KWJllXQSAAFwxE6U4GyjkeQxBU9in3VxObrw5bzp4aO EPx6v9XQiVuTh6Oecdn/O+bY27Fi2PILgz2ftxuePPgSpGcckuRTDGMYjbBTpN8V0Nks 8IioWFNLsxngNvx2l9qn0nc5h3vSayp6H7Nd24VL0zRm0VSRS3OMfy/Sv1IXXZo7Vo0e RNOBX6511/H2qcb25ED6Y8biFj/xxnJT/EAk9ZXu1QQO3DhXhzUWk6kWpmG9Q7Z+dqwD Ldxrb4bi3QZzcLj37yttkiEr8oxXet5K8kMjgkhrcFlOoJATqKVUf0QBysQikqj6b579 mKsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=xJoS5yjiIlGQNO1fEM+DTVAZ/oHEyewBdEQgDKN2+9o=; b=jugy7fwHYkNliKbSGjT+gebINnsHVKgbyP3mPrq47ZVcvQbfk79OyrhdotckS7lgyt TFA6jLvxtCAFILx8lCjjaiSDpoKTlqYhyN0zNJ+Ky6uJVHlj08HkslonapYH2iBSjy7d E1rIT2yGSK7Pz6z/6Ll9PE5OLfuhVq8Wpji731OeFMBXRHJK2pjrAZmr9cN0okfP4eZ2 I7IBLsQfWkeEUH/Gt6CToGFWmwrpQ2qGpcLszC7s9Raz93ZNtDlnW6oLze862AwZ6qUy NKAfgmxun0Etb/kgJkHcmDOBOSXAvGiCeSaX8bRNZ0h09E73V9NO6im9FCX9hy1CFeX+ 7vRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Yv9XDlHP; 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=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n7-20020a1709062bc700b0073ce34d1a13si995618ejg.499.2022.10.12.11.55.29; Wed, 12 Oct 2022 11:55:55 -0700 (PDT) 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=@intel.com header.s=Intel header.b=Yv9XDlHP; 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=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229702AbiJLSL7 (ORCPT + 99 others); Wed, 12 Oct 2022 14:11:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229544AbiJLSL5 (ORCPT ); Wed, 12 Oct 2022 14:11:57 -0400 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 87088DED19; Wed, 12 Oct 2022 11:11:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1665598316; x=1697134316; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=qgFUurzL+QlDsqQsQhjjS0FK/bFClVnNfpHEO/UpWnk=; b=Yv9XDlHP7vSvIPJW3XoSpZTq90Ho/EuddU+lX21OSN6DUkMEDYC746ap qEdPbKNWOfNbpDDV28S8nR8FHVE/YIz67QTJmw2Gn5fju2lOiwhzkZyPL qcK7/gLrphs+nE0MwhmFHwScW9+x7sqTfkxJBGQMubLJGe3UXbXW+IZ/0 EWVV0HOVUlRd+okgC1XOmbO+qYAb8fU937SPyWyertoq6bee0fusk8AoW +exKFcyS4pLTT10buHsqBpdM8oUpoTLu2jwYhCdaZKC6983ZyOP/Yo0/6 j5EjKandV/zmLbwIuxlorS/2HbkF7xGvwZ9JvRteSztyP+VTS8x+JTqm1 g==; X-IronPort-AV: E=McAfee;i="6500,9779,10498"; a="391175717" X-IronPort-AV: E=Sophos;i="5.95,179,1661842800"; d="scan'208";a="391175717" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Oct 2022 11:11:56 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10498"; a="689777127" X-IronPort-AV: E=Sophos;i="5.95,179,1661842800"; d="scan'208";a="689777127" Received: from jbrolli1-mobl.amr.corp.intel.com (HELO [10.212.174.189]) ([10.212.174.189]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Oct 2022 11:11:55 -0700 Message-ID: Date: Wed, 12 Oct 2022 11:11:54 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0 Thunderbird/91.11.0 Subject: Re: [PATCH v14 1/3] x86/tdx: Make __tdx_module_call() usable in driver module Content-Language: en-US To: Greg Kroah-Hartman Cc: Borislav Petkov , Thomas Gleixner , Ingo Molnar , Dave Hansen , x86@kernel.org, Shuah Khan , Jonathan Corbet , "H . Peter Anvin" , "Kirill A . Shutemov" , Tony Luck , Kai Huang , Wander Lairson Costa , Isaku Yamahata , marcelo.cerri@canonical.com, tim.gardner@canonical.com, khalid.elmously@canonical.com, philip.cox@canonical.com, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-doc@vger.kernel.org References: <20220928215535.26527-1-sathyanarayanan.kuppuswamy@linux.intel.com> <20220928215535.26527-2-sathyanarayanan.kuppuswamy@linux.intel.com> <6759025f-fc08-74f0-efd7-2331110dec0c@linux.intel.com> <62ef9740-64f0-ee60-71fa-80cc90da435c@linux.intel.com> From: Sathyanarayanan Kuppuswamy In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE 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-kernel@vger.kernel.org On 10/12/22 10:26 AM, Greg Kroah-Hartman wrote: > On Wed, Oct 12, 2022 at 10:13:50AM -0700, Sathyanarayanan Kuppuswamy wrote: >> Hi, >> >> On 10/12/22 9:23 AM, Greg Kroah-Hartman wrote: >>> On Wed, Oct 12, 2022 at 08:44:04AM -0700, Sathyanarayanan Kuppuswamy wrote: >>>> >>>> >>>> On 10/12/22 7:27 AM, Borislav Petkov wrote: >>>>> On Wed, Oct 12, 2022 at 06:35:56AM -0700, Sathyanarayanan Kuppuswamy wrote: >>>>>> So we should create a new wrapper for this use case or use >>>>> >>>>> Yes, you got it - a new wrapper pls. >>>> >>>> Ok. I will add a new wrapper to get the TDREPORT. >>>> >>>> +/* >>>> >>>> + * Add a wrapper for TDG.MR.REPORT TDCALL. It is used in TDX guest >>>> >>>> + * driver module to get the TDREPORT. >>>> >>>> + */ >>>> >>>> +long tdx_mcall_get_report(void *reportdata, void *tdreport, u8 subtype) >>> >>> Why "long"? >> >> We used long because __tdx_module_call() call returns u64 value. > > Great, then use u64 please. Or if you are returning negative errors, > use s64 to be specific. > >> Alternatively, we can also check for return value of __tdx_module_call() here >> and return 0/-EIO as return values. In this case we can change return value >> to int. > > That would make more sense, right? Yes. I will change it as mentioned above. > >>> >>> Why void *? Don't you have real types for these? >> >> We use these buffers as an intermediary to transfer data between userspace and >> the TDX module. In the kernel we don't consume these datas. So we did not define >> the type of the data. > > Then these are userspace pointers? Why are they not marked as such? They are not userspace pointers. Since we need to pass physical addresses of reportdata and tdreport buffers to the TDX Module, we cannot directly use userspace pointers. So we allocate these intermediary buffers in the TDX guest driver and use it to copy the data from/to user pointers. > > thanks, > > greg k-h -- Sathyanarayanan Kuppuswamy Linux Kernel Developer