Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp4125770rwi; Wed, 12 Oct 2022 10:58:41 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7pBw+6EgPLaD5GSjqTsRfjUv4y03/ACVUdjm27L6B6SOJ4xqNXHPWfjO2HbcTXlrIBV9V3 X-Received: by 2002:a05:6402:176b:b0:45c:cf1e:7ff7 with SMTP id da11-20020a056402176b00b0045ccf1e7ff7mr1363538edb.44.1665597521641; Wed, 12 Oct 2022 10:58:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665597521; cv=none; d=google.com; s=arc-20160816; b=ZhABzQh+2Wu6NmOBmBk058TAK9IHBIuQKJpokqGgB0peH1F5lM56JDalVOipfUdoqw AUUFNcNoHskPcdXoUY1plj0RW42l5g7bWEGGdsPPxCSUWfoEP85Qjp6+gZew5DLLW1c2 Kp1y7HQ6Vf6yxR2YReAADTXAMWGX7x+MPxBH/QjYQGNwAlboVg1fESJoxsNCRXcUFSDN FtYJ3j8j5A0M/gek7qmkHhDvdtK8i6Rt7ItL+23uuVZJiWYHA7W6SSI7Jc5cM918rUnY 4WanUy/9JGYBhmIh+tJyEkHAOm0cJ+ebsbMurjVls/b2p+NJSR4o0jxCpDUp/ChiopAD vV/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=vo44fMZ/yX5dlJIPh934nMnUiH45zzPaThvExAuZ/mg=; b=k0IivAChbgnOG4FXgEKhtStnDaF/JbrN/bMI8ain4n63R0/YKHQJEOdRtq3RTS4XG0 bzY/4O1NwEXVPC+NMs6GXmnKepZ8JR7gdLeJR/xlOttgGRf3x3bdnniUgbj4IxrUR5WN K/nnI93YHIFD6KPWeT3MmyLCiskiy/mO4mi/UCKxdGiG+63VgI0X+6YSuBfjU5Oxawxd Kf/9Ekn6XRUbbxmqabUzSajHiLUecPIHpJq/6hUy6/5qbXLpo9whRxA6wYECMNQHcojS 8jb6onKKsETjn1RJPXJ0yY2zbVQC+D8s3+NLz6expaDL1OdtaoYRzKLg1ELRMXpvwMPb iG3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tKtR2yI+; 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=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g34-20020a056402322200b0045c97baba28si3183903eda.500.2022.10.12.10.58.15; Wed, 12 Oct 2022 10:58:41 -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=@linuxfoundation.org header.s=korg header.b=tKtR2yI+; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229590AbiJLRZ7 (ORCPT + 99 others); Wed, 12 Oct 2022 13:25:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37806 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229516AbiJLRZ5 (ORCPT ); Wed, 12 Oct 2022 13:25:57 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E6FA65F2; Wed, 12 Oct 2022 10:25:55 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BE4A66159D; Wed, 12 Oct 2022 17:25:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A0F68C433C1; Wed, 12 Oct 2022 17:25:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1665595554; bh=MMFc4+K+Q6mOheB5DwwpXSmMWP8NWqwwuVAZZnhkzII=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=tKtR2yI+k0/m6+A8H+5vuaCWjpi3NiYFNMZkCLE+SGSPIcuUhz9ghPsUswTvp6q1J Bda/P/PfCUPes/e3/xoraij45hGjO+T2WKQBPyYU3d8MdAknHSoXj3UjVeJDm/mp2u QEj9mPcIokiggE8fPftsD504kkGEvXo86dqeZ2r0= Date: Wed, 12 Oct 2022 19:26:38 +0200 From: Greg Kroah-Hartman To: Sathyanarayanan Kuppuswamy 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 Subject: Re: [PATCH v14 1/3] x86/tdx: Make __tdx_module_call() usable in driver module Message-ID: 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <62ef9740-64f0-ee60-71fa-80cc90da435c@linux.intel.com> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 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? > > > > 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? thanks, greg k-h