From patchwork Tue Feb 13 11:31:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13555000 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 B3C2FC48BC1 for ; Tue, 13 Feb 2024 11:32: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:Message-Id:MIME-Version:Subject: Date:From: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=lpUOaUB0JaS3D/cMzzV9SSSEjvB2SoqOw1yei9sj44s=; b=c3lK9Z1LwhYhJ7 TeWgTE1k0v4JU3VsnwmqkIwSTGyTtwa8Un/4TvPcvRD0NFzdmWbx8ysiit6g6DxjF7cgEXMOYGELk x8tF5O+r4ciqsqbmKBSsWPqV/m+WDIlILFmyLr3ZwFexwUB41INsKonz1vBTxfbpTvDj12K9+sZA4 OD8wKVHCYR24N6r8oilp6khpC3HCXNCdMdW/vXW1CmZVbLlv0wHBa6f7zADMp3xJf2t/CBDCiZ+ML OIlu7oqFn7KvlaG1z0avAfi+Whw6xp5S3xzWxhELk833VnqA2tuo84RED7ZxNa2LoJ54cCIDyqlwa 1S+Y6P5+gAYDMblNIVaw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rZr18-000000091hq-3G8n; Tue, 13 Feb 2024 11:32:02 +0000 Received: from mail-lj1-x22d.google.com ([2a00:1450:4864:20::22d]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rZr15-000000091hM-1upr for linux-arm-kernel@lists.infradead.org; Tue, 13 Feb 2024 11:32:01 +0000 Received: by mail-lj1-x22d.google.com with SMTP id 38308e7fff4ca-2d10d2da73dso4144121fa.1 for ; Tue, 13 Feb 2024 03:31:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1707823917; x=1708428717; darn=lists.infradead.org; h=cc:to:message-id:content-transfer-encoding:mime-version:subject :date:from:from:to:cc:subject:date:message-id:reply-to; bh=uS8cnA3pBTNOupO3BurZcxkLrZDtBZi6I8VrC2BbWF8=; b=kX+gBn1V9Ox1rdTtbxuY8HSxEPMweocaIBOsuelb0UztNIoUk4fK5bY+aD+TrUYl6D wpvnvsXeNijPqxXi3TmL9m6B7It4aObtie6QWQLOHqpz4nxhW1P8MNNr6sHaKhzQurYW M6WJjck3Ppe5UGNVQo7zwaCbuLxsl9Rg/x859XcjPcOgLEf/ZFQTqWkxmFCZPw0u4nL8 ZK9atq0x/TnBmrKELKW086kG4yetOznF70JPNCSnswz0ZYT15PihYuNjB58j1HK9z1YZ AEFe4k3uSK8pRLm/PkVNwryaQR5ElsP8cYQfbn1oDdqRxkMOTWGB61M4/soxIaQZAIjb 55+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707823917; x=1708428717; h=cc:to:message-id:content-transfer-encoding:mime-version:subject :date:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=uS8cnA3pBTNOupO3BurZcxkLrZDtBZi6I8VrC2BbWF8=; b=AkEsx3TKiP7zsqRZ7NxXDci6w1VUAkxbeqM7fCUYAUBfybjvep3EQ8l/cDeAqosqqc yRLNbjygG2JNdkHM8kxzwmwxfbNAvYE1jwFKlM+e9uq6xjJBfU5vcnhkjiP9VsBP5D/q PXuNOnFR8484MY0xLgy9jg1OS4RhzGbNGddE4tAfrxXaglr4sdOE/IkhhbfoKI65OXR3 HhWybK4eK/FUGh1JgSEXmcmN3PNg1hdcQzcVRWdtoU43umB4gkTW1Kg/YZocBxeCZ826 T5v+ecp2SXOcQz8R0INSqWakj1vh0QtogxYNztF8rLDQ6U431olb63U4CagIcF1KGb7c hOQw== X-Gm-Message-State: AOJu0YwCAwiDBkWpOKK4pvidIzwMUQn+UxQk+1bsHQKvUbuLMswUAY1D yLo8mfAKFbC976QRKAV2ew+1hi8zKIiNLUfRVP0wfynDGdQ1aKiXrUl11m3j1dM= X-Google-Smtp-Source: AGHT+IFXqJMFeYMCwF/rJEi6gj2CPKIuIyx+ghUQ5Ar/LaUFd19fuMycEe/DMkqbxy8nFFZs+dYtHQ== X-Received: by 2002:a2e:b5a7:0:b0:2d0:a249:c04 with SMTP id f7-20020a2eb5a7000000b002d0a2490c04mr5848422ljn.51.1707823917042; Tue, 13 Feb 2024 03:31:57 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCWhBpnYHiCIPH+b0alrOINE7gSo++GX62QVo/r4qLptcCg++0dLshB8MG1whe+Rn8Ywo37DC1tim8a/Ln5JTZEHGc6v/N0N9S4u79H4vHQG4mhJVC+0PKI6sNmprrOkgoipCT8trMvOpMtnp4kSfzq5XdXgwyN0tUPsGJiO9uoap2csEPlqLqsgZDwhZZ3qGwxSb9kRgFB61yg7Fqx+zivdMrqKe/7nZGwkHynPH8Y= Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id f10-20020a2ea0ca000000b002d0ac71862csm460885ljm.9.2024.02.13.03.31.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Feb 2024 03:31:56 -0800 (PST) From: Dmitry Baryshkov Date: Tue, 13 Feb 2024 13:31:56 +0200 Subject: [PATCH] Revert "iommu/arm-smmu: Convert to domain_alloc_paging()" MIME-Version: 1.0 Message-Id: <20240213-iommu-revert-domain-alloc-v1-1-325ff55dece4@linaro.org> X-B4-Tracking: v=1; b=H4sIACtTy2UC/x2MQQqAIBAAvxJ7bqEskfpKdBBdayE1tCKI/p50H JiZBzIlpgxj9UCiizPHUKCtKzCrDgsh28IgGtE3ou2Qo/cnFpXSgTZ6zQH1tkWDTisxkOyUdRJ KvydyfP/vaX7fDxokJQJrAAAA To: Will Deacon , Robin Murphy , Joerg Roedel , Jason Gunthorpe , Rob Clark Cc: linux-arm-kernel@lists.infradead.org, iommu@lists.linux.dev, linux-arm-msm@vger.kernel.org X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=2391; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=VNzyMFgzRDdRImzMyBRwcnt+hLSTpHjtx1cCpgED+8w=; b=owGbwMvMwMXYbdNlx6SpcZXxtFoSQ+rpYB1d74MqZZ1PjrGqpvbq6yfbHAycGuRvfz8+9/k8M ymzTJNORmMWBkYuBlkxRRafgpapMZuSwz7smFoPM4iVCWQKAxenAEykL5f9f7HHmaTpk1e9EDDf J1OzzO5e2RXZ7AkKW7yaZwo5W4h7eckpG1RMaarY7W5r5DD/6gTd3MXSe0Nk7K/PYOxc7Xhai9n ZY6/P63XtFV5dkV92s6cWH5ayFv8vVrvzpHa0HNOhnr03Z2w6WCb7pThI8u9k52ecMV2zuoxbvj 9QEq547fVyUu4dNsuoNDHbb/dNl78ui37y64T1upp5yn+6uK2mJ8z66rHO8e48pjffPfxSvH8JL OBZkiv8vEee5+bjDWkFbhVuNukMl5yi7iadS5zZsWuxkWOk2N/vk3yLOw12X2B7tvPidM/TIRdt b/C7nVRenVqrGKt1z3ufjFdUyvmkT3zdKpdmsyYFdMQAAA== X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240213_033159_540089_BCD043B0 X-CRM114-Status: GOOD ( 13.18 ) 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 This reverts commit 9b3febc3a3da ("iommu/arm-smmu: Convert to domain_alloc_paging()"). It breaks Qualcomm MSM8996 platform. Calling arm_smmu_write_context_bank() from new codepath results in the platform being reset because of the unclocked hardware access. Fixes: 9b3febc3a3da ("iommu/arm-smmu: Convert to domain_alloc_paging()") Signed-off-by: Dmitry Baryshkov Acked-by: Robin Murphy --- drivers/iommu/arm/arm-smmu/arm-smmu.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) --- base-commit: 46d4e2eb58e14c8935fa0e27d16d4c62ef82849a change-id: 20240213-iommu-revert-domain-alloc-fa729e537df5 Best regards, diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu.c b/drivers/iommu/arm/arm-smmu/arm-smmu.c index 68b6bc5e7c71..6317aaf7b3ab 100644 --- a/drivers/iommu/arm/arm-smmu/arm-smmu.c +++ b/drivers/iommu/arm/arm-smmu/arm-smmu.c @@ -859,10 +859,14 @@ static void arm_smmu_destroy_domain_context(struct arm_smmu_domain *smmu_domain) arm_smmu_rpm_put(smmu); } -static struct iommu_domain *arm_smmu_domain_alloc_paging(struct device *dev) +static struct iommu_domain *arm_smmu_domain_alloc(unsigned type) { struct arm_smmu_domain *smmu_domain; + if (type != IOMMU_DOMAIN_UNMANAGED) { + if (using_legacy_binding || type != IOMMU_DOMAIN_DMA) + return NULL; + } /* * Allocate the domain and initialise some of its data structures. * We can't really do anything meaningful until we've added a @@ -875,15 +879,6 @@ static struct iommu_domain *arm_smmu_domain_alloc_paging(struct device *dev) mutex_init(&smmu_domain->init_mutex); spin_lock_init(&smmu_domain->cb_lock); - if (dev) { - struct arm_smmu_master_cfg *cfg = dev_iommu_priv_get(dev); - - if (arm_smmu_init_domain_context(smmu_domain, cfg->smmu, dev)) { - kfree(smmu_domain); - return NULL; - } - } - return &smmu_domain->domain; } @@ -1600,7 +1595,7 @@ static struct iommu_ops arm_smmu_ops = { .identity_domain = &arm_smmu_identity_domain, .blocked_domain = &arm_smmu_blocked_domain, .capable = arm_smmu_capable, - .domain_alloc_paging = arm_smmu_domain_alloc_paging, + .domain_alloc = arm_smmu_domain_alloc, .probe_device = arm_smmu_probe_device, .release_device = arm_smmu_release_device, .probe_finalize = arm_smmu_probe_finalize,