Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp1779540rdb; Thu, 25 Jan 2024 06:05:06 -0800 (PST) X-Google-Smtp-Source: AGHT+IEPR5L8G+XBA+SpVKjBMM2zJJyS8uaIypDiETLcJNaRcl56+j0Mg2OKS32dbEhcoZdLYltK X-Received: by 2002:a05:620a:3c3:b0:783:7674:29a7 with SMTP id r3-20020a05620a03c300b00783767429a7mr1001192qkm.68.1706191506107; Thu, 25 Jan 2024 06:05:06 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706191506; cv=pass; d=google.com; s=arc-20160816; b=xfsvBj4xmNcjPLfec0c7lzVwYEpEDKGG+9i+DDpvr7gWHdL46paBf0fri+MrRwrgmM 6pkVF/1BOwWJu6Ep/w5WNRzzmEHG7Z6tXusfMY5vkHTP+97Hz3dQ2V5L0whtTxcTh6mP OHsxco2sxI8v/EWDLzq7gSjMF5nXGYa0ZjMxnVfqINKXLHbJ9VtJPcWf3HQ8pHfIjc6o ruJnbsrC2gmo0bfIkpDjqPKM736E3LaA9+DnrD+i8xuflepYStGhk7bi/Hbd2R5VbSca 9mwDVowCLHjEr5mVtappFH8++3DF69hxFCAAgPdq3iNqArWMKnT/gKULcGQhXRGxOVqW YN4w== 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:references:to :content-language:subject:cc:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id :dkim-signature; bh=k2eW9KlQ3XktCjemDMXagKU68dWamp1sCjM6Cpjpz0Y=; fh=ZKXJP9nZ9+vzzrmAlwqt3si6ukgU5wIFL5ZG6wx3oGc=; b=qW+sEjUQXicRI6ZKnar+dkjlqaLO0Z3uAvLYvqrNoQop3Nz6biTtGl+NHuMhTWSwlV XYJLPiPjZoaDOkfmpy2eboUiPHjZ8PZZWOl7LQPWwULQaPrEKNqovDJ9KWPptLakSYrh mtxer/BCOyIGMIuX7f3VOZNzBB+deIPpaVBGlMdVLQUWNSEm3sW/Yrj1tgzvIIyFJBGN vcVrQm6mnHKoAwnXnzLza3QYRtpUEwCzctP3SRdCQXPJhGsffJZDEX10QXoJUnDk5WGK eWjvTqQTbIvoF4zDq1GiY7mVINLoWq2GO5vxAeHaZ6j88pQud7Dl5S9l0QAIiIEj1zIt 7WBQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=nhJuwrJd; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-38523-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-38523-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id t10-20020a05620a450a00b0078326700274si13932219qkp.482.2024.01.25.06.05.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jan 2024 06:05:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-38523-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=nhJuwrJd; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-38523-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-38523-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 24A9B1C23B1F for ; Thu, 25 Jan 2024 11:37:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 40A9D4502F; Thu, 25 Jan 2024 11:33:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="nhJuwrJd" Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.31]) (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 EBF2741744; Thu, 25 Jan 2024 11:33:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=134.134.136.31 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706182433; cv=none; b=m+DSsTj2DVsjYZpp439MrkG8N5VUykw77cVpZTHsYR81c+u8ZHarDPGEl8CBfVCX9+cJvszReh7Zus2oP6LduRt4goSep6CUlI8lOUC1CS9maC03iLurSS/4Dy9tCGo/O450LMQqAQJr85GE4tHTTgv3GBEZZVgA62k3D2RMQj0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706182433; c=relaxed/simple; bh=79Mq1ZnJKV7PdAzDq1uAOf2d4SKGw7H6Dm+xZXHOOqE=; h=Message-ID:Date:MIME-Version:Cc:Subject:To:References:From: In-Reply-To:Content-Type; b=Pc43VlgjyeVpoKOSJfcrgkLD+PmwjZPGoj4gibI4vSKByLVtPzrXBx+RF3HoDVLXIi7Csq9NK/Bn46jQKzi9/zwbgkYCLlRUq1xjzy36op0ndwEKkc2z7WQ8EeyEZ5gwdoi1IEkHE7k2JAe2v26MZ14dg1NYxhL8g68OIMPwp7Y= 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=nhJuwrJd; arc=none smtp.client-ip=134.134.136.31 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=1706182431; x=1737718431; h=message-id:date:mime-version:cc:subject:to:references: from:in-reply-to:content-transfer-encoding; bh=79Mq1ZnJKV7PdAzDq1uAOf2d4SKGw7H6Dm+xZXHOOqE=; b=nhJuwrJdsU713Jl1UIncjJN3HsklP8Y9fDia76D/AWQeQkE/JTU8CQZh DLsaqg6ZwDijf2LkWeUT2C0gmGYOMEliz1379ZF+lQrKUIFs9hAQJXlJx F22qULgIpOUbBi7kUJRDuLMNG9a0k1ZwfmLpGDsmOUe5ngbuO9PXI6FDX dH/2DfsGRWrpLV+YtbyIkGmfxcL2v8MkAWVpL2T+ZcV9MidjsPbBcEQdp 2RNEQzqgimw8PHVoJEJuBVU9CT5uxMhbpfpguttCagrPUdW5K7vj/vx3v PEbo6yuJg0YM6dTh+uqyO/cUpL1zW4LgU2nR6E35+7XGI6/mgZq5r/XzN Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10962"; a="466417296" X-IronPort-AV: E=Sophos;i="6.05,216,1701158400"; d="scan'208";a="466417296" Received: from fmviesa004.fm.intel.com ([10.60.135.144]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Jan 2024 03:33:51 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.05,216,1701158400"; d="scan'208";a="2385166" Received: from blu2-mobl.ccr.corp.intel.com (HELO [10.254.209.226]) ([10.254.209.226]) by fmviesa004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Jan 2024 03:33:47 -0800 Message-ID: Date: Thu, 25 Jan 2024 19:33:45 +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 , Jason Gunthorpe , Kevin Tian , Jean-Philippe Brucker , Nicolin Chen , Yi Liu , Jacob Pan , Longfang Liu , Yan Zhao , iommu@lists.linux.dev, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Jason Gunthorpe Subject: Re: [PATCH v10 04/16] iommu: Cleanup iopf data structure definitions Content-Language: en-US To: Joel Granados References: <20240122054308.23901-1-baolu.lu@linux.intel.com> <20240122054308.23901-5-baolu.lu@linux.intel.com> <20240125102326.rgos2wizh273rteq@localhost> From: Baolu Lu In-Reply-To: <20240125102326.rgos2wizh273rteq@localhost> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 2024/1/25 18:23, Joel Granados wrote: >> diff --git a/drivers/iommu/io-pgfault.c b/drivers/iommu/io-pgfault.c >> index e5b8b9110c13..24b5545352ae 100644 >> --- a/drivers/iommu/io-pgfault.c >> +++ b/drivers/iommu/io-pgfault.c >> @@ -56,7 +56,6 @@ static int iopf_complete_group(struct device *dev, struct iopf_fault *iopf, >> enum iommu_page_response_code status) >> { >> struct iommu_page_response resp = { >> - .version = IOMMU_PAGE_RESP_VERSION_1, >> .pasid = iopf->fault.prm.pasid, >> .grpid = iopf->fault.prm.grpid, >> .code = status, >> diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c >> index 68e648b55767..b88dc3e0595c 100644 >> --- a/drivers/iommu/iommu.c >> +++ b/drivers/iommu/iommu.c >> @@ -1494,10 +1494,6 @@ int iommu_page_response(struct device *dev, >> if (!param || !param->fault_param) >> return -EINVAL; >> >> - if (msg->version != IOMMU_PAGE_RESP_VERSION_1 || >> - msg->flags & ~IOMMU_PAGE_RESP_PASID_VALID) >> - return -EINVAL; >> - > I see that this function `iommu_page_response` eventually lands in > drivers/iommu/io-pgfault.c as `iopf_group_response`. But it seems that > the check for IOMMU_PAGE_RESP_PASID_VALID is dropped. > > I see that after applying [1] and [2] there are only three places where > IOMMU_PAGE_RESP_PASID_VALID appears in the code: One is the definition > and the other two are just setting the value. We effectively dropped the Yes, really. Thanks for pointing this out. $ git grep IOMMU_PAGE_RESP_PASID_VALID drivers/iommu/io-pgfault.c: resp.flags = IOMMU_PAGE_RESP_PASID_VALID; drivers/iommu/io-pgfault.c: resp.flags = IOMMU_PAGE_RESP_PASID_VALID; include/linux/iommu.h:#define IOMMU_PAGE_RESP_PASID_VALID (1 << 0) > check. Is the drop intended? and if so, should we just get rid of > IOMMU_PAGE_RESP_PASID_VALID? In my opinion, we should keep this hardware detail in the individual driver. When the page fault handling framework in IOMMU and IOMMUFD subsystems includes a valid PASID in the fault message, the response message should also contain the *same* PASID value. Individual drivers should be responsible for deciding whether to include the PASID in the messages they provide for the hardware. > > Best > > [1]https://lore.kernel.org/all/20240122054308.23901-1-baolu.lu@linux.intel.com > [2]https://lore.kernel.org/all/20240122073903.24406-1-baolu.lu@linux.intel.com Best regards, baolu