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 6863D33F8B9 for ; Mon, 30 Mar 2026 15:30:25 +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=1774884626; cv=none; b=qgxGDYZfQsnchAR9wwvugQnMjg8uHQO9VIi4cVcoYKh7NsDh0C1GQJS+8Drk86iJFGQ6WOo7k6bvPb2OSU3CpGhtbaxbbzPWg7aBkvTis0+J3CDuhSMcJmEPeJAAA93Oe8jFnXm+Cpfc4JUSRz7GmyjT7AnrwRFxOxgoVFcHTqM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774884626; c=relaxed/simple; bh=8G2MYLkHarREZZIj1FKM36skYth+lTD9vvfeDou5IhQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=XFeo3uYm17ZYEz8UXRON3ljZvM9d+WqCWHPXL1Vr4G6rDdJebQVIWfLZWfASb7l5e6Aebz9Ca2d1THgd4ihw0VzVa9bFq0Ka0L+yeEse3lH68+PQJEDcsofmicLSJfjciMxnoUJ6W6TENuFdROVokX+USBd5fsHg8WsP/DdVK1M= 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=hAv9bH32; 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="hAv9bH32" Received: by mail-pl1-f169.google.com with SMTP id d9443c01a7336-2b0c12be0ecso184365ad.0 for ; Mon, 30 Mar 2026 08:30:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1774884625; x=1775489425; 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=BtXcK49aTtWbzyQjb6oAhiRd5s0yTyImqad3No01Ee0=; b=hAv9bH32w+LeN4K6VZi2LjVwsaWbTrDtwm8uNhVhQA28QaeNIjQ7JhNqWzayReI0v/ DSC/5Gz8l0ZEnstrHk06YsMd7lgK5OTS1lutP6wh76qk6cbPBqYvOSroLjHTnxdrGORP 7r4CuRb0qiUS4UeOmwRDtwMcBUdsdjnp842JqeAj1CskL9tvkRut0LXvI2VSag3ixxZY ZOshJo9eRKfYRqS1fWZt3vkVvfczvcEfZ9bQCt4b/3OGvGkOK8mMFsVpOC1VSVwNhjcT bz2bRWDFosDNf7eROi2hPQzbxPjM1R8jctAkJyhnrmICpeii8pZcMOk2gi0plcZZP4Fh VxXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774884625; x=1775489425; 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=BtXcK49aTtWbzyQjb6oAhiRd5s0yTyImqad3No01Ee0=; b=lPuOP7BtjGSNocCsR1DfXILvwI5shiu4sBKyW785ebhg7JTvT6IucLH+x3zHqryDd3 YsNGr7gaqdQme2eW6NyGaFRTT2NNTtCyWdvpSDArAv9xlyb2YHvM74yzcCaN1ahCYjhF AOsvyRLX4L0vY4/MyuZIo2Y4x1fMUSwJaIm5qaX7J0nkqLtqJoW9ZqETFsfIwCS9U4fd WQAsj7apoJB284Cimb0uDRR6SakGNC7njqfws4n3DE1WW5/VbEDIsUMNraZYfk1nK/xJ LCUCahiimMwkRjy6edr8iRyKakN981V1USeJ2mvfmW1t66NaDdCwsEul6eQDsUshzKxX f2ug== X-Forwarded-Encrypted: i=1; AJvYcCXVs7owpcIcH9ZMaIDxKdQT+SCby8K0p77MlpxkzlYHU9S7QPDBgIVR8Y/UhG76+hSjjTeLnX2WUa6aMpU=@vger.kernel.org X-Gm-Message-State: AOJu0YwCHaLZPqTWKUusjqYOI5fZgaCeZNIHnk5lHkA5kcRD2FS9vbsB Cw9tjK9Zg8YH3uKJuxMLzDKC4YXD2iXHyZNp78nAbWEXeIQn5R1Qwmi8q2pNvthd4PBwucSu33/ gXKkFAw== X-Gm-Gg: ATEYQzyGvblIGDBLFWFggfXDvbKf170pP2Bs9QtrSZ0TenQPNPhDzgWWinh3AB2OXzh 584xZdlZpuEKWvBcbTcXCMpbSMUey+nLE/U57qdmvPFAlZ9/NhQX+gpL+XOI2JyxO09boL24yZj APM4n9NQHmd6MQZG+vip3ZI4UrrQCP2e9n1owH165xOuD68BztdX6lGOro7Kx1ek0FRk60gU8n2 e9+HZEw5rYIdNkY6kwqvKyk8XQmj8L5jUraeyNGYgPWaJeH5gPrl6gmxmgO0RT8Ge3AyDu9TCGd 6Wb+HN47lJuwo5BrB3RA9w5vE/HoOW7r8JbxthFLqHlgeW4Q7uSXN4HeZ1vDAq9yToshZ5uhida tm3W0UFA0Sjm41Mw4eSQBz3ZO5OdacE1dQ0OnlUTe8IRqsbIOI3fb1lzh/3nJQS1xqpi8/ymewj FFfFdjwF3DPEOSmxEvBzaclrx2qfxHbPe4hFiNHjNxIWKMn821jsEp6MBLq1Xnog== X-Received: by 2002:a17:903:2ac6:b0:2b0:b0c9:96e2 with SMTP id d9443c01a7336-2b242d1de8amr4988175ad.21.1774884623856; Mon, 30 Mar 2026 08:30:23 -0700 (PDT) Received: from google.com (168.136.83.34.bc.googleusercontent.com. [34.83.136.168]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2b24265aa9fsm81931225ad.20.2026.03.30.08.30.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Mar 2026 08:30:23 -0700 (PDT) Date: Mon, 30 Mar 2026 15:30:17 +0000 From: Samiullah Khawaja To: Jason Gunthorpe Cc: Lu Baolu , Joerg Roedel , Will Deacon , Robin Murphy , Kevin Tian , Dmytro Maluka , iommu@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/8] iommu: Lift and generalize the STE/CD update code from SMMUv3 Message-ID: References: <20260309060648.276762-1-baolu.lu@linux.intel.com> <20260309060648.276762-2-baolu.lu@linux.intel.com> <20260330130024.GM310919@nvidia.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; format=flowed Content-Disposition: inline In-Reply-To: <20260330130024.GM310919@nvidia.com> On Mon, Mar 30, 2026 at 10:00:24AM -0300, Jason Gunthorpe wrote: >On Mon, Mar 09, 2026 at 11:33:23PM +0000, Samiullah Khawaja wrote: >> > + for (i = 0; i != writer->num_quantas; i++) { >> > + /* >> > + * Check that masks are up to date, the make functions are not >> >> nit: "the make functions" looks like a typo. > >the smmu drivers called all the functions that build STE and CD >structs 'arm_smmu_make_xxx' So they are the 'make functions' Interesting... Thanks for the context. > >> > + } else if (used_qword_diff) { >> > + /* >> > + * At least two quantas need their inuse bits to be changed. >> > + * This requires a breaking update, zero the V bit, write all >> > + * qwords but 0, then set qword 0 >> > + */ >> > + unused_update[writer->vbit_quanta] = 0; >> > + NS(entry_set)(writer, entry, unused_update, writer->vbit_quanta, 1); >> > + >> > + if (writer->vbit_quanta != 0) >> > + NS(entry_set)(writer, entry, target, 0, >> > + writer->vbit_quanta - 1); >> >> Looking at the definition of the entry_set below, the last argument is >> length. So if vbit_quanta 1 then it would write zero len. Shouldn't it >> be writing quantas before the vbit_quanta? >> > + if (writer->vbit_quanta != writer->num_quantas) >> > + NS(entry_set)(writer, entry, target, >> > + writer->vbit_quanta, >> > + writer->num_quantas - 1); >> >> Sami here, the last argument should not have "- 1". > >Yeah, I probably botched this when I quickly drafted it > >Jason Thanks, Sami