From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f44.google.com (mail-wr1-f44.google.com [209.85.221.44]) (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 82BFD384CFB for ; Wed, 15 Jul 2026 14:34:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.44 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784126058; cv=none; b=BLZo2WRn7UdBACNlty0ESkT9f7aToy2I1djoF9C/RzHzO53vRDFpASdfUS2MzsAjcizJRWHCtnRyV93F3nPnQ+Z43rSkn6a831tzf63Pi6ksWmPZeTRGzEhxdXPAIuY89k7F3DRBePF2Zn0/dfUfiD184DH0RCdTdYijGDE3lNw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784126058; c=relaxed/simple; bh=k8eKHIpCaaPLKTjtgUqCHzqXzJ9WDZ7k24XDEaWgMaw=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=p3SuSpDA/XK9+0ssC4QepptTpKlUwTuOCeReczyDJJM8lulMCnfsRXX59cDB5bxsrTPKEYa4gcWJKAGfFLq2kzFVKddxgW2lD4AyM75qJQoymHsVTeb5mvnZ7D9XHadXixdJjiiAyN3VZY/KTpXiR+wXoAL08r6iYb13EQQEGhw= 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=nEm8At6Q; arc=none smtp.client-ip=209.85.221.44 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="nEm8At6Q" Received: by mail-wr1-f44.google.com with SMTP id ffacd0b85a97d-4720d22c94aso2375320f8f.1 for ; Wed, 15 Jul 2026 07:34:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1784126055; x=1784730855; 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=knIg8/634584Ytue9vf6OuJG9Of4+644gUu2jDQuGXU=; b=nEm8At6Q3Vi8ASgswxQL9l8jQl2utsc7nKXqrVkUys10sXIvhyc6bVhYZSnAPqOtte yHGA42IhXfKeuADg94SCjuEZVWGkf+UNakEWIIVD3whg6JGeai2PpNss7lMqTBnIE82q pbClFDiEUjjBW12OxpFENWH7VCH5gaH80sMjSplFB4lnZclldgN/pA7o2sVvv6vv47Xp FG7Ky6sktjHBh3daPlPCfaxloo43Xb5ZB6Drvh63wbODxAROETbEgiXEUYFslqdYf6zP kNVZUmo+Iu6YKZib/tfGNtOLUdFb+rEkLUvSRSro6mjXPC6tU1jBogyJGrf64u0zbPi3 KHTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784126055; x=1784730855; 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=knIg8/634584Ytue9vf6OuJG9Of4+644gUu2jDQuGXU=; b=DnfrTGG4L9WCAcgc6u+3341XrLnMSMB6HpISKFHYeZuuRN+EThWDAwP4ZcpmvZHEnE ihHfCx6lw54HmfZJ0rB82oZutLy45H78z3kYuD9Cin9jLJjC5os1D3iCi07ZA8A9ybl6 j+51gzFCpQtp9w3xE+uvNpqimMub+bxXibwxt+Izdbrpxt8uRK4+7sJlXa33cYC9O4Ja PkFueys2rXr95jjvOnxex7IOV2ZdCPK6BUAy7q2kH6udsK4+VPiJtyU2hJT8XBMkelEw WPMqLrGFwIK4ZF3wcZvgLHaSOzOqcU7rnUBetpLxoXLCO7PYSUV/3wW01YAT9PtWh8Hi rJ1w== X-Forwarded-Encrypted: i=1; AHgh+Rq2EW0ELsfD7fbk2a7UtrEoQkMQRUoac3731ErVCnv3Kp38so0o3xQoN8qd05c59ZP1tlliAyQP1Q2n6/E=@vger.kernel.org X-Gm-Message-State: AOJu0YzVLxy3FGYMAgwOvpgaL+2/2vRQKT5t1RH8PWRk7KYQFJ4yLhUP OIGEa6XlK9HWhm1jrlHQYcDCzIRLuWbIVbMNPa9G4ov92LTchU+ERGblsAe5LesvhdA/gX47clq ZyDcwSA== X-Gm-Gg: AfdE7ckbm67MUKltvWRzHMMnu6OWowjDpfP/XSJaUQdtbXUO38GvnVZSGA5VDq2F5vI OK9LOj13sa8y079nquxAXXMXQ/J/CTN8Js0VmesLROMS+/XiE85e1tk++1ObCwo36883w9k4qhi OU599t2+XvotxS0WIYnTJDZxrrNtyCduRoH5QFN5ICpbv4eyyZmNdiY4+bxh+8SgeFqLuW8PPxR q6msCBMqbxpDTcWG8bn7mjrdxG3a9yOQ3cqE2m9l6XuWSCPYQyEXlxWtCas+1jir5hxHLB0gTBL EoSb9gunEUyBZ0z1/DXe2yuFweGtJGd1wZgXFMroyGmmgKe11xU8ktkPX46bxnGo0Eob7dbDJfe /MN6Ozsw9yOvwqXn7d3US7pkrPmUwWHPmr9MMynScxt4Q8K1kpY6IjdsjfN0ej4FkAWWdBoahAq XTbbgnKL6/NIostS30TIV1VYzO7YBVbVpoZjlicMoEcfXHCUnnLtXjSpRxPFK56w== X-Received: by 2002:a05:6000:220e:b0:474:e0f2:905c with SMTP id ffacd0b85a97d-47f2dccb729mr19822692f8f.26.1784126054166; Wed, 15 Jul 2026 07:34:14 -0700 (PDT) Received: from google.com (137.69.77.34.bc.googleusercontent.com. [34.77.69.137]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-47f464a96cfsm17087436f8f.20.2026.07.15.07.34.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jul 2026 07:34:13 -0700 (PDT) Date: Wed, 15 Jul 2026 15:34:09 +0100 From: Vincent Donnefort To: Mostafa Saleh 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, jgg@ziepe.ca, mark.rutland@arm.com, qperret@google.com, tabba@google.com, sebastianene@google.com, keirf@google.com Subject: Re: [PATCH v7 01/24] KVM: arm64: Add a generic clock Message-ID: References: <20260715115906.2664882-1-smostafa@google.com> <20260715115906.2664882-2-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: [...] > > #define smmu_wait() { > > static u32 window = arch_timer_get_cntfrq() / ARM_SMMU_EL2_POLL_TIMEOUT_US > > u64 timeout = __arch_counter_get_cntvct() + window; > > u64 cur; > > > > ... > > > > while (!(__cond)) { > > ... > > > > cur = __arch_counter_get_cntvct(); > > if (cur >= timeout) > > __ret = -ETIMEOUT; > > > > > > No risk of overflowing u64 > > No init necessary > > It believe init will be needed as caching arch_timer_get_cntfrq() > is much better that re-reading everytime. But I can make all of this > contained in the SMMUv3 driver and remove this patch. That's why I have made window static :) (well of course it is per callsite...) > > Thanks, > Mostafa >