Received: by 2002:ab2:6f44:0:b0:1fd:c486:4f03 with SMTP id l4csp222036lqq; Thu, 13 Jun 2024 00:38:13 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW7mEKgF1Im7lT+yf/EUXRpH/5fW1eVs7MLqO3YLE66RpKkxwprkgvtaJgu2jeZm3gz9pFc50Nzv+0Ea4E8CiJfQhDGUxITxh2FgBwj2w== X-Google-Smtp-Source: AGHT+IHPcCL0ebWwxdoOcsA7SXK2tJi40pJCqzLG35qHfr9504iFBMMd7VT4v6cgC2ISTarap3fP X-Received: by 2002:a17:903:41c9:b0:1f6:6ab3:9cd7 with SMTP id d9443c01a7336-1f83b5226c7mr44253525ad.13.1718264293292; Thu, 13 Jun 2024 00:38:13 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718264293; cv=pass; d=google.com; s=arc-20160816; b=R66wsUp6GXOSWV/YexjK0rQybhgTfCjon6an9dgJC4fA2sA9brlvHFFA+dwldXCAEH TbfmU8Y1mw2edMkZrEJwwKLV69gX+hXUVAPjEZAN0QXCy5lKOzAUB/zAuUhO45cd355Z EXbLGeTBuPSU+adZLon+b06bdfLbv1M2IUTHzSEywsziGUJeEKKBt+1djnMeJ+2p4emN Yilr9ti4WbJtGmrDJcP10aoF8IX3FmUAIo6G/w20W02HNMpg67GZLJhuKGTHiieCGpgX 2ZeWtvG2RhjwYlDze1gGgvth6jsCgGGXo4WdaNxmrkgxgurJY0N+OCGyBxszYjbhnanB i9wQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:cc:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=pdtRIpWWfjJqcy8ILYrsjKVmJli6un4hJVhxGnKDEAw=; fh=bbgn4619vcplbSVjDShB3OMwMSBGWO5wzAvPJv0py+o=; b=A7XpmJWNn1fcQ4bItj9mngnQua3acj/FQHN+GEIqodXCMRhs9lT02FVfMYA1PstSDz MObjLEOo0OJja7RcjSJEyllZEws9c0uXYVHCn1Og8A273K1n56KTJloJZDNhBw0jZbh8 4AMVTFka0+aSwouAk/2Z+wa6+kK47uHD1z8IdonM1/VfI3VDvrJZFgY48T8/a61yqbgw 8HmnY03v8eAFZTnYFSxff4Hb+2oxnQ7XxUD2ku+xC8Aw+Q9xtzq++VdfgRlvy1nA4djG T2kv8GRTGBMXvGOusM+tc5iKdJXBXkSneiFgC1bjNi7m8DjDIfqqzR/dF82pkKkKbxOg qobg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=dGE89Za5; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-212633-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-212633-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id d9443c01a7336-1f855f1af0bsi7517295ad.602.2024.06.13.00.38.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 00:38:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-212633-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=dGE89Za5; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-212633-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-212633-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 74264B21236 for ; Thu, 13 Jun 2024 06:35:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 23BE1136E38; Thu, 13 Jun 2024 06:35:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="dGE89Za5" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.14]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1775B4C69 for ; Thu, 13 Jun 2024 06:35:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.14 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718260510; cv=none; b=kVSF/2PDgVSfISV+ofOtMEElKzwntkD/Rf5OB6OgrVOs2SqVcUX5QlS9SFPWn1QIFDntsyD2HXplsDk9YnJjaFCyGYEBsFi5+JUGXvlgj+wa8yWqxQoG49p8wyRby4uRXGzDtzjdQSscrR0jr94AicVoshEXSsSRpdHSc4g5sKY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718260510; c=relaxed/simple; bh=2YW1VcDO5vvDgSqZENQpnOTikqYo3+QOeHpBuHEJ79k=; h=Message-ID:Date:MIME-Version:Cc:Subject:To:References:From: In-Reply-To:Content-Type; b=TjFoIz6QI3BYu+5eQRsVsEn/Kk6Q/YfUiKhbjd15pZdF/3CPR8zoyxL6M8huamCFZ1g8LqdQwuZFOP1huTirurJpoX5UmFlBhtwygIZ+Ne9sawnERG9lsNOLRSXcLAHvSmtkV+Ec0HDqUG9BNuqpYK+pbzygZzf02L2WliNMnck= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=dGE89Za5; arc=none smtp.client-ip=198.175.65.14 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1718260509; x=1749796509; h=message-id:date:mime-version:cc:subject:to:references: from:in-reply-to:content-transfer-encoding; bh=2YW1VcDO5vvDgSqZENQpnOTikqYo3+QOeHpBuHEJ79k=; b=dGE89Za5TQg0DkR+uU7MDBQlhQSfQZKn60oE/4g899mT5IIBVqBU4d+q AWW513cPSXKAqrk1Nflr2V3+lbelNma+crpR1nlvShh2puvB0O4IeWEKK pt0ATtOa3e1deO1W/m/KYgqi6Dzcva4zdo6gzlIqPo+BidlB4NeR1htL0 X+9ZjmZo7F83WctpYKM3LlgH0cQoxeEpb8pZbNHJ3o9GEjYPNSfeEhP4j wY9vobIHCGvW+uAm3Dj4JnVktIPO27AOFQQxFVwaPYXlu6IiV6xCOXTbm bYt5kK2O3Rh5jQSdIfkUengLC3Oh8VGAe3wsj+KI7ZwjPu4tpFYK+SHCV w==; X-CSE-ConnectionGUID: DaYubPB9QfCvRYPSsyFiqg== X-CSE-MsgGUID: UrKd/Br7ROKvPkAdP49W8A== X-IronPort-AV: E=McAfee;i="6700,10204,11101"; a="18881197" X-IronPort-AV: E=Sophos;i="6.08,234,1712646000"; d="scan'208";a="18881197" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by orvoesa106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jun 2024 23:35:09 -0700 X-CSE-ConnectionGUID: jdv7yU8XQAu31tmE04AqOg== X-CSE-MsgGUID: x3FFM3qqTRWUpMXS9tD9RA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,234,1712646000"; d="scan'208";a="71241593" Received: from unknown (HELO [10.239.159.127]) ([10.239.159.127]) by fmviesa001.fm.intel.com with ESMTP; 12 Jun 2024 23:35:05 -0700 Message-ID: <52144c4e-0421-46ca-bd00-8602c12c901a@linux.intel.com> Date: Thu, 13 Jun 2024 14:32:46 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Cc: baolu.lu@linux.intel.com, Joerg Roedel , Will Deacon , Robin Murphy , Jean-Philippe Brucker , Nicolin Chen , "Liu, Yi L" , Jacob Pan , Joel Granados , "iommu@lists.linux.dev" , "virtualization@lists.linux-foundation.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH v6 05/10] iommufd: Add fault and response message definitions To: Jason Gunthorpe , "Tian, Kevin" References: <20240527040517.38561-1-baolu.lu@linux.intel.com> <20240527040517.38561-6-baolu.lu@linux.intel.com> <3ee41c29-46bb-4897-9e93-5982c43736cb@linux.intel.com> <20240612131946.GT791043@ziepe.ca> <20240612135021.GY791043@ziepe.ca> Content-Language: en-US From: Baolu Lu In-Reply-To: <20240612135021.GY791043@ziepe.ca> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 6/12/24 9:50 PM, Jason Gunthorpe wrote: > On Wed, Jun 12, 2024 at 10:19:46AM -0300, Jason Gunthorpe wrote: >>>> I prefer not to mess the definition of user API data and the kernel >>>> driver implementation. The kernel driver may change in the future, but >>>> the user API will remain stable for a long time. >>> sure it remains stable for reasonable reason. Here we defined some >>> fields but they are even not used and checked in the kernel. IMHO it >>> suggests redundant definition. If there is value to keep them, do we >>> need to at least verify them same as the completion record? >> They are not here for the kernel, they are here for userspace. >> >> A single HWPT and a single fault queue can be attached to multiple >> devices we need to return the dev_id so that userspace can know which >> device initiated the PRI. Same with PASID. >> >> The only way we could remove them is if we are sure that no vIOMMU >> requires RID or PASID in the virtual fault queue PRI fault message.. I >> don't think that is true? >> >> Cookie is not a replacement, cookie is an opaque value for the kernel >> to use to match a response to a request. > Oh I got this wrong, the above is the response, yeah we can ditch > everything but the cookie, and code right? > > struct iommu_hwpt_page_response { > __u32 cookie; > __u32 code; > }; > > What is the workflow here? We expect the VMM will take the vIOMMU > response and match it to a request cookie for the kernel to complete? The workflow in the host kernel involves looking up the iopf_group using the cookie value in the response queue and then responding to the iopf_group with the code. Therefore, from the host kernel's perspective, it is acceptable if the user only passes the cookie and code in the response message. Since you both agreed that the response message could be simplified, I will implement the above structure in the new version. Best regards, baolu