From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=192.198.163.7 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796196406; b=RK3caXUu3wWOFLhf4lV44oqWn1/xdUx71fzqRtJ740TOmdgrwoUsGHV8TOdckkYVkFCZ newRWe1fYfbiEEzIPUd+SShK1ovbzpmK47ZlkwCB5W8lzidOjfKiIVAWU4tSx4vxnImOH MsFYY5mpVA5VpZhgcZSHxjqM5AHWmVCtrgHtmvd3OZzoW6JsT/CiTVtxD3F5SKoNY1d8y xCnZhBWwWX9U4r94NMzd2SgePqRItHp+dQqrS+agqATmiqCUdPfa1CdPqbaYON7gbjVXt AMj5RwthDUJSTArFQiDm5yUWnI7xSleR5WmDsh7sZzaI9ST73yZwwKn+bjdD3qf0Ebw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796196406; h=DMARC-Filter:DKIM-Signature:X-CSE-ConnectionGUID:X-CSE-MsgGUID: X-IronPort-AV:X-IronPort-AV:Received:X-CSE-ConnectionGUID: X-CSE-MsgGUID:X-ExtLoop1:X-IronPort-AV:Received:Message-ID:Date: MIME-Version:User-Agent:Subject:To:Cc:References:Content-Language: From:In-Reply-To:Content-Type:Content-Transfer-Encoding; bh=uk5GnIafO5nk0WxJ5WQjZAZim35is/VORtQ30K00fHY=; b=K6u7+StDt8vS4EwBr2cKV9iMIWPNaGR6roJ55tHjF01tdzl1cK3w1ikRuA803VuNmeKb /7iPX2WDaoiVATJLipTtuHww6Ik11RukxqvcakDLcCHXlvCdC+0n0k3f/olS0eZhHSg6P UOfXQ8dnzUp6Aedtpwrrx3Pc/K/olWS3BvXIVe/cdBdkQjoWbEa2wKC0XaPQAFOecoYIz Ql30GP0di8oY0TtzgmLyIPXWw0vcbs1a4mdL87YOb84L0gtaC92vc8VAgUqSV3dkxmfuV EYQW0iTnDb3KfqL7XSicpCyC/X9+Tuei+MdxzbIPLF5PYcyhwzY78f5f9fYAgAFceGw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=BvKoEzeQ; arc=none smtp.remote-ip=192.198.163.7 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9557B606A322; Wed, 2 Dec 2026 07:26:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 9557B606A322 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=BvKoEzeQ DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1796196406; x=1827732406; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=uk5GnIafO5nk0WxJ5WQjZAZim35is/VORtQ30K00fHY=; b=BvKoEzeQo/MZs+VUe5yGb1NPPiraPjbraQLmvYJJA2HkF/SNryqMf0TZ jkCPxdK+usp+7kPXF/0Sl++h2psqeZjR1MHmx7TpAU56k2WgYQwQljlWu JTbjEFctrBk6nB6tFzM3acFUDBf9qvj+yrpx1wPp2zCCJgexnH8oFcE6k +o9GYQ/WJ/Zv+3GIY1B2jgZAyrZQITgFH7p586yXd9mzjgDiC/tXdb6bA kMfVdpqYfB/JC/DRjTJhW/6Tnw2DHyMggPVVpky0b0ifRNq0QM9/hqvYj xWxvSrmG+pNh5CEjLLwqKnvxccV7+pI4FwpMpZyaumGJot5dg03aOSL+i A==; X-CSE-ConnectionGUID: /JwMS5xwTXG0COAeyr5Urg== X-CSE-MsgGUID: o8TyjEUmSOKVgxu8JJ3/hA== X-IronPort-AV: E=McAfee;i="6800,10657,11983"; a="4950256" X-IronPort-AV: E=Sophos;i="6.27,246,1787036400"; d="scan'208";a="4950256" Received: from orviesa008.jf.intel.com ([10.64.159.148]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Dec 2026 23:26:45 -0800 X-CSE-ConnectionGUID: nEKj2grmQI6t0o6wmtgBzA== X-CSE-MsgGUID: jA3sxkngQNOKMy1s77hnbQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.27,246,1787036400"; d="scan'208";a="13237405" Received: from xiaoyaol-hp-g830.ccr.corp.intel.com (HELO [10.124.240.90]) ([10.124.240.90]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Dec 2026 23:26:41 -0800 Message-ID: <4ca101ca-90e2-4245-8b13-c56846c3f081@intel.com> Date: Wed, 2 Dec 2026 15:26:39 +0800 X-Mailing-List: linux-coco@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3 1/9] x86/virt/tdx: Add SEAMCALL wrappers for IOMMU setup/clear To: Baolu Lu , Xu Yilun Cc: iommu@lists.linux.dev, x86@kernel.org, linux-coco@lists.linux.dev, kvm@vger.kernel.org, Jason Gunthorpe , Kevin Tian , Kiryl Shutsemau , Rick Edgecombe , Chao Gao , Binbin Wu , linux-kernel@vger.kernel.org References: <20261112043054.2664857-1-baolu.lu@linux.intel.com> <20261112043054.2664857-2-baolu.lu@linux.intel.com> Content-Language: en-US From: Xiaoyao Li In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On 11/24/2026 1:46 PM, Baolu Lu wrote: >>> +            u64 *tdx_iommu_id) >>> +{ >>> +    struct tdx_module_args args = { >>> +        .rcx = reg_base, >>> +        .rdx = __pa(param), >>> +    }; >>> +    u64 ret; >>> + >>> +    /* >>> +     * Retry only on TDX_INTERRUPTED_RESUMABLE: >>> +     * >>> +     *  - TDX_INTERRUPTED_RESUMABLE guarantees forward progress between >>> +     *    calls. >>> +     *  - On TDX_INTERRUPTED_RESUMABLE, all registers except RAX remain >>> +     *    unchanged. >>> +     * >>> +     * The ABI spec also allows retrying on TDX_OPERAND_BUSY, but that >>> +     * status doesn't guarantee forward progress, so retrying could spin >>> +     * forever. The host serializes all TDH.IOMMU.SETUP and >>> +     * TDH.IOMMU.CLEAR calls for an IOMMU, so the TDX module should never >>> +     * report the operand as busy. >> >> Many SEAMCALLs return TDX_OPERAND_BUSY, and this is the generally expected >> handling. I don't think we don't need the comment if nothing special. > > I'd like to keep a shorter note. It's the usual handling for TDX folks, > but people outside TDX may read this path too. Can we check in what cases it returns TDX_OPERAND_BUSY? Can some SEAMCALLs other than TDH.IOMMU.SETUP/CLEAR contend resources with TDH.IOMMU.SETUP/CLEAR and can lead to TDX_OPERAND_BUSY? If so, the statement of "the host serializes all TDH.IOMMU.SETUP and TDH.IOMMU.CLEAR calls for an IOMMU, so the TDX module should never report the operand as busy" is not true.