From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) (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 95F0A388E4D for ; Mon, 13 Jul 2026 11:07:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.52 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783940878; cv=none; b=kHmExlQIoCZLI5mgivZ1ik8FAnYEY4h/GPCCQBO3pi+6c2OmWbqaOHee1aU+1Snw5J1sWlpzuFlAPp6Pgrs6QrgE9UTAsekDXByJEOdSL/MoeZdOD1KCaFZRSzx+3kmcvBVZYSTZGvXppALNk5SRVp0DoO6eWSi7D4nhh57Mr1k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783940878; c=relaxed/simple; bh=Eds3EgvFkpLMHtynlmWxSgjSfgcwXmnfbdoaPHhBueo=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=WZsBSvm3/2OBokjFx0MBkD2Ryb2Yk7H1QFod9xSW1UVFboCQO5tZwB8pSObC9xKYSbypto8Tw77IK1nvBwZdi6yQTRXbag/C5m885r9sZRfZH8X68EfwCpstIpCKODYRc/VfLxC5ZJiRDuovV3SvRhwN9CtljOM+OtFDDFA9hIg= 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=gxgLx1yg; arc=none smtp.client-ip=209.85.128.52 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="gxgLx1yg" Received: by mail-wm1-f52.google.com with SMTP id 5b1f17b1804b1-493c556ada3so91665e9.0 for ; Mon, 13 Jul 2026 04:07:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1783940874; x=1784545674; darn=vger.kernel.org; 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=YZ0k43QjY4fFBTZv9XwnB5eVI6fl2iA5pqXp0CRkiRA=; b=gxgLx1ygsAiaAcJDQuvs3pbH6h9LkD8Z+57qEuPwVyFuB+UmHTsYeulZxO1FGHl2Dc ckTBPqbMAnZMKaOd7B77mNziIZlOj/OFfhP75EM4v5LYjqLD/i6KCNpE9VTgtgSQQdV6 3hzYurSTmeFclnX6EVkGqGrjOms27PsRlzkrXIhx0+6PiwC65VMBMijirxy8libCUYvs kdteh1gyC6x7bhvaXNtB8jzV9SJ2awoy3TKQNzgELI7lSnKvQD9LyChxuI7fxPwwCK8U qFRG3vBTC0+Sy1bUHngjgnpF6GS/Fb90//y8a8wDHueiA013XM3KBwcW2CAhuR0j3QVT rzKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783940874; x=1784545674; 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=YZ0k43QjY4fFBTZv9XwnB5eVI6fl2iA5pqXp0CRkiRA=; b=VnBMFefNyxq5dyPXDmnqiN3oxj8vDeFGwzzKveAPUg/tftp8ZGdrvHTMeY0DbAhzR+ 4xAuGA3JIRoglMKHupZEGbtau8XEwpvJCgXxNIO5PMwFZZiAoshbV0gij6Rs2OTIE4KB QDlsZMj1dwosS0w2eFZCtSBRR5ybg+ouPgvYtV8c6RSVUnnkIms17RqUGbnX5T98wLYQ vHu7tWvh95qtH9xrDFUk9WcWPFf6NCQO2aWno7bWKlZ+3o5eumSY6ok88AdXFtJPoJp7 EIeJn6uTvc1OLtGUqW0yYNBcHO0U8S82Ykjw4hLSIft/U4pBmN8me/0hYxZPZFZf4wUj XSRw== X-Forwarded-Encrypted: i=1; AHgh+RoMW1Doyuz+ABO8HEBRQq25FprHEo7YIlzOPc/QpKewNdHUOCjqGjFkPurAaNkYP6x8FJLpSLnB0tp3kk4=@vger.kernel.org X-Gm-Message-State: AOJu0YxSQPL8txO9U3+V87W7NamzphEEWelqXLYx/QchZ2FHx9Z0KPdH wKE794UQ21MUtBohG3rMWPnZRxiYV64UpkZmrG66OciY1S/PNsXGZ8IkEz66KQIw6g== X-Gm-Gg: AfdE7cnkFvi00LOAYee+lEGqGu8eaVvaSLaJIMZlnrvYW2ZvYabUt5Opg6NOXHCKRY7 PzcGk33AaDkrOm2ZOFKjMNZzEOL9OCUiAvpyeRI8+0UhVLiIVLxAk4JYNw2NzjbHXqGgKLyRH4/ m8d2ITBSoTJ4yxxFmEUSrX09rMgZb9fTYNGx7RXLdtEcrARHCHSVa/6KAciSyS3kWnVvCTtEKJM exH3vkXwc4bebiA2deIr4NpDVeZhx/PFGoj9xaSQ2+YLwYjhbUiwH8gHX23pAI7xZSv+f7ty8ny 5Jib3aeAsMoJX+Qt1yzXJ8Dab0Es2tT5UdCxG20NHA4idBkF3gDQRZvblr+ShcaBH/K3HdmSy6b LoOFhIzIg9XdRJ2+j0mtQopMDdQqKKaCGhBIjp3oyk91McSXB6s/qTe5EGgb4WPNNshrOwzx9ZO 0e/Atv6FgUdhKk8kTmcggesmOqZoNoCwxS3h7cwPmJkhsf7QSh X-Received: by 2002:a05:600c:a088:b0:45f:2940:d194 with SMTP id 5b1f17b1804b1-4945e32136bmr235535e9.2.1783940873591; Mon, 13 Jul 2026 04:07:53 -0700 (PDT) Received: from google.com (220.60.76.34.bc.googleusercontent.com. [34.76.60.220]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-47aa0f214d2sm82275582f8f.33.2026.07.13.04.07.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jul 2026 04:07:52 -0700 (PDT) Date: Mon, 13 Jul 2026 11:07:48 +0000 From: Mostafa Saleh To: Vincent Donnefort Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kvmarm@lists.linux.dev, iommu@lists.linux.dev, catalin.marinas@arm.com, will@kernel.org, maz@kernel.org, oliver.upton@linux.dev, joey.gouly@arm.com, suzuki.poulose@arm.com, yuzenghui@huawei.com, joro@8bytes.org, jean-philippe@linaro.org, jgg@ziepe.ca, mark.rutland@arm.com, qperret@google.com, tabba@google.com, sebastianene@google.com, keirf@google.com Subject: Re: [PATCH v6 16/25] iommu/arm-smmu-v3-kvm: Add CMDQ functions Message-ID: References: <20260501111928.259252-1-smostafa@google.com> <20260501111928.259252-17-smostafa@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 Fri, Jul 10, 2026 at 05:01:07PM +0100, Vincent Donnefort wrote: > On Fri, May 01, 2026 at 11:19:18AM +0000, Mostafa Saleh wrote: > > Add functions to access the command queue, there are 2 main usage: > > - Hypervisor's own commands, as TLB invalidation, would use functions > > as smmu_send_cmd(), which creates and sends a command. > > - Add host commands to the shadow command queue, after being filtered, > > these will be added with smmu_add_cmd_raw. > > > > Signed-off-by: Mostafa Saleh > > --- > > drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h | 14 ++- > > .../iommu/arm/arm-smmu-v3/pkvm/arm-smmu-v3.c | 107 ++++++++++++++++++ > > 2 files changed, 115 insertions(+), 6 deletions(-) > > [...] > > I only looked at that smmu_wait() as this is the hyp_clock_ns() caller. > > > > > +/* > > + * Wait until @cond is true. > > + * Return 0 on success, or -ETIMEDOUT > > nit: Would be nice to explain use_wfe. I will add it. > > > + */ > > +#define smmu_wait(use_wfe, _cond) \ > > nit:, (__use_wfe, __cond), or (use_fw, cond) Will do. > > > +({ \ > > + int __ret = 0; \ > > + u64 delay = hyp_clock_ns() + ARM_SMMU_POLL_TIMEOUT_US * 1000; \ > > Does it help to lower the risk for the 128-bits fallback if we keep the > resolution to _us? I will remove the tracing clock support as mentioned and I will handle the overflow in smmu_wait() > > Also, ARM_SMMU_POLL_TIMEOUT_US seems to be 1s. Blocking that long at EL2 is > really terrible. Any chance to lower that? > That should never really happen, I am re-using the kernel max, but I can change this for the hypervisor. > > + \ > > + while (!(_cond)) { \ > > + if (use_wfe) { \ > > + wfe(); \ > > + if ((_cond)) \ > > nit: I believe there's no need for the double () here is there? > Will do. Thanks, Mostafa