From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 87619C52D7C for ; Tue, 13 Aug 2024 13:41:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To: Content-Transfer-Encoding:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=VwMV+d/24nmdzqweqrHjOWK1WqG9SPFvkXHNO/cskp8=; b=km6LD6cQngShtMnfJ65vvUGKLs QeUI8ld3rXePREvbn5MY/Hv0wugIhwb9bNzud9fSmGuesWZs2V4AgFrnGI/1hnJRqyMSgxb7x0GzI 8ndcjYrQtMjRaIH8AmOJk+ZabwZZKtWOMBxwtriPxumGKrRu2cfyARq9WnLFhSE+8XoE16Y/M8r+g dyvAypuoh8jiY+nnG9RHNQjq8gBUIMjVgiw/Yn2B+klZVG2zO02wMf3eK7NO74JsXbA/VOJBgcsJ7 YS2pFSTBgmZ50eLrordvNzc9ZuHfnJ7+fwDGHD9zdl5PZMY533w0H3l0FLxivPQUckR3wa9nUJfhH JP09jROQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sdrlb-00000003uoE-42VQ; Tue, 13 Aug 2024 13:40:51 +0000 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sdrkz-00000003ugD-1q0x for linux-arm-kernel@lists.infradead.org; Tue, 13 Aug 2024 13:40:14 +0000 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-427fc9834deso32565e9.0 for ; Tue, 13 Aug 2024 06:40:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1723556408; x=1724161208; darn=lists.infradead.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=VwMV+d/24nmdzqweqrHjOWK1WqG9SPFvkXHNO/cskp8=; b=y8GQQd6yWEdHQBDZ8KkdWuabizygot0F0E2yo9E+k2+8cDLvCNPzk8vS4B8LAn7dUn y4GxpkgPJFKaUJd0+ZN6LFmzveOuLH5imBVp9DXgT910p9jC6zBWgMDx2w1bJfBv+dBh kzD8HLAlU9acyKVqq6daCi+sR3sPgtrqg6Rk0AWcuPVQTLpN7G54xZ9iSEkY2C+nULHY tamohdhtxQPQyFqHK6SbQzlzQ45QmQ+q7Pd7ydgXmMmbsuuozhvpxGG0Wo61UUfzzBhM ZmBgBb7pd+P7A7q5Cp/iXFbyRTAiODbwbg3rtJhVwW08ZxCPuofq8PzgCZ2We7VzPfnl 1peg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723556408; x=1724161208; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=VwMV+d/24nmdzqweqrHjOWK1WqG9SPFvkXHNO/cskp8=; b=WvtPbrmVqFJv1aULKkyQxRa8EeV2EULoBLnjzaArNkmKIHbVv5f6veIpuAROm1/6RY nmrNADgn3tNyorPjZjW9c7Shc7fkFbKhxUMJueQ5L07fBTtAfPz1bAF00eaIeb4dtgWh +E5JLjowRNDUzx0vVUDYzTn0kQx/YniFt68eya8uaomLRZgDgEf0UIiwpnjYgEiqii7x OBI0Sv7sUYlNEOM5ytxmTtg9IeG8cSf0vKkmvyzWRVlmXAIHOzCl15ODcW+YGM6gQDxJ 00IvjnDt7RHVlsffzLByuZuEey6fULUdf6sSNhEOd57zuu9X19qg/2SKZnqM9WFSu9Wc 77qQ== X-Forwarded-Encrypted: i=1; AJvYcCUQqfOSz47YVmAcSIWygEhWiAKjvwSjE8jqHQT3PLeGMICImnaemui3JsBjvvWWcDUMdpO+aYlv4XGs81Bglo62lr3nAyLfoJ3X/LX2UOVq59e3JQk= X-Gm-Message-State: AOJu0YxEkMSxT0QdvQg/dCt58dt10a1uBZmYw8uxynD9ivUKJlew6TOL huLPzekmulSWE9ISlpf6DBj9seYnkNtCFol9kf0yGpPfmMOTrFkXWmEDKKLePg== X-Google-Smtp-Source: AGHT+IGzihwEYjxxVx7+f1NJuiQnxOAZ92M9WPFwek7xX6OzFxHriBfJrZekTSS6jeVCS17HOiYQmA== X-Received: by 2002:a05:600c:1d95:b0:426:8ee5:3e9c with SMTP id 5b1f17b1804b1-429d715b507mr568645e9.6.1723556407703; Tue, 13 Aug 2024 06:40:07 -0700 (PDT) Received: from google.com (203.75.199.104.bc.googleusercontent.com. [104.199.75.203]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-36e4ebd2bb4sm10455272f8f.91.2024.08.13.06.40.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Aug 2024 06:40:07 -0700 (PDT) Date: Tue, 13 Aug 2024 13:40:03 +0000 From: Mostafa Saleh To: Robin Murphy Cc: linux-kernel@vger.kernel.org, iommu@lists.linux.dev, linux-arm-kernel@lists.infradead.org, will@kernel.org, joro@8bytes.org, jgg@ziepe.ca, nicolinc@nvidia.com, mshavit@google.com Subject: Re: [PATCH 1/2] iommu/arm-smmu-v3: Match Stall behaviour for S2 Message-ID: References: <20240812205255.97781-1-smostafa@google.com> <20240812205255.97781-2-smostafa@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240813_064013_533582_E6668E6D X-CRM114-Status: GOOD ( 27.30 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Robin, On Tue, Aug 13, 2024 at 12:46:26PM +0100, Robin Murphy wrote: > On 12/08/2024 9:52 pm, Mostafa Saleh wrote: > > S2S must be set when stall model is forced "ARM_SMMU_FEAT_STALL_FORCE". > > But at the moment the driver ignores that, instead of doing the minimum > > and only set S2S for “ARM_SMMU_FEAT_STALL_FORCE” we can just match what > > This was highly confusing, until the 3rd reading when I realised that maybe > "instead of..." does not in fact belong to the description of the current > behaviour, and it does start making sense if you swap the previous comma and > full stop with each other. Will do, I will also reword it to make it more clear. > > > S1 does which also set it for “ARM_SMMU_FEAT_STALL” and the master > > has requested stalls. > > This makes the driver more consistent when running on different SMMU > > instances with different supported stages. > > > > Signed-off-by: Mostafa Saleh > > --- > > drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 5 +++++ > > drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h | 1 + > > 2 files changed, 6 insertions(+) > > > > diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c > > index a31460f9f3d4..8d573d9ca93c 100644 > > --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c > > +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c > > @@ -1562,6 +1562,11 @@ void arm_smmu_make_cdtable_ste(struct arm_smmu_ste *target, > > (cd_table->cdtab_dma & STRTAB_STE_0_S1CTXPTR_MASK) | > > FIELD_PREP(STRTAB_STE_0_S1CDMAX, cd_table->s1cdmax)); > > + /* S2S is ignored if stage-2 exists but not enabled. */ > > + if (master->stall_enabled && > > + smmu->features & ARM_SMMU_FEAT_TRANS_S2) > > + target->data[0] |= FIELD_PREP(STRTAB_STE_2_S2S, 1); > > In the middle of the ASID? Agh, of course it should be [2], sorry about that; it was late when I wrote the patch :) I will send a v2 with the fix. Thanks, Mostafa > > Thanks, > Robin. > > > + > > target->data[1] = cpu_to_le64( > > FIELD_PREP(STRTAB_STE_1_S1DSS, s1dss) | > > FIELD_PREP(STRTAB_STE_1_S1CIR, STRTAB_STE_1_S1C_CACHE_WBRA) | > > diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h > > index 14bca41a981b..0dc7ad43c64c 100644 > > --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h > > +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h > > @@ -267,6 +267,7 @@ struct arm_smmu_ste { > > #define STRTAB_STE_2_S2AA64 (1UL << 51) > > #define STRTAB_STE_2_S2ENDI (1UL << 52) > > #define STRTAB_STE_2_S2PTW (1UL << 54) > > +#define STRTAB_STE_2_S2S (1UL << 57) > > #define STRTAB_STE_2_S2R (1UL << 58) > > #define STRTAB_STE_3_S2TTB_MASK GENMASK_ULL(51, 4)