From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 765D238839F for ; Mon, 25 May 2026 20:30:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.170 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779741029; cv=none; b=Zla9MoxrjGYw/51hLFYr8ABxacNbZWoNNjBI3cu4q5/9GlvSzx0PZ6p550sMZN/A3t58s0MXJh5TAMzgjiBWdFcjkapGpggJMsIwojrEE3/QpbvcqZxIWCsdg63C2M5KEPwltkL81oe9xhSdJeVEGiCGtazLGdxvWnelju3LcLg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779741029; c=relaxed/simple; bh=fb1sV8f7GTFbilAJDWZVAHBiDupn0F6kRbrmdEB9hdc=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=u6scNpc0au5g9WczojpXgeB8yEiMkBg0JoKaEvOSjTOOODOfD9gGrGSK2hFIk9CeB/m/ZxVuZ9soQmWHMz5pXThMXUnNEDScBcdN18Hxr5ICTijRdYQvvDmkU2IHvEvFhco8pbxMPoU88+WG7IGlVVLYfGrO1x6kERMG+U56SRo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=TvGgPnLj; arc=none smtp.client-ip=209.85.214.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="TvGgPnLj" Received: by mail-pl1-f170.google.com with SMTP id d9443c01a7336-2b2e8b95bdbso435ad.0 for ; Mon, 25 May 2026 13:30:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1779741028; x=1780345828; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=zWhZgy3CvZVYPvW9umuB7DRocYTW3QJrl2ACJkt8tw8=; b=TvGgPnLju0A3L6Kb70FeUQrFkGZwllJegTFvFNEyrGKpqZjQUbC4bqHyRuEEI0rE5p to/y8Hgg2GbE7obeVh/BZS9dmE7AeY5QPEANjdumwZA9mL9U7i0qZb71oaIZVMzVGjQe hcefavqoV6omNnI/L+m4dzyz+RSJY+aFHJVNdjvgbXKn88AaMIUjOPc+p51TKXcfG4mA FdxKsskjzF3nkQwBdTr8BywMk1j3t3aREOSZisWaStZ9u5jaorM1negOWiPkUo8r+q8q zu3x5ghf34/RA21msRXdvQiCnnIIZ4YK/Lc/sd0/tBv7CuywZUKVxShMeCOJF+RwM1jJ GZpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779741028; x=1780345828; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zWhZgy3CvZVYPvW9umuB7DRocYTW3QJrl2ACJkt8tw8=; b=hS+++ZLvv8lJUqkeldlS9zJbpxD/dVs1oV25VLA4+7BwLQa7Ep0UzoUxA3cMygeV0S oB6axk1BtdvzfxIm4sEorjEB+NZpsI7O2pUAnKWLPQ2lBLN6vcali7WVENo5JbLlqHnk kw/QcQZ0y2zfMxmzW8tOuVdV8VCKFQ5k3yJ8eXD32x3e0noruSqNcBiXW18LaFotP1XP bOECd0aoVXgjMvRg6Yqpbay9vKwYzW8hT37i3xZ54xvyvpI7TlMbOh/OdaV9g2AKW/j3 suXlJ3FzRw/7G3cJKNqXh/+ohCU5JR0B6DPmXUGeF/mmnLilQzTOUnm5LSLnEBJ6yjx8 odVQ== X-Forwarded-Encrypted: i=1; AFNElJ9hFtSV7+hFT7oC+naBlruDFkujh6uge473ls+1R0m4SpSwC+Ed3sH4m7JbSZTL2atMhFBpluoaNBjlEyA=@vger.kernel.org X-Gm-Message-State: AOJu0Yypa2jLkAIsFjfOmnlqYn53NBU0Ce4uVf9w5lg3x7Ux9DUMt9tG vOAAKrzaqMgUL1AWrfrYzJx3c0XuyA+7hMYCqy1Ovo2AUlz+SLAMCWOTz8rOaJuOJg== X-Gm-Gg: Acq92OE0roYpme1q2iom/ZeKvct7ar7Y7XxKhtRWi3Gk/W4+DwtBeatJbiSe38056jH NPE7IRw6gygbWn1C1zEXeZq6DjlyfwpszMJ9WA4TdxE4Jo7Jbj3rEa6J+l2begIPcUjsGjm0aKv F/hsnqzeXUU/d4VvzcVeYMKurscp+jnEebKVBsuxm8nGrUA3tb+vzaUSvmVCbfA0e8pLeHkoT6Q fS8L+FpCOBwq6aOUZcfysKDaqrwydgBxYkVuy9hxR2CMeWXy55/yyESe1IGoeL1dFVkpnx/a2Ym UwIegw+KpewBpkQbnr3ryTyUjRA+mb9l8My3ZWX4sWI5vn/T/y4rcIbVY/jxw0+rMYh3BNddLrw WRpfjlUCLQRrmn9iINBxeZ7oKs2Uz5gVrIEF/Z+r847irlFDGn5E/hXDmf5nPwuA7ltihKvcuVL izzdCnOHDhXjmuS9fmERoKnCtOb4b9I/bqdM3fqoy6tSQ0IypajMntcvZk+aRyQBSkktOc X-Received: by 2002:a17:903:1aeb:b0:2b4:6529:7bae with SMTP id d9443c01a7336-2bec11c2cc4mr3609585ad.17.1779741026873; Mon, 25 May 2026 13:30:26 -0700 (PDT) Received: from google.com (44.234.124.34.bc.googleusercontent.com. [34.124.234.44]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-36adc0a6e94sm4597808a91.4.2026.05.25.13.30.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 May 2026 13:30:26 -0700 (PDT) Date: Mon, 25 May 2026 20:30:18 +0000 From: Pranjal Shrivastava To: Nicolin Chen Cc: iommu@lists.linux.dev, linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Joerg Roedel , Will Deacon , Bjorn Helgaas , David Woodhouse , Lu Baolu , Robin Murphy , Suravee Suthikulpanit , Jason Gunthorpe , David Matlack , Samiullah Khawaja , Daniel Mentz , Pasha Tatashin , Mostafa Saleh Subject: Re: [PATCH v4 3/5] iommu/arm-smmu-v3: Fix ATS state tracking Message-ID: References: <20260525184347.4059549-1-praan@google.com> <20260525184347.4059549-4-praan@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Mon, May 25, 2026 at 01:05:36PM -0700, Nicolin Chen wrote: > On Mon, May 25, 2026 at 06:43:45PM +0000, Pranjal Shrivastava wrote: > > @@ -3065,8 +3065,14 @@ static void arm_smmu_enable_ats(struct arm_smmu_master *master) > > * ATC invalidation of PASID 0 causes the entire ATC to be flushed. > > */ > > arm_smmu_atc_inv_master(master, IOMMU_NO_PASID); > > - if (pci_enable_ats(pdev, stu)) > > - dev_err(master->dev, "Failed to enable ATS (STU %zu)\n", stu); > > + > > + /* > > + * Any failure at this point is a kernel bug. pci_ats_supported() > > + * and pci_prepare_ats() have already verified the hardware capability > > + * and programmed the STU. Thus, pci_enable_ats() should not fail here. > > Nits: > - WARN usually indicates a kernel bug already. > - pci_prepare_ats() covers pci_ats_supported(). Ack. For the pci_ats_supported.. since we're failing probe if pci_prepare_ats() fails, the idea was to call prepare only if ATS was supported [1] i.e. not penalise non-ATS callers of pci_prepare_ats. But I agree.. maybe a better way would be to factor our pci_ats_supported(). > > /* > * As pci_prepare_ats() have already verified the hardware capability > * and programmed the STE, pci_enable_ats() should not fail here. > */ > > > @@ -4264,9 +4270,16 @@ static struct iommu_device *arm_smmu_probe_device(struct device *dev) > > master->stall_enabled = true; > > > > if (dev_is_pci(dev)) { > > - unsigned int stu = __ffs(smmu->pgsize_bitmap); > > + struct pci_dev *pdev = to_pci_dev(dev); > > > > - pci_prepare_ats(to_pci_dev(dev), stu); > > + if (pci_ats_supported(pdev)) { > > + unsigned int stu = __ffs(smmu->pgsize_bitmap); > > + int ret; > > + > > + ret = pci_prepare_ats(pdev, stu); > > + if (ret) > > + return ERR_PTR(ret); > > + } > > Again, pci_prepare_ats() covers pci_ats_supported(). So, the check > is redundant. Instead, it should check arm_smmu_ats_supported(). > Ack, I'll add a check with arm_smmu_ats_supported > By the way, this would conflict into my series: > https://lore.kernel.org/linux-iommu/18bb6f421b3be891caa8f1fb50f3a4d56b52d5be.1779392420.git.nicolinc@nvidia.com/ > > It would be nicer to have an arm_smmu_master_prepare_ats() so that > both series would have a common ground; mine would be just adding > some additional lines if your series goes in first. Ahh yes, I was thinking about the conflict to (I'm yet to review the series though). That makes sense, we could add arm_smmu_master_prepare_ats() for clarity Thanks, Praan [1] https://lore.kernel.org/all/20260519145947.GK7702@ziepe.ca/