From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) (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 550A040B6D4 for ; Wed, 30 Sep 2026 19:57:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.169 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790798242; cv=none; b=Jb2JmMWhOi5Jssgc9c5+AEVMxXQODoYCt11Aalf6PdAwReUgvpNwl70HWR3TEWSzhFtPC72aszbcimRjP4FeEirC7Vx+wgtDuF/tn3TmAU/PKf8uPISLYh66uXs+FlwmLnzVArEf3S3raJhEGUGpWKYDUOfBUpcGWFVthA21xic= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790798242; c=relaxed/simple; bh=9TZtF4f7bLDr7C03aF5gVG6cbsSVdEXlq+L5u/iiSUY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=flhB3n4LY+gfQ6PGMn8qclK7HW+M1YDMuAJ79XQPmgeggOMrktEmVgKV7OFtzSznJgySJ/OG3jG6iukTf3LHzoZH7sbQmuWvUL0VLvRceBekQEv5h/m3RJg4EQSMpm6aW7rENNHJPiyMc+v0k7dDaESvSfZR+VmhvCRzau+1Plo= 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=dErUmZ7W; arc=none smtp.client-ip=209.85.214.169 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="dErUmZ7W" Received: by mail-pl1-f169.google.com with SMTP id d9443c01a7336-2d3b445a84fso15685ad.1 for ; Wed, 30 Sep 2026 12:57:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1790798241; x=1791403041; darn=lists.linux.dev; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=JZWZuvgsWyt2x87h19X7B7J9Ed8aIg0FhoKfAr4PEqA=; b=dErUmZ7WHsMnACf3oAxFLi9K7hcCEUzhhn4w3NY3N500yziR6Y38ewlpuqdZJKhDV4 un7TSO0yB98L3yiZv8LQelejN+5XoKYYPA9ppQ1/TUHLnr83dQCwPt+XQIM8gBweH1hN iMNxoyCbCR0FnawKZfpdiOeLBuYhGdciql3dJ9GCKd7pm+m/0NwgKFnHym9xyXh2CYf6 PShS3MRYaVLQ/JVReKjo1vR9pwTPFMMMCxiFngYo/vHAmLr8IFzh2/DrA9Db1y7Dp+0O Q7BhwuwWD/k7MojWFyk2F10go8kK3v12coGGrzWFoCjaqn0IeQL4zOOLkdW2Z6IFiKWv QerA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790798241; x=1791403041; h=in-reply-to:content-disposition:content-type: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 :content-type; bh=JZWZuvgsWyt2x87h19X7B7J9Ed8aIg0FhoKfAr4PEqA=; b=KwMuPQRiqWcUY21L2vH+amCTPwLIVpehGTOeGGn46p3oQdNsXtH3AURJJ8xKHzhVaJ gFeebmJ3Z211f1PRCQum2FLKDDkQImauxD/Fde19145KCNZ6E5W+jh3KEehuTrlV7dLk frVIFKp1zRgL+LCY+8eni4D1SXPUWtHDShcZE/6qvcU9mcPkFPf/YbvRxP1SLPPxavvt PgehyN06/fkZFZ6swiX3ho++ydyKq5QUE+p8e7sKdD4dVr2Zb1SzEdvNj9xmUY0joydO idR8RwCKUBWZ2/hpS4AwB/uCc7lzESm/GgCF+WkL3snGl0pb/Yt4daVeShhPqIK2VTQf Asyg== X-Forwarded-Encrypted: i=1; AKwUvBy5SIKTcpvhUt9/ldTJP+BAzrBlS10taspzrQymPIGSF3+snH//e5iehzDlYFrILV2cQ8MPCJgWqeHAJg==@lists.linux.dev X-Gm-Message-State: AFq9FYKXWF/UXlnNjVl4XRsHJKtno/icR4iGXBbHzqEbeKFk4Sx/WlhZ nYn+IOhktS0pwu286vFDkZIvMEWNqq0sHF3jXMNkLI5ilTSoK4eAynXpxy/7C+HgIQ== X-Gm-Gg: AYBFou0NSZALtiZJJnv5Vk9MwLUxV4M47HPAOkaSJ9UO5+h9eQNsox3LZ2UDFwPbRRp olSPdTsjwMmdeRccSvZTi5tJyM09I8v7u9LrjPULZ6/QH2p5TfDtZsJMXfmjLypopTBbhilXlQG jqLcQPx1zPcZ3+R8Y6eJHobsnuNHo78tkFiseoZcq1xoreH9UepFHUkFCymzL88ipoPjYi5a6YN RDmzOoyT3hrWsbX7N4XwraC7BNEtLpSTb6Dj2c42aOSqTpmGNcyDdcw3yXvL2hy7nYfUeZb1rRx mXIhxBZ+osm5EkU5GQFogZEjm5IghUHPUO9z1/ue9rRCerJgnWsy4LWAgILNg/KHTQ3O5mwd8on ES/Y+s7yy4v5ujyoJ6nEIYqFP8HywKhxY497ZO8YKoz89eMPCZMQ4pQiB36caQU9onMpm7U6LW9 2fIWkAjcfDww1WcEapm4h/BnsqVKHnwR1CgnVKI2IBicXKgVVVSzcpjRdSZQmdpXyPq3BpTrqiU wL3E7ID17nz/LpIAv/bs5G8VsImC2bKactp X-Received: by 2002:a17:902:c946:b0:2bd:3bfd:74f1 with SMTP id d9443c01a7336-2e3015b273amr1215915ad.2.1790798240054; Wed, 30 Sep 2026 12:57:20 -0700 (PDT) Received: from google.com (105.211.142.34.bc.googleusercontent.com. [34.142.211.105]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-3a4f475f4aasm742177a91.12.2026.09.30.12.57.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Sep 2026 12:57:19 -0700 (PDT) Date: Wed, 30 Sep 2026 19:57:12 +0000 From: Pranjal Shrivastava To: Nicolin Chen Cc: iommu@lists.linux.dev, Will Deacon , Joerg Roedel , Robin Murphy , Jason Gunthorpe , Mostafa Saleh , Daniel Mentz , Ashish Mhetre , linux-arm-kernel@lists.infradead.org, Thomas Gleixner , Radu Rendec , Bjorn Helgaas , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Greg Kroah-Hartman , rafael@kernel.org, Danilo Krummrich , driver-core@lists.linux.dev Subject: Re: [PATCH v11 12/16] iommu/tegra241-cmdqv: Add a helper to quiesce VCMDQs Message-ID: References: <20260929034510.2023173-1-praan@google.com> <20260929034510.2023173-13-praan@google.com> Precedence: bulk X-Mailing-List: driver-core@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Wed, Sep 30, 2026 at 12:02:28PM -0700, Nicolin Chen wrote: > On Tue, Sep 29, 2026 at 03:45:06AM +0000, Pranjal Shrivastava wrote: > > The tegra241-cmdqv driver supports vCMDQs which need to be quiesced using > > the STOP_FLAG. The current driver implementation only uses VINTF0 for > > vCMDQs owned by the kernel which need to be stopped. Add a helper that > > sets the CMDQ_PROD_STOP_FLAG on these vCMDQs. > > > > Consolidate this logic by renaming the implementation hook to > > quiesce_and_drain_queues and ensuring that the tegra241-cmdqv driver > > gates all active local virtual queues before starting the drain loop. > > Additionally, clear the STOP_FLAG in tegra241_vcmdq_hw_init() as a part > > of tegra241_cmdqv_hw_reset(). > > This whole suspend routine is missing the CMDQV flags. > > vintf->enabled and vcmdq->enabled must be cleared when the system > does suspend, via tegra241_vintf_hw_deinit(vintf0). > > So, instead of quiesce_and_drain_queues, perhaps we need a suspend > callback that: > - set stop flags to all lvcmdqs > - wait for all lvcmdqs being drained > - hw_deinit vintf0 and its lvcmdqs > Interesting. I had thought about that but Ashish was able to test a previous series (which def didn't de-init vintf0 & lvcmdqs in it) so I dropped that thought.. Looking at it again though, leaving the enabled flags stale is actually worse than I thought.. on resume, the CFGI_ALL / TLBI_*_ALL issued by arm_smmu_device_reset() go through get_secondary_cmdq(), which still sees vintf0 & its lvcmdqs as enabled and hands back an lvcmdq with the STOP_FLAG still set.. so those invalidations get silently elided until impl->device_reset re-inits vintf0 (after SMMUEN=1). Thanks for catching this! I'm planning to add an impl->suspend op now.. that will cover this, and also the late breaking IRQ changes you're referring to in the other thread. Roughly: - set STOP_FLAG on all lvcmdqs - wait for owners & drain all lvcmdqs - handle any pending CMDQV errors - tegra241_vintf_hw_deinit(vintf0) I'll call it from arm_smmu_runtime_suspend() before gating the main CMDQ, so the CMD_SYNC in tegra241_vcmdq_hw_flush_timeout() still goes through and any late cmd simply falls back to smmu->cmdq. (Will drop the extra line removal as well). Thanks, Praan