Received: by 2002:a05:6500:1b8f:b0:1fa:5c73:8e2d with SMTP id df15csp1013240lqb; Wed, 29 May 2024 19:00:07 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWiCtxVo9q2AOvzSCM2aOChBUv1iTlQGQCEhlLi82iO4SmnD5Tt5JKOzDKwGWKgPjaeLnqMyDzWBQYoOCRaixvv+s3vxXXzDvGe3JqA/g== X-Google-Smtp-Source: AGHT+IEcRrlOfuQ4wFJ9+Bgo9UE9NDq5hiBtcnJVG0FChao1Uh4llE6yAa2yW9eIMC33pBdBcSz+ X-Received: by 2002:a2e:3213:0:b0:2e9:845a:8f1c with SMTP id 38308e7fff4ca-2ea84876f65mr4606131fa.51.1717034407154; Wed, 29 May 2024 19:00:07 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717034407; cv=pass; d=google.com; s=arc-20160816; b=xw3evpikKtZGXlanRPammJx28hMLzeYkn1Xx95OqU58OjMuZY12pHfG6kEUKSsxrQb En+yemnH3R37kDa8qCFo0lYiVZUnYpP4JFag+gPok3Lb42wOsxFNPx/arLx+OGPWTddS eorIBvb8tLFhpDzF/0+cxfX/79FcQRZRP9R6zt0iyCJpWVLuUWQq20roedhSwBIDx39v fQdnyO9/TBqrw0lVPWXyU7jzY+wZS3lZMKAzzmxsNg702L9NcM4cpM1ndtIZbtQ54fwE UPgTuFG2ptAQyYc/l7Aa+r4oY5zpOEHOGZp6eatsd9lzyjTxQ6ZVv4LEHz7FcDiq7emg fFhQ== 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=i2imM9isemAnjkKsGlx+lWwIbO2ykunUosw5sVUYiyk=; fh=ja0RdY/59LAVcCMp0MzX6U24NRg4kgA09n+XC1RbAas=; b=mS4Xx6eZG8KSTFgrKAMVcppboxQoTaUnUb0/M8a5k++oOYjsUG2vsuGQ0PUa8g7ak1 0qnTecIYyGKOPir8ITBNfWwYvG1uHAZU8ZQgNFreiPyihx4qsNrqSdmA1VuKQNM79UYZ 7Bo5q9AMutZ89iRZhLE/8LiLdjC+c/oBnnJoWYNojBpNUXm9V9qdurVckKRdAF6ilfHp KE8kR5fZ332KQ5yAMaioxTixCdQ9QovPb4egpHSgiUr8ezpu6YMaUfOZQwWbTEO6eGYX FhG6RyqZFUYTfJAki5B+XdrgrqiYkQHxdTYWQudIQTzfvOl+K6fwpxHsloEGmSoQJdYo xTHA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Ayh5bLhP; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-194863-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-194863-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-57852331539si6658702a12.60.2024.05.29.19.00.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 May 2024 19:00:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-194863-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Ayh5bLhP; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-194863-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-194863-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 am.mirrors.kernel.org (Postfix) with ESMTPS id D8B861F22442 for ; Thu, 30 May 2024 02:00:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3EA3418040; Thu, 30 May 2024 01:59:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Ayh5bLhP" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.16]) (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 1E60917984 for ; Thu, 30 May 2024 01:59:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.16 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717034398; cv=none; b=VheVP1q1kec5R+Jto9TQP0ascB1IXxwCsILGWy1JIDB/AkfQKsANZjGrM4GzRtCDXOJy0OUn5IsTx4A/nviPPEc4UyKqBUsQJ3agAdoZbFiEamZ2eB8EP+/Fm9TLHhBiysyw/JuBHLRPullWLKrY8ymN11n788f9jVALTWJJY7c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717034398; c=relaxed/simple; bh=gABtIQ1IVnWtIpyNnlREUkUWdePI1O7IO8tBxNUdv9s=; h=Message-ID:Date:MIME-Version:Cc:Subject:To:References:From: In-Reply-To:Content-Type; b=V99U1azW+KLDxE5nCPTULAAZTLnmoPGERrVwILQdgjIfkDONzdPtr8JidBppIrBOyFrYOwFRzgDQUre+ESzr4NMsV7BJp+8c2eqMp5mACzTvs46a3ZQi70UHlq1yfqAYBqmhzCTSj5F8RN43OrlqeW82F+3EBnze1vgIEdDnJZ4= 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=Ayh5bLhP; arc=none smtp.client-ip=198.175.65.16 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=1717034397; x=1748570397; h=message-id:date:mime-version:cc:subject:to:references: from:in-reply-to:content-transfer-encoding; bh=gABtIQ1IVnWtIpyNnlREUkUWdePI1O7IO8tBxNUdv9s=; b=Ayh5bLhPcbI2r9lXYSCrhpiStojEWZXNUqjEkhKehq2V9n7agDHsN3NW HtTp0nCWRhPJ4U+J6EMbYA3nabWbmRlIGtK6swL89rXb+k9Hlf2pBLamG fbqEwOkBrTCxon83DRO0bS8hU2TddrgvDttEGC/AWulnw8BTU01h4SGC1 Xu/zXiOL48lpJ7id3MIWsyqFwxUJJejLr343xrZOgaoEMhVIVEkB2uHV7 jAAeL2WEfG03Z6stDXFzL8WQVeDK0Qw5Lr7B2QdiiJpSKaFKckKSbAwjl yWxU6VmFwt3SE9mrwswM5gjPMhcn5yhvRySLYBoONJqvmo806GT/P6Cnu A==; X-CSE-ConnectionGUID: 9w1xEtJARyaBnQmfZrVF1g== X-CSE-MsgGUID: pYp3jDYQTQ+3ewofFJDRnA== X-IronPort-AV: E=McAfee;i="6600,9927,11087"; a="13603749" X-IronPort-AV: E=Sophos;i="6.08,199,1712646000"; d="scan'208";a="13603749" Received: from fmviesa010.fm.intel.com ([10.60.135.150]) by orvoesa108.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 May 2024 18:59:56 -0700 X-CSE-ConnectionGUID: e2ThULVYQjWFaAgrf64Qxw== X-CSE-MsgGUID: ZnxPBhm4TZ2ocKKCJ+0d9w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,199,1712646000"; d="scan'208";a="35737116" Received: from unknown (HELO [10.239.159.127]) ([10.239.159.127]) by fmviesa010.fm.intel.com with ESMTP; 29 May 2024 18:59:51 -0700 Message-ID: <960bfc23-22b3-48d1-baa6-2707767875c5@linux.intel.com> Date: Thu, 30 May 2024 09:57:44 +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 , Yi Liu , David Airlie , Daniel Vetter , Kalle Valo , Bjorn Andersson , Mathieu Poirier , Alex Williamson , mst@redhat.com, Jason Wang , Thierry Reding , Jonathan Hunter , Mikko Perttunen , iommu@lists.linux.dev, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 06/20] drm/msm: Use iommu_paging_domain_alloc() To: Dmitry Baryshkov References: <20240529053250.91284-1-baolu.lu@linux.intel.com> <20240529053250.91284-7-baolu.lu@linux.intel.com> Content-Language: en-US From: Baolu Lu In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 5/29/24 4:21 PM, Dmitry Baryshkov wrote: > On Wed, May 29, 2024 at 01:32:36PM +0800, Lu Baolu wrote: >> The domain allocated in msm_iommu_new() is for the @dev. Replace >> iommu_domain_alloc() with iommu_paging_domain_alloc() to make it explicit. >> >> Update msm_iommu_new() to always return ERR_PTR in failure cases instead >> of NULL. > Please don't mix unrelated changes, because ... > >> Signed-off-by: Lu Baolu >> --- >> drivers/gpu/drm/msm/msm_iommu.c | 8 ++++---- >> 1 file changed, 4 insertions(+), 4 deletions(-) >> >> diff --git a/drivers/gpu/drm/msm/msm_iommu.c b/drivers/gpu/drm/msm/msm_iommu.c >> index d5512037c38b..f7e28d4b5f62 100644 >> --- a/drivers/gpu/drm/msm/msm_iommu.c >> +++ b/drivers/gpu/drm/msm/msm_iommu.c >> @@ -407,9 +407,9 @@ struct msm_mmu *msm_iommu_new(struct device *dev, unsigned long quirks) >> struct msm_iommu *iommu; >> int ret; >> >> - domain = iommu_domain_alloc(dev->bus); >> - if (!domain) >> - return NULL; >> + domain = iommu_paging_domain_alloc(dev); >> + if (IS_ERR(domain)) >> + return ERR_CAST(domain); >> >> iommu_set_pgtable_quirks(domain, quirks); >> >> @@ -441,7 +441,7 @@ struct msm_mmu *msm_iommu_gpu_new(struct device *dev, struct msm_gpu *gpu, unsig >> struct msm_mmu *mmu; >> >> mmu = msm_iommu_new(dev, quirks); >> - if (IS_ERR_OR_NULL(mmu)) >> + if (IS_ERR(mmu)) >> return mmu; > NAK, not having an IOMMU is a poor but legit usecase for some of devices > which don't have IOMMU support yet (for example because of the buggy > implementation for which we were not able to get all the hooks in). > > Please don't break compatibility for existing platforms. Sure. I will remove this line of change. Though I have no idea in which case msm_iommu_new() could return NULL after this patch. Best regards, baolu