Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp399917rwr; Tue, 2 May 2023 23:38:29 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6sSFzI299fAiiL5i60dy2s0BQMMHiOsC3M1LGahosw4h04LpFaRh1R27y0a7vCHr7dPHFV X-Received: by 2002:a05:6a00:1254:b0:636:f5f4:5308 with SMTP id u20-20020a056a00125400b00636f5f45308mr27689720pfi.7.1683095909423; Tue, 02 May 2023 23:38:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683095909; cv=none; d=google.com; s=arc-20160816; b=llv5W74iOJ4U0vSuIw/honVBJfvLBqUudyMOqPWiKlKM31gBCDYrdR92XJfFarNOk8 U/ZsnxU2ARvScbfUpg7myJ48XZUgC08M+V7HZQj5IXZYGsJyAZKb1IyfwwRS7y7X6nEv DJ8GsdgFE6Z8dOpj1ir5b/bUNsgq5e1eYq5l4Q9u8gae4G3OT8tSA5vqN4GEMi+dzBOi 0cW1XPQ7G9PicNoePp3/GK1PeDUEdmEoq07VcyUNnmf9nHNHxdwR4dWvSsPxSJ3xgycI YVmg7ECS0PwrVpmnx+beILu+iFvTE8Ato1IHNrMmsx//uZjYXesZxKznVfx+zs6ZtTS9 9tDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:to:content-language:subject:cc:user-agent:mime-version :date:message-id:dkim-signature; bh=mAxe/rlPcrokpq0BPQ8BaFXZRTKe4QZ7jf/6L2M7vbA=; b=wRXWvT5YjX/oOfk3ya2sAzJE0SJN9K6Ed160yKtmWFDWCqHX7bdyAobwk+JHVId0fi j3be+20lOBJfiO5Rnin6zprLoAHNfV313MQ/AsvZ7FMk/edA6XJUkyYTZlsxX8HkZM3G OJ6mR+NYz2uNM1Se3KupcYcDWT2KRTkvFe0C4kb719ZYmnwo0o1UKONNBHshaqAPjwuB wf/Ra0rqdX/s6bGNFW2EZbL6aI786Ytqrm5MlHYLxtRQwTen0TLwWQQn19BXjU+QKtMm u/QqO5cWPPaAmyzZJjQBJSKHetmfGimI0j1u7Z8N65FcIE0tsfhc0oypNko5Xxhhv1gH Cgsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Zb6ACV6P; 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=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r10-20020a632b0a000000b005286d7712d1si21440161pgr.672.2023.05.02.23.38.15; Tue, 02 May 2023 23:38:29 -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=@intel.com header.s=Intel header.b=Zb6ACV6P; 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229660AbjECGho (ORCPT + 99 others); Wed, 3 May 2023 02:37:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44442 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229488AbjECGhn (ORCPT ); Wed, 3 May 2023 02:37:43 -0400 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06086B8; Tue, 2 May 2023 23:37:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1683095862; x=1714631862; h=message-id:date:mime-version:cc:subject:to:references: from:in-reply-to:content-transfer-encoding; bh=igBS5JYjxm12TUIwYix1XFx53k9IZdzxu0ykqR6Gpfk=; b=Zb6ACV6P0SlYwB+eM7BFG44wIOMArSSB9mVDE5J021JIZkdHNu+K6VZd WlH18sb5lZTRGd2QoawGRQyVJ+16IcspS1TmVlETl9lT8Mp7Hx/eZnXS2 haWD8oj8c/wPzQx1KxlGHPzENGei+/AY469LtJh1ZAMAUBuhPPOLYCkrk f7fMZ51wbrJBtgmPe8iIhLkgIx78OiouUSGtHN85xJ5mFrTG9bGGeKp63 78aHMsBZPUMe8DThWvFh/vWy/ab8Qs4qxntyq9ntD9CLTCPp8/Q5Kkcyx wVIg4PQyE5nr10ywRw1pDHVyNwg17wH5AiQe4gLf5lNPLX1rTo74Z7AmS g==; X-IronPort-AV: E=McAfee;i="6600,9927,10698"; a="348623712" X-IronPort-AV: E=Sophos;i="5.99,246,1677571200"; d="scan'208";a="348623712" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 May 2023 23:37:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10698"; a="673962607" X-IronPort-AV: E=Sophos;i="5.99,246,1677571200"; d="scan'208";a="673962607" Received: from allen-box.sh.intel.com (HELO [10.239.159.127]) ([10.239.159.127]) by orsmga006.jf.intel.com with ESMTP; 02 May 2023 23:37:36 -0700 Message-ID: <9fb1c0dd-ea78-a3f7-9eac-3154f5d08ad5@linux.intel.com> Date: Wed, 3 May 2023 14:37:16 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Cc: baolu.lu@linux.intel.com, Will Deacon , David Woodhouse , "Raj, Ashok" , "Liu, Yi L" , "Yu, Fenghua" , "Jiang, Dave" , "Luck, Tony" , "Zanussi, Tom" , "Ranganathan, Narayan" Subject: Re: [PATCH v5 4/7] iommu/vt-d: Factoring out PASID set up helper function Content-Language: en-US To: "Tian, Kevin" , Jacob Pan , LKML , "iommu@lists.linux.dev" , Robin Murphy , Jason Gunthorpe , Joerg Roedel , "dmaengine@vger.kernel.org" , "vkoul@kernel.org" References: <20230427174937.471668-1-jacob.jun.pan@linux.intel.com> <20230427174937.471668-5-jacob.jun.pan@linux.intel.com> From: Baolu Lu In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-5.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 4/28/23 5:47 PM, Tian, Kevin wrote: >> From: Jacob Pan >> Sent: Friday, April 28, 2023 1:50 AM >> >> >> +static int dmar_domain_attach_device_pasid(struct dmar_domain *domain, >> + struct intel_iommu *iommu, >> + struct device *dev, ioasid_t pasid) >> +{ >> + int ret; >> + >> + /* PASID table is mandatory for a PCI device in scalable mode. */ >> + if (!sm_supported(iommu) && dev_is_real_dma_subdevice(dev)) >> + return -EOPNOTSUPP; > > "&&" should be "||" > Also should return success instead if this is a RID case. Perhaps, if (!sm_supported(iommu) || dev_is_real_dma_subdevice(dev)) return pasid == RID2PASID ? 0 : -EOPNOTSUPP; Best regards, baolu