From patchwork Thu Aug 17 18:16:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Shavit X-Patchwork-Id: 13356868 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 9AEB9C3DA6C for ; Thu, 17 Aug 2023 18:22:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:From:Subject:Message-ID: References:Mime-Version:In-Reply-To:Date:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=eXw7MIPg8IEKdn1TbHtt7lowcw9ZD3zrM6Vn/nwnTWQ=; b=zYnkEmJkPz6SJQODu/Bt/NCzUo dMp1Eq6Cyrw310Ed2d92UoXJHqRgcYFS9r9H+AUrpKiAMHNOZoM6d4zMPOHXIVw0YstzUwmSNrSgH 72HBn2VkSn6kOmU470mTpD8Pp5mOEWQaCW+seLBsMMUHEjPheIlDT2kK5eiCYiBR4mcMe/lIcduRc DWZYhZONIF3JOD4PCdOGZoqlcMXAW4y9SGgik8JzTPMk/Xs0mvNzQAmvXDnvev4R9IMsP5EzdO53B FHWLsMi1CMFzkUYno7ckstMHvatFGvghvz91QDwJ6pszjoSV1HFV1MC9tcQcd1cO7tCY0wh66Wjah k55w4emA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qWhcz-006xYW-1M; Thu, 17 Aug 2023 18:21:49 +0000 Received: from mail-yb1-xb4a.google.com ([2607:f8b0:4864:20::b4a]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qWhcu-006xV3-0V for linux-arm-kernel@lists.infradead.org; Thu, 17 Aug 2023 18:21:45 +0000 Received: by mail-yb1-xb4a.google.com with SMTP id 3f1490d57ef6-d669fcad15cso187973276.0 for ; Thu, 17 Aug 2023 11:21:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1692296501; x=1692901301; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=BIQTGF+g2uioZsuYxh2OZLeccAuWFaEAAqhYyJhrMno=; b=dwgSvvfqT9h8cnS2ANlfzc/bgIB0QsDd8CDnK3UIm0ECJPG5JtjbaBFo+m/YimJjK1 FlcF7DYGVOnxlmxsuZmwGYkLyzXE/+YXllLknn+tZ0URfSeZ5ZQm2ooYJMUDaCgm9HD3 EMRZmApldwJieHbJYGroUPtE8c2Vj1YgXUDFNmuw6MbqODyN/lDCN2SE2s0i09cVaycM IwOY8mSDO8eTap09s5EpC3UjfSkki/wTO7MZecQEtHfYnAOIxSA33Hg4SfFIAFGar366 ucYHtFxnE0S6mZ5Oye/3L5iPNtWCHGNxHVp6H5k1FOv9CqWStIWrJaHE35yH0GApsM9x ZyDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692296501; x=1692901301; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=BIQTGF+g2uioZsuYxh2OZLeccAuWFaEAAqhYyJhrMno=; b=gF8sg9qibbgyA/AaWujItuDv2aWrj8DAZnACa2PIneI6/PuAR7fJeDyM+R072WP1WV hKlPe3UIPNGT8hAF5fKD3NqdOZ40jdcokQyIyv7ZVfLxv38GFUfCJUO+EIKGWFd/nyUZ hKroq3YVqIri9UclyyWEyiGrEIAYHM0doD9F4a3GVBr9VP48XkNHNOzMvpwRB81rFPUg paQx9fdMap2MHXQXlnJOPZKztR1hBa0vmq3IrYA7r+QMY0GUB74hRJ9tvs43ymqwojZW ej6+6DNoKjsJpirpk9+n7MQ/LauNY4odU365mFEw9xdtll5iJbU8tcgZn9kpGpQpfJ7A Cf1w== X-Gm-Message-State: AOJu0YzBOTpdi/kegBNKc4nzJcZERd5ETAmhc7Kh1wzvomUfPg2EOKFi TWTqA9FtMyOTRTy79GZsaZVTDAeA+Dqp X-Google-Smtp-Source: AGHT+IGki4STCy0HIY6Al3kylQ4EKIZ5nbsBXL4XMwGt8Fl0igDhFp/d8IMaNrxqUESLF7rmYoeQWgvp+7e3 X-Received: from mshavit.ntc.corp.google.com ([2401:fa00:95:20c:4a77:fd20:7069:bdf9]) (user=mshavit job=sendgmr) by 2002:a25:ab8c:0:b0:d45:daf4:1fc5 with SMTP id v12-20020a25ab8c000000b00d45daf41fc5mr4372ybi.3.1692296500636; Thu, 17 Aug 2023 11:21:40 -0700 (PDT) Date: Fri, 18 Aug 2023 02:16:29 +0800 In-Reply-To: <20230817182055.1770180-1-mshavit@google.com> Mime-Version: 1.0 References: <20230817182055.1770180-1-mshavit@google.com> X-Mailer: git-send-email 2.42.0.rc1.204.g551eb34607-goog Message-ID: <20230818021629.RFC.v1.7.I65dd382de382428dcb33333342b35405903ac768@changeid> Subject: [RFC PATCH v1 7/8] iommu/arm-smmu-v3: check for domain initialization using pgtbl_ops From: Michael Shavit To: iommu@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: will@kernel.org, jgg@nvidia.com, nicolinc@nvidia.com, tina.zhang@intel.com, jean-philippe@linaro.org, robin.murphy@arm.com, Michael Shavit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230817_112144_211681_5BD13000 X-CRM114-Status: GOOD ( 11.88 ) 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 In order to remove smmu_domain->smmu in the next commit Signed-off-by: Michael Shavit --- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 7f88b2b19cbe5..c9f89f4f47721 100644 --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c @@ -2918,7 +2918,7 @@ static int arm_smmu_enable_nesting(struct iommu_domain *domain) int ret = 0; mutex_lock(&smmu_domain->init_mutex); - if (smmu_domain->smmu) + if (smmu_domain->pgtbl_ops) ret = -EPERM; else smmu_domain->stage = ARM_SMMU_DOMAIN_NESTED;