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 42229CA0FE0 for ; Fri, 30 Aug 2024 11:05:58 +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:Content-Transfer-Encoding: Content-Type:Cc:To:From:Subject:Message-ID:Mime-Version:Date:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=obthWJJQx048EnN2AOC6zuK5QgHhreZNXc1GxoMBMd4=; b=D06LfkZKW8NLleBASo9//9o8UV 8qE7/U/7Tl5v6/UGWekoOfj09k7a+njFnGrB+nwu4NVIZKykcqpjZTwQxnxhf0R7FzM7GzSm/b1qA xlOSk7fADjnMAO0+O51Csq10hnSpc4saH1LWnTYZAqCmclVQMrsS1KbttVF6an3I4E6Nh1MLUpZzB eS290kpJCE6NWJutt+g+/t1fTkZNQIHwxoaXuoGxJUvSN1agR7W6u0ASY0fBq2/SxxeQQbcb/1CWr Mbh07RCMpVODl3F3RoaHSE0M2kXK/jyL1AiKI7qss4x93BZbUMoKStRIU0a6lWTKjqn8jzilhuhvL II4jUGJA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjzRt-00000005xhN-0unN; Fri, 30 Aug 2024 11:05:49 +0000 Received: from mail-yw1-x114a.google.com ([2607:f8b0:4864:20::114a]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjzQ7-00000005x2M-1edf for linux-arm-kernel@lists.infradead.org; Fri, 30 Aug 2024 11:04:00 +0000 Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-6b0f068833bso40444507b3.0 for ; Fri, 30 Aug 2024 04:03:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1725015837; x=1725620637; darn=lists.infradead.org; h=content-transfer-encoding:cc:to:from:subject:message-id :mime-version:date:from:to:cc:subject:date:message-id:reply-to; bh=obthWJJQx048EnN2AOC6zuK5QgHhreZNXc1GxoMBMd4=; b=wKBc23FXOTVQquQnPAAWOFz6fKumkYF5n8ne7N5nGESMG3Knt6R+DNBkpEDd4ugErf WdJSbdm1DZgmINcrdmQngQWj7/1Z6akE+jyuhaH/9d1ZQUeENhz8S1aV6+lrsQWCvvIk ZoroVAuAkF3E/YQhGRr6yakK6Y9KzOe4xwCYsNCrXPuFDLDujZvuGRDb/IrscWKwMC8P klPxOPwDjOjhY7AhYmIS3ftLmuOznW23K9uSiWQ3R93+Sqmd8QIrEnIj2gsMrEAv0j4t RzQxCgls3GWtwnj1LuxefAp3nM4QXlGVJYbhz38dfpoVWmHgHWVF59zcd/QWH8B4mECN pS5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725015837; x=1725620637; h=content-transfer-encoding:cc:to:from:subject:message-id :mime-version:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=obthWJJQx048EnN2AOC6zuK5QgHhreZNXc1GxoMBMd4=; b=XWfIP6oIzSiF84W5W3kmFxU6gWqHJXDV87j/eh+FKF1fHe94ydETDTzXm43U4zoUjO EgEy7dafdvWNsneRUaEgyAsOhhI8ndycnxZydGlYRmYa8mtvcPUKsyQPChtWsG+PAcEZ Rk5AT5HYfvLOAFGxGUTr1lmnk3M4ZAJ2Y84ISG5ARNeKZ9OPerKvnqBG5T8t8oVhfJ8H hWSVzNvp158UfV9NouExYxOBNuy6Jk9pfifRyNZN8KuWCGaxUfQKWo80h/ADXaB/SrP7 hPZbd3bWtFvmv0Ufem80tonda2yS4woRmscbeqw4UAoVtZLeK7ZA2pdEpUBBnYYE0Ah7 RfJw== X-Forwarded-Encrypted: i=1; AJvYcCU5WHLefSxiVgxTsCjOQU9qqTaSAHyBKnCOWO0ljQKtMLApZMaR/OcUcOuRLXPHVI/RgoT5OKz6/FzSh+6oUtYa@lists.infradead.org X-Gm-Message-State: AOJu0Yyxq/6dsiwOSVfM6Et2Pmh8ZMrwlS53HIHE+qcMFF3LWFcAG+No VWctDU7i0hnncrdBfN5hsB+CCyBc61FbjUyU/GAGMRQbDL5fbvgXDub0XGn1DaJkXqe0A1VkMI8 ++AkHdx065Q== X-Google-Smtp-Source: AGHT+IHkyHjn4rwsHHaBZz13oCcDK5Wif55SRe6/R2eIzxGkPl4d+94YtRJamqf/F9SQM1XvqVn7meehMJtJLw== X-Received: from mostafa.c.googlers.com ([fda3:e722:ac3:cc00:28:9cb1:c0a8:333c]) (user=smostafa job=sendgmr) by 2002:a81:cb0d:0:b0:651:2eea:4dfe with SMTP id 00721157ae682-6d2818a64f4mr1646297b3.0.1725015837461; Fri, 30 Aug 2024 04:03:57 -0700 (PDT) Date: Fri, 30 Aug 2024 11:03:46 +0000 Mime-Version: 1.0 X-Mailer: git-send-email 2.46.0.469.g59c65b2a67-goog Message-ID: <20240830110349.797399-1-smostafa@google.com> Subject: [PATCH v4 0/2] Fix handling of S2 stalls From: Mostafa Saleh To: linux-kernel@vger.kernel.org, iommu@lists.linux.dev, linux-arm-kernel@lists.infradead.org, will@kernel.org, robin.murphy@arm.com, joro@8bytes.org Cc: jean-philippe@linaro.org, jgg@ziepe.ca, nicolinc@nvidia.com, mshavit@google.com, Mostafa Saleh Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240830_040359_455070_3E0369FC X-CRM114-Status: GOOD ( 12.24 ) 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 While debugging something else, I spent hours looking at hexdumps of STEs, CDs and commands while comparing them against the arch specs, where I noticed a minor violation in the driver regarding handling of S2S bit in the STE. This has been there for ages, so it=E2=80=99s highly unlikely that any HW (= if it exists with such features) running Linux is affected. I don=E2=80=99t have access to HW with stalls so I just tested normal usage and (terminated) translation fault events. Also, add some unit tests for stall enabled masters. Mostafa Saleh (2): iommu/arm-smmu-v3: Match Stall behaviour for S2 iommu/arm-smmu-v3-test: Test masters with stall enabled .../iommu/arm/arm-smmu-v3/arm-smmu-v3-test.c | 83 ++++++++++++++----- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 8 +- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h | 1 + 3 files changed, 66 insertions(+), 26 deletions(-) v4: - Add S2S bit to get_used for stage-2 - Add unit tests for masters with stall enabled v3: - Set S2S for s2 and not s1 domain - Ignore ats check v2: - Fix index of the STE - Fix conflict with ATS - Squash the 2 patches and drop enable_nesting --=20 2.46.0.469.g59c65b2a67-goog