Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp267095pxx; Thu, 29 Oct 2020 02:01:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyni3afEPI9FHVqrW+U8tQAdU9lYvlCiqDLRjiT2Ln3gsAFwWoU0HdSmss2d83ugMSL2nuX X-Received: by 2002:a17:906:b24c:: with SMTP id ce12mr2959369ejb.386.1603962094666; Thu, 29 Oct 2020 02:01:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603962094; cv=none; d=google.com; s=arc-20160816; b=SRHNvyTd/gY80WBpSW1IVunqt38RCWgh10FMKta4eug5uOlTMbH5d58zTo9RFkPUgw qicOr/pGF+jqo6YlVMc8MEy8CF189T6gwXCj0i/AAJS2kXswjjRErSanMNzBxt22wreL Bu9E7qGAL0wIuCyD4spGJSEOEegosQ1xntLfn2u4AHJP98ItqXlJwgYkvNz5vwl4tzhQ y9zFh46vKw26h++jl0ak0dviRL2ckq0hfrY+VfNpc/6UnL1n4lTeBlhiG5a0AukP9pKq fgLcnxsLzxjqPKsJfiKfOuvR0q9VSpJhqet6o6vUCM8cR1s0HQb2FM5cfCFj2v5DqFjU J5Lw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :ironport-sdr:ironport-sdr; bh=6Xdpi91qFIkgvul7D1JYHCTEYbJo6X50IroEJCl3EQ8=; b=mmK5kWI4ckkjRlUGvysEufOcWqKbKzi+cD8jnfbWc1Jx6d3G+1HNce6G2TO3rndmUN BoqyKxARBS4E7jukyVQ6QtUk55N1gwItB1jzk7+1wKgLcp70VGgTOVndGmNmwvNhdl2Z IAXkx+4e1Z9RcDO84TgJdbJ6+x/RcWcV/htcQNPlLGDgBj2MuGBt7F3OSEX61C6qjmr1 j8nTcyPawyKWhfgQ++dBjSQm5f3CjrbwIc9M8yQEMIeZHPho3IapnD478PQI+L7Qk1o2 nEh07hqiE9CmAIVM6u2mX3/2t/dp7ZqYt2he8KuaWRSccMJApytPxz03DJ+YEQOApjQu BzPQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a9si1591368edn.311.2020.10.29.02.01.13; Thu, 29 Oct 2020 02:01:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729763AbgJ2HiP (ORCPT + 99 others); Thu, 29 Oct 2020 03:38:15 -0400 Received: from mga12.intel.com ([192.55.52.136]:55426 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729712AbgJ2Hh6 (ORCPT ); Thu, 29 Oct 2020 03:37:58 -0400 IronPort-SDR: 5uYCoCOJyEC5cqlUQRO/L8VrfAI0NWRnTGF2IStfLTLD1BBUrybN60MGAOdFrQ6RMvn7O1mW+p QPwbIrvTYDiw== X-IronPort-AV: E=McAfee;i="6000,8403,9788"; a="147668490" X-IronPort-AV: E=Sophos;i="5.77,429,1596524400"; d="scan'208";a="147668490" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Oct 2020 23:34:43 -0700 IronPort-SDR: TO89TgFWTBwxKI1wY/dCWuN+2xZpIKFfD6OZHHKIi+BrK8tmn4aUkmjc/QmsD+amF7DblA7KJy ArXxYTG5KI9Q== X-IronPort-AV: E=Sophos;i="5.77,429,1596524400"; d="scan'208";a="536544945" Received: from yisun1-ubuntu.bj.intel.com (HELO yi.y.sun) ([10.238.156.116]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-SHA256; 28 Oct 2020 23:34:41 -0700 Date: Thu, 29 Oct 2020 14:30:02 +0800 From: Yi Sun To: Jean-Philippe Brucker Cc: joro@8bytes.org, dwmw2@infradead.org, baolu.lu@linux.intel.com, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v1 2/3] iommu: Fix an issue in iommu_page_response() flags check Message-ID: <20201029063002.GE27139@yi.y.sun> References: <1603849018-6578-1-git-send-email-yi.y.sun@linux.intel.com> <1603849018-6578-3-git-send-email-yi.y.sun@linux.intel.com> <20201028091356.GB2328726@myrica> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20201028091356.GB2328726@myrica> User-Agent: Mutt/1.5.21 (2010-09-15) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 20-10-28 10:13:56, Jean-Philippe Brucker wrote: > Hi, > > On Wed, Oct 28, 2020 at 09:36:57AM +0800, Yi Sun wrote: > > From: Jacob Pan > > > > original code fails when LAST_PAGE is set in flags. > > LAST_PAGE is not documented to be a valid flags for page_response. > So isn't failing the right thing to do? > > > > > Signed-off-by: Jacob Pan > > Signed-off-by: Liu Yi L > > Signed-off-by: Yi Sun > > --- > > drivers/iommu/iommu.c | 6 ++++-- > > 1 file changed, 4 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c > > index 8c470f4..053cec3 100644 > > --- a/drivers/iommu/iommu.c > > +++ b/drivers/iommu/iommu.c > > @@ -1200,9 +1200,11 @@ int iommu_page_response(struct device *dev, > > return -EINVAL; > > > > if (msg->version != IOMMU_PAGE_RESP_VERSION_1 || > > - msg->flags & ~IOMMU_PAGE_RESP_PASID_VALID) > > + !(msg->flags & IOMMU_PAGE_RESP_PASID_VALID)) { > > It should be OK not to have PASID_VALID set, we're just checking for > undefined flags here. > Thanks! You are right. Per published spec, we should not care LAST_PAGE for page_response. I will remove this patch in next version. > Thanks, > Jean > > > + dev_warn_ratelimited(dev, "%s:Invalid ver %x: flags %x\n", > > + __func__, msg->version, msg->flags); > > return -EINVAL; > > - > > + } > > /* Only send response if there is a fault report pending */ > > mutex_lock(¶m->fault_param->lock); > > if (list_empty(¶m->fault_param->faults)) { > > -- > > 2.7.4 > > > > _______________________________________________ > > iommu mailing list > > iommu@lists.linux-foundation.org > > https://lists.linuxfoundation.org/mailman/listinfo/iommu