From patchwork Thu Mar 30 13:17:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 2838 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pj1-f69.google.com (mail-pj1-f69.google.com [209.85.216.69]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 1558641F1E for ; Thu, 30 Mar 2023 15:19:36 +0200 (CEST) Received: by mail-pj1-f69.google.com with SMTP id nm11-20020a17090b19cb00b0023d0c90d851sf5889008pjb.1 for ; Thu, 30 Mar 2023 06:19:35 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1680182374; cv=pass; d=google.com; s=arc-20160816; b=k5aOm/g17Oos4C4nNavSqWeLBPRLCbuZCHzG/C0W3dqf/bGZCW00yQwB2czkAK3bnX 2z7ateHAnPVxyjReqG79a1oyOnhWwSaroKmv85ZEeZ2GvQn34BnVNgYiANpUifH1om0z /SN+TSEYVbD3JF7BfRl8OBDVUGouEtDW7B2++exn1DQNes1e43FfLqGd11wvFZlsJYke PKzT+xYFHIAXhMFF2GZqKR2iVBW1BqKtO+CK/MS4OPc6Ps2dyKXKrVly5FqmaH51MzU+ 8GqCN2Sxloeo8ZoE2OQXMobfevBR0JwFBJ1pi/bkLTCgPbKNn2rKh1P7omLIx5Sds/06 ckdw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:message-id:date:subject:cc:to :from:dkim-signature; bh=vEnOw1VZ5CE1U0zOGHaZPQZCR9rcbWALanzA4uGTnpM=; b=mIO8sswpA7HmSSkV140zAIXvqc8CHToOCzqWdEPKs5PXO1iQig6e9pYLMtC/s+ILj7 Wf2fLmKGWX3d3NIya999Z9fqPutaD/JVIWOt5+Ee8kQCeg9EQuRU4U43fFxDh9vdnP2v D8VQ8Tdxci8eBfKkQHJ13nXGMv6isb5GWqNMsQ8FRsVs4NsTVbhErM0+vmqJZBUOvJqd NCNBcVW89Crn9Uh9WaIUYL09y0jUW7wWNs21g8YhqCEKdWrZpVQEzrnYOxEuaSj2nMSI mvFNrJMl4mDQ5fq8hL25M8+uHqwDZxLR8QNtZtJ2Lb8ALfwlbNXXtF30lENtBAFzxpJX eh/Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=pPb+W1Qg; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1680182374; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:x-original-authentication-results :x-original-sender:mime-version:message-id:date:subject:cc:to:from :from:to:cc:subject:date:message-id:reply-to; bh=vEnOw1VZ5CE1U0zOGHaZPQZCR9rcbWALanzA4uGTnpM=; b=cJQcWboz8BkAbquNMNWhWWOaMto5K0SSKyKRKtuso380xNouO8OA2C2BFFn8GoWWMH Ui56LoYYJ26ioy7ajCnYtjBHOJRCLF9+18NJ85S10nWEmfDnDD8gyE2mHttQt5hHxU6D Xz35JPmll83CCec6E2ZjOcLJtKBI85GErN4aQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680182374; h=list-unsubscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender:mime-version :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vEnOw1VZ5CE1U0zOGHaZPQZCR9rcbWALanzA4uGTnpM=; b=AwCUf+REafXBOQeuBcYImdjAoVAvhVZWGloy3Dr8jgO5ESq9XWk1qRn0gC0hZiAh6l PYwmit/3J1bO6wMh/8WNiMxMlunRz1HhU0B6uDyAWEpj0UGbQ2K847zpMmUg+n/jrosC utAdZk4mX8QJiub635pjgXVQRdt9xAeaDqV1Q+RTK6w3E4E/3s8elAPqxj6gg+fzlW3h vBiTo0jV/0OxclF60lMEaIpyryUJmLALrtLp6Xoj2Otq1/jbi0F53NAFNabboTLMIk/b DBYeTMu8xwjDI8YKW92Dkj0bzuao7X88S6eslmVWnQfhBG6ZiE/2FSq4DBuIk/Q9o03A xgCw== X-Gm-Message-State: AAQBX9fCnV0eNmVxNU3TLaJTrkorPXGMBfH4TyahZiuhU8rRjbMUOnoy E8ABjcvi5Bk9aMOSof3hIx3yGhAV X-Google-Smtp-Source: AKy350aYicyAEb0Yv31K+2iY2mgP/S2PXtpBr2j6j1DXknj8656eaNY6L0QV7DYuXDPoNldLmLUwKQ== X-Received: by 2002:a17:902:a517:b0:1a2:73b3:b398 with SMTP id s23-20020a170902a51700b001a273b3b398mr2046461plq.6.1680182374442; Thu, 30 Mar 2023 06:19:34 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:902:8481:b0:196:751e:4f6e with SMTP id c1-20020a170902848100b00196751e4f6els1899563plo.10.-pod-prod-gmail; Thu, 30 Mar 2023 06:19:33 -0700 (PDT) X-Received: by 2002:a17:90a:31c:b0:23f:870c:83a6 with SMTP id 28-20020a17090a031c00b0023f870c83a6mr27230496pje.0.1680182373238; Thu, 30 Mar 2023 06:19:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680182373; cv=none; d=google.com; s=arc-20160816; b=NC+OJP30SHPrVOt3gZdnAhb1KoKZIZ1dRrTanXpluFbNM8H4gUPEX3mXAGyDT0oeti ERXrvUpeDyjYPSVbU3iD1iI/e9UzfmWqP8Gwz4wRK6sMTgNFdW5SH+p5ViZlgM2iwH3w ZazbgIexiJ5MYljqq5FBHDHEQel0FTZVIuBJNMU6L2CRaSrIbo606kLigGutx40V87+a duZ6M27pBfQKuMZG5ut22OjrtNjmIt3hmEcyLLd64Vp8+yxI/rTYOS7TRfPK9XMe4U3J O4i9oMV6/IIpr1M78fPKEQw94S7vxF+m+rrJhyzVU/HsHbrfZXGm3sgIJgQF4vJqoZnd R+8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:dkim-signature; bh=S6l/tdN4cMocc6YNsFbnVaBOI5uqYV8apPR4ELkkR1Q=; b=ZsCbcY1oZrZehWNkS/m4oGoXyzFqYdFMFE9sSbAaRAzDW52SknAaQ/MrkG9MQ2aLZt SuUYO8cY9zoxek4PT8S4i9RvDkFSv2IvRST/STiA1jWJFJI8c0sPzpi6S2WQI607aSzQ 6cRZU4GgWG6ppZi7YKZJaaghGWJa/ZD39bmU5xraFaC47Tl7hEOVuDQ2MVWdExWOKFpr nxopMSVE2EVS5PzU8WzFalzELIRtJL8Ev3U3eUYcxQX9BYGvPH2zprljjN/37fC+MMLD hCpnt7Ccf2Vr4rO6+wqNg9joxY2xsxbxb/4/VsGuyRZbD/0WnzedSPPTKK6wUemttWDe dQ/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=pPb+W1Qg; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id jw14-20020a170903278e00b0019aa8c58b4fsor7351850plb.27.2023.03.30.06.19.32 for (Google Transport Security); Thu, 30 Mar 2023 06:19:32 -0700 (PDT) Received-SPF: pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Received: by 2002:a05:6a20:ce22:b0:d9:8b07:eb0a with SMTP id ic34-20020a056a20ce2200b000d98b07eb0amr22599282pzb.24.1680182372424; Thu, 30 Mar 2023 06:19:32 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c00a:a047:8bc3:c2fc:8dab:d912]) by smtp.gmail.com with ESMTPSA id e15-20020a62aa0f000000b006259e883ee9sm22473622pff.189.2023.03.30.06.19.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Mar 2023 06:19:31 -0700 (PDT) From: Jagan Teki To: Heiko Stuebner , Joerg Roedel , Will Deacon , Robin Murphy , Rob Herring , Krzysztof Kozlowski Cc: iommu@lists.linux.dev, linux-rockchip@lists.infradead.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-amarula , Jagan Teki Subject: [PATCH 1/3] dt-bindings: iommu: rockchip: Add rockchip, disable-device-link-resume Date: Thu, 30 Mar 2023 18:47:44 +0530 Message-Id: <20230330131746.1475514-1-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Original-Sender: jagan@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=pPb+W1Qg; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Rockchip iommu is trying to enable the associated device at runtime resume however some devices might enable the iommu during their pm runtime resume operation which indeed leads iommu to use the wrong domain and this leads to device iommu page fault. Add rockchip,disable-device-link-resume flag and give an option for those devices to disable the device link during Rockchip iommu pm runtime operation. This makes the device enablement for that iommu domain ignored during the rk_iommu_resume call as it assumes it handled iommu device attachment in the associated device itself. Document rockchip,disable-device-link-resume flag. Signed-off-by: Jagan Teki --- .../devicetree/bindings/iommu/rockchip,iommu.yaml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Documentation/devicetree/bindings/iommu/rockchip,iommu.yaml b/Documentation/devicetree/bindings/iommu/rockchip,iommu.yaml index ba9124f721f1..ac8b03806cb3 100644 --- a/Documentation/devicetree/bindings/iommu/rockchip,iommu.yaml +++ b/Documentation/devicetree/bindings/iommu/rockchip,iommu.yaml @@ -58,6 +58,15 @@ properties: Some mmu instances may produce unexpected results when the reset operation is used. + rockchip,disable-device-link-resume: + $ref: /schemas/types.yaml#/definitions/flag + description: | + Do not link the device during runtime resume operation. + Some devices might enable the iommu during their pm runtime + resume operation, so disable the device link for those devices + otherwise iommu use the wrong domain and that leads to device + iommu page fault. + required: - compatible - reg From patchwork Thu Mar 30 13:17:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 2839 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pj1-f69.google.com (mail-pj1-f69.google.com [209.85.216.69]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 0AB9141F1E for ; Thu, 30 Mar 2023 15:19:45 +0200 (CEST) Received: by mail-pj1-f69.google.com with SMTP id b8-20020a17090a488800b0023d1bf65c7esf5344774pjh.3 for ; Thu, 30 Mar 2023 06:19:44 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1680182383; cv=pass; d=google.com; s=arc-20160816; b=0D8X7dS4h1gE3W4IK5qoQyZLV3QXqaaw3sDPrwLTg7IjAApHOvomRZU5BMZbo6/Eg1 z96sAZylLvmA6lW16vMhFW6ImyL3Udhj03y7h4DwXkhD7SgN77UxBDx1/ZxGq4Vowkrs piUtJ8zfO72Qrhj24OuSlwNtwfP6rvaSrLdIPvDZWBSYEqN7weYl0JdjXrk+DDz4EFHq mkjeCwNPNiwm4LJ+GpK40hGRtwhvpmbCIgAWFDejtM0o51dv+zrFIMy8yVLY2WDoKF8J BdQBRZok6fgebr1CRJz+q+frC5b3H+GqdZ3GorYHMOHPEEhkIhciJXiYiIvkVavG9QFH j/9w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=3pEEbK5tWECHZZdJq9SybFDy57T6TbihJPDL0JDneW4=; b=nPwya7dIMi5BXyiOlSK/DMflW6ygz3K7oYa3xnT/riBOWnz/NOU4Mw8IDmks5hBGSa 2LrIt9pR3qKvQ0WDFREqCnW1J5yiuJ8N3StHopu6DSrP2aWmLwQAtLmyObiNU7zgMoHg UCOQw5/UwL6CTv5lTpM4l/PGQ37cDnUt86BpLLTCwoi/+DL94uvyv6P7dSUgtGDBUJ7r FPfpx2c5fUqI4ui+Kjy/TcjKPtaK4oPfZE7hYTeEcpW8mlZe3Y8+mB71WhEjAgXLDcfN lOhEttpSBeTVLeT0OKxY1wzTfEK1tjzm9zn5VV/GwhWTV6D6AzS6+Il3jGVElu1/faA5 oy1w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=SrPP5+QQ; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1680182383; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:x-original-authentication-results :x-original-sender:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=3pEEbK5tWECHZZdJq9SybFDy57T6TbihJPDL0JDneW4=; b=fcaUzzJU/QhxQQiMv/A5pLwRjkdEBkcVfAIM+zw0ASLE5wSKxHN+uJeMrqMFpF1hUP ucTJtP08eN8+/6I8na5lcAepDzQoqDcWpFVjvbW7r8YIGlSzectgH8k4eVX8wKGFo2TP gmp9EauozbQ/MgEVcVzKebR6kyb/1uQSWH9+Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680182383; h=list-unsubscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=3pEEbK5tWECHZZdJq9SybFDy57T6TbihJPDL0JDneW4=; b=Cr9G/6nLnICfVZEEU2VZa7cnY/+4eMIwc7Vr12Qi6KQokNi5/EHNM5wUYrozhSjEpO 3UZ/q2B9kpsargMQZBNzCSi/paX63YrgT/Pf97tQ6KQyjGEb4c6IpNqEzD4b8Q7N7eun 9Ps1pBTImiUbAh3D5ii24BJDp79HvSYs2awxEmclaKtGCIbTJVNaz99TcnhqjbutgPH/ T59OLfzy5m4YuyHHQvmaYCyRaNzzhFR5yreP+RKWoa8fWq3lb1NDLvKTwZp1XdB6zMyX vROYxhTmR72jWxJ8FNsUBrOP4YDF49SqLu3BKnRI8LmMEab2g8SyxNF2384F/bCs9YHS aK5A== X-Gm-Message-State: AAQBX9erGhwlcoCXjF9SAWsFNh70LiSO7DlexRpqCu1PzY18VoenLlNR YMD6HakxM+Cfb+vTmBb2m2U8eKKK X-Google-Smtp-Source: AKy350YvTnx0/okqjZPOWFFHUJj1ybt7dl153JS9UMiyrkEJs5rX5eDB1cl7LkEUhVBtjUBPK2b4Eg== X-Received: by 2002:a63:2041:0:b0:503:91ff:8dd8 with SMTP id r1-20020a632041000000b0050391ff8dd8mr6288085pgm.4.1680182383491; Thu, 30 Mar 2023 06:19:43 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:903:1106:b0:19c:b122:6f2d with SMTP id n6-20020a170903110600b0019cb1226f2dls1947070plh.2.-pod-prod-gmail; Thu, 30 Mar 2023 06:19:42 -0700 (PDT) X-Received: by 2002:a17:902:d505:b0:1a1:e39c:d4d1 with SMTP id b5-20020a170902d50500b001a1e39cd4d1mr27136384plg.67.1680182382460; Thu, 30 Mar 2023 06:19:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680182382; cv=none; d=google.com; s=arc-20160816; b=mctyytPYAX+hat7JUg4Yolnm4eRQ6/qUtkPjiluYqbOv1+QHP6+ZyihkyNgLn0UPoW 2OhmFTCmDDRiZRJuswIcha0N6Nf7zDjiXpkEU6KcjXPecJCepZsJ2cFAKR1J2cSoJ9Sh xwAeKofRrYfPxIMM7uemHmtoB8lEbTy+8y7LZhRwPvDo8ih4m3yx38H/t/eofL67l9aC 2KD0z8qX8a1N6gCnfWAGRj6fK3j71cjhGINlbZ+j28E9/mQGO1/ZmHVb0zQ8jQjIO2rQ pQqvFjaoRIkL37z6+qG90O7xeu3Kq2zRFzjGIAWik6VcMU144LFwY6os087qS9ZQWmfO eHhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=zkeMr7lTFTJZ/1wYN/aWGJRLdHK6qyRIY62qhqd0xcs=; b=xwF3fAXk2DA2+JJzlrZ33x73CRAcckfyPXw0xavamMayhSug0S4fxTZJRp1x/6EJok Xo3kW6ZJMxbt2lCeyx9ZLhxUZ+f6VZ9OpsF31R6EObM3F8LhQy1X1Yt3xf/7K+zebc3v 4N8zOP6h7CJQsQiyg0UgxBk8Dz6/5bcFAAAtw0FZRlVp/aBUYDR5LFEHjJtgc1KDGc1R 52wzY/6hZv7U5Afm4piFlt0fjA35NyJxcrDXjQdJ2t3C1LRkBdxxfkIzXcd4d7IN9f04 NhUNscrRdTlUFVH/qqrxfeqToqqLF5zY64fB+R4RWzixGmqGPdMMY7/9r+Ee8HB3ookA 0izw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=SrPP5+QQ; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id jg9-20020a17090326c900b0019a9c0b98dcsor7195598plb.85.2023.03.30.06.19.42 for (Google Transport Security); Thu, 30 Mar 2023 06:19:42 -0700 (PDT) Received-SPF: pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Received: by 2002:a05:6a20:4c10:b0:d5:73ad:87c2 with SMTP id fm16-20020a056a204c1000b000d573ad87c2mr16883923pzb.56.1680182382070; Thu, 30 Mar 2023 06:19:42 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c00a:a047:8bc3:c2fc:8dab:d912]) by smtp.gmail.com with ESMTPSA id e15-20020a62aa0f000000b006259e883ee9sm22473622pff.189.2023.03.30.06.19.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Mar 2023 06:19:41 -0700 (PDT) From: Jagan Teki To: Heiko Stuebner , Joerg Roedel , Will Deacon , Robin Murphy , Rob Herring , Krzysztof Kozlowski Cc: iommu@lists.linux.dev, linux-rockchip@lists.infradead.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-amarula , Jagan Teki , Simon Xue Subject: [PATCH 2/3] iommu/rockchip: Disable the device link during resume Date: Thu, 30 Mar 2023 18:47:45 +0530 Message-Id: <20230330131746.1475514-2-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230330131746.1475514-1-jagan@amarulasolutions.com> References: <20230330131746.1475514-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: jagan@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=SrPP5+QQ; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Rockchip iommu is trying to enable the associated device at runtime resume however some devices might enable the iommu during their pm runtime resume operation which indeed leads iommu to use the wrong domain and this leads to device iommu page fault. An example of this behavior has been observed in Rockchip RK3328, where iommu stalls request timeout dring VOP device enablement. Here is the dmesg log for the same: rockchip-drm display-subsystem: bound ff370000.vop (ops vop_component_ops) dwhdmi-rockchip ff3c0000.hdmi: supply avdd-0v9 not found, using dummy regulator rk_iommu ff373f00.iommu: Enable stall request timed out, status: 0x00004b dwhdmi-rockchip ff3c0000.hdmi: supply avdd-1v8 not found, using dummy regulator rk_iommu ff373f00.iommu: Disable paging request timed out, status: 0x00004b dwhdmi-rockchip ff3c0000.hdmi: Detected HDMI TX controller v2.11a with HDCP (inno_dw_hdmi_phy2) dwhdmi-rockchip ff3c0000.hdmi: registered DesignWare HDMI I2C bus driver rockchip-drm display-subsystem: bound ff3c0000.hdmi (ops dw_hdmi_rockchip_ops) [drm] Initialized rockchip 1.0.0 20140818 for display-subsystem on minor 0 This issue is reproduced if we enable the display in U-Boot however U-Boot is not even touched any iommu register as the U-Boot display uses the simple frame buffer like other Rockchip platforms RK3399, and RK3328 do. When VOP is trying to enable the iommu using runtime resume call pm_runtime_resume_and_get from @vop_enable then the iommu runtime resume call @rk_iommu_resume will try to attach the VOP in the wrong domain via @rk_iommu_enable will lead to the vop iommu page fault. vop_enable() pm_runtime_resume_and_get() rk_iommu_resume() rk_iommu_enable() ... vop iommu page fault ... rk_iommu ff373f00.iommu: Enable stall request timed out, status: 0x00004b rk_iommu ff373f00.iommu: Disable paging request timed out, status: 0x00004b So, this patch is trying to disable the device link for those devices that are enabled rockchip,disable-device-link-resume flag assumes here VOP device. This makes the device enablement for that iommu domain ignored during the rk_iommu_resume call as it assumes it handled iommu device attachment in the associated device itself. vop_enable() pm_runtime_resume_and_get() rk_iommu_resume() ... ignore the device link ... rockchip_drm_dma_attach_device() iommu_attach_device() Here is the downstream patch for similar issue, https://github.com/rockchip-linux/kernel/commit/85959f645ba38617233fbf44f442f8a88875d765 Co-developed-by: Simon Xue Signed-off-by: Simon Xue Signed-off-by: Jagan Teki --- drivers/iommu/rockchip-iommu.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/iommu/rockchip-iommu.c b/drivers/iommu/rockchip-iommu.c index f30db22ea5d7..bcff0dc21223 100644 --- a/drivers/iommu/rockchip-iommu.c +++ b/drivers/iommu/rockchip-iommu.c @@ -111,6 +111,7 @@ struct rk_iommu { struct clk_bulk_data *clocks; int num_clocks; bool reset_disabled; + bool dlr_disable; /* avoid access iommu when runtime ops called */ struct iommu_device iommu; struct list_head node; /* entry in rk_iommu_domain.iommus */ struct iommu_domain *domain; /* domain to which iommu is attached */ @@ -1250,6 +1251,8 @@ static int rk_iommu_probe(struct platform_device *pdev) iommu->reset_disabled = device_property_read_bool(dev, "rockchip,disable-mmu-reset"); + iommu->dlr_disable = device_property_read_bool(dev, + "rockchip,disable-device-link-resume"); iommu->num_clocks = ARRAY_SIZE(rk_iommu_clocks); iommu->clocks = devm_kcalloc(iommu->dev, iommu->num_clocks, @@ -1346,6 +1349,9 @@ static int __maybe_unused rk_iommu_suspend(struct device *dev) if (!iommu->domain) return 0; + if (iommu->dlr_disable) + return 0; + rk_iommu_disable(iommu); return 0; } @@ -1357,6 +1363,9 @@ static int __maybe_unused rk_iommu_resume(struct device *dev) if (!iommu->domain) return 0; + if (iommu->dlr_disable) + return 0; + return rk_iommu_enable(iommu); } From patchwork Thu Mar 30 13:17:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 2840 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pf1-f198.google.com (mail-pf1-f198.google.com [209.85.210.198]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 19F0D4147B for ; Thu, 30 Mar 2023 15:19:51 +0200 (CEST) Received: by mail-pf1-f198.google.com with SMTP id m12-20020a62f20c000000b0062612a76a08sf8811035pfh.2 for ; Thu, 30 Mar 2023 06:19:51 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1680182389; cv=pass; d=google.com; s=arc-20160816; b=LWVeWd2bf/OT3x0T9DTbbHezLSV3Ju93D7bTBXDFiZskrnj4nZZq6Lspb0Q/v1x9X5 9jsYhnlFMFW8TJTm4r2ui1evQSv25eQ61uSvi7JjgBk12e0M/2439MnVoGBprpfg3txg Ztj3H7X2ONBNc/F6zJbM7BK41Z2KvhggixSnXY79BfllR/go0modaxI/0gwOrd4JirWq HQYkmvDBRQahq55pVdFBYiA/ZgrkCYiQSVoOecM09TywCMlNK3e89nO83Ne2zpO3Dmrc ez1n9V6AhBsKkrf2KiGJbRYvWQg9EaVerP3RoorV903bv+JPm1o/f10LDPe6cJztVnws Nc0Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=mXdoPna6UwAHCfVqKEhKPoXG62AOMhVNlZwB861M0F8=; b=suq7sZ8Qww0QHfsJipekqcbPadTYeS8fty/vyHHL+w1c5oz+tH4jZ2shMA4CYsoVcC 8uQBY9JEjt1OEraE0Ym3xgoQWdsoQx3j7O+HVfV2QGZ1hM+0085kJXlzZ4iCEChtiaRQ KQLwljdviGED6Dyog4huIZG9V6T2BGueciYGIoaQd+M/sBIVzK630eWsCo1ibvAqGdfB +/QyFvCsqekCWVfIy7kDV2g2Da12BzFS4vjVays+6CRbCNHHvvzwOQmNvlsFxwIODnxP aNBLh8woKZdFbv4EyuoQsw0ZHLuG0ouYLsYf8XbdcBidYgyYNuUAfeRLX2DJcLrOXSUV klyw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=oRmW925X; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1680182389; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:x-original-authentication-results :x-original-sender:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=mXdoPna6UwAHCfVqKEhKPoXG62AOMhVNlZwB861M0F8=; b=b2njHUHBkz1QIrSe3K0QvVQuioXSGsGMWVUYNQMxhfDAayUo/KvGZrJbtXjgpMmXNU vwrNu+rEQxZY/E4KooBCbpDHFHCWtwvbv4FeJZPrAh25yCVkuXrpcqb4KJJwT0q+96Cf pS3aiC03pgSeVzYyI6CgR2341Cka8qbJbyz5E= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680182389; h=list-unsubscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=mXdoPna6UwAHCfVqKEhKPoXG62AOMhVNlZwB861M0F8=; b=rgdx1YxlXQQNvBOksVsFmFrWoKnjc5sq0MKJmLJscLzoab3PKtb5ia5HdbKmPCBDlh PnX6Dz7ugjx/BtY5ZW5JCDDjppRBGcK0yIPC4ad67ITxhwt6gkywvIeSmEwdc4OOzuB7 t+sOLuMMvCG58Q/RYkVHEFt17fLgUs+6UoPC6FbZI4qnWev48Kz7fZ8sMx1dhOWFhImo osVcY7eDgnZLhycXNQSU+BtwZRw/DHZ/is4eyTZSWeqycgBg1+3I9XkCY7XSMS53hS3U /rIsH6LE3NZnjhH1D7sS2xOFONW/hUJ1vpjQ/CRe0rMuU7p+eLclmaEG1Hg6NbSPc+3I gnyg== X-Gm-Message-State: AAQBX9fD6nSjHo0czVvH9aCMYeTPABFmqgASz68oPAz3VfbanjjLEgSL ttdVYi8bwWuCczCHjNVonZniM30z X-Google-Smtp-Source: AKy350Y+EJ9P86X97cAlZuAQSBUZ2j/fBC7qBA9AL51/M/rL/J53OSUrucT1uYtBsU8u/WDGP78BYA== X-Received: by 2002:a17:902:aa0c:b0:1a1:ba37:d079 with SMTP id be12-20020a170902aa0c00b001a1ba37d079mr1941403plb.3.1680182389489; Thu, 30 Mar 2023 06:19:49 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:902:ac95:b0:199:50f5:6729 with SMTP id h21-20020a170902ac9500b0019950f56729ls1373001plr.11.-pod-prod-gmail; Thu, 30 Mar 2023 06:19:48 -0700 (PDT) X-Received: by 2002:a17:903:228f:b0:1a0:67ef:dc61 with SMTP id b15-20020a170903228f00b001a067efdc61mr28144683plh.17.1680182388404; Thu, 30 Mar 2023 06:19:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680182388; cv=none; d=google.com; s=arc-20160816; b=KkRxuGJ6rbqB3wR6IjXGVH150b0TIpM7HILZQEPqRZ2gK2Tb83fvBzJsvyxPpENROg XdY4tq3c/n0hXP0ya0oLe7RJjoh1Afx52KjQ0MMAOKSkmC2o3HaG7cOUCZd/3Fq/5+oy DchwcikdNYjJMkf5Yo7J/TDd77TV/PAPOVUPE7AKTJRByqtKSGxUfO0e0MEuZ/OCL03I NCaDxZvf1XkrX7Bytq4Zkmkl/B8S9MO8To2nNO8SlLcT1hWvbsFx0fWsfO1HI5IkDAD3 3fr+ryXidtJVd5R0kUlXrDCuFueDXm5+olEZu//OApPbSiP1prjdRnDlCbdVX7PKzkNv lQ4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=sRHEgyUwDyzDOzARH/KbUIOIYBwk/M3j51CvYnIlMgs=; b=g2JjeS/oValimtjghclsEx8euXN9Zfp+ijd4QPTtEc0YnHAHyWJc3VIh4ELEuhoGUT V6Y2lm9e5Zk6nPi233/UY0+py+tXl9btrIhhdviUip9lCj7DP3HV0MGl3xfp+LFkVTK6 r/ttvIm5V6zDRRvtkCkRU/EbIkN/tqdQoZKqbqOGM+BGRl6+dudJ54W8zojBYgid9ily AjlIk/AQ5bCJwBezlSEPSe/N91T/9Bu8tfk18nLoo/4JFZLuGw3VtbQhHqtKsfwMu7S8 hOvEbmnJvcdt3kWCi9Bo/a+DKQAR7QLEpvgwNvlSvkn9ibEH+1VcS1zGgjPJyfGU0KPl iD8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=oRmW925X; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id ij25-20020a170902ab5900b001a2725b4280sor2341245plb.41.2023.03.30.06.19.48 for (Google Transport Security); Thu, 30 Mar 2023 06:19:48 -0700 (PDT) Received-SPF: pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Received: by 2002:a05:6a20:8b82:b0:d9:7fcf:1076 with SMTP id m2-20020a056a208b8200b000d97fcf1076mr22802629pzh.25.1680182388082; Thu, 30 Mar 2023 06:19:48 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c00a:a047:8bc3:c2fc:8dab:d912]) by smtp.gmail.com with ESMTPSA id e15-20020a62aa0f000000b006259e883ee9sm22473622pff.189.2023.03.30.06.19.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Mar 2023 06:19:47 -0700 (PDT) From: Jagan Teki To: Heiko Stuebner , Joerg Roedel , Will Deacon , Robin Murphy , Rob Herring , Krzysztof Kozlowski Cc: iommu@lists.linux.dev, linux-rockchip@lists.infradead.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-amarula , Jagan Teki Subject: [PATCH 3/3] arm64: dts: rockchip: Disable device link for RK3328 VOP Date: Thu, 30 Mar 2023 18:47:46 +0530 Message-Id: <20230330131746.1475514-3-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230330131746.1475514-1-jagan@amarulasolutions.com> References: <20230330131746.1475514-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: jagan@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=oRmW925X; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Rockchip iommu is trying to enable the VOP device at runtime resume however VOP device might enable the iommu during their pm runtime resume operation which indeed leads iommu to use the wrong domain and this leads to VOP iommu page fault. This issue is reproduced if we enable the display in U-Boot however U-Boot is not even touched any iommu register as the U-Boot display uses the simple frame buffer like other Rockchip platforms RK3399, and RK3328 do. rockchip-drm display-subsystem: bound ff370000.vop (ops vop_component_ops) dwhdmi-rockchip ff3c0000.hdmi: supply avdd-0v9 not found, using dummy regulator rk_iommu ff373f00.iommu: Enable stall request timed out, status: 0x00004b dwhdmi-rockchip ff3c0000.hdmi: supply avdd-1v8 not found, using dummy regulator rk_iommu ff373f00.iommu: Disable paging request timed out, status: 0x00004b dwhdmi-rockchip ff3c0000.hdmi: Detected HDMI TX controller v2.11a with HDCP (inno_dw_hdmi_phy2) dwhdmi-rockchip ff3c0000.hdmi: registered DesignWare HDMI I2C bus driver rockchip-drm display-subsystem: bound ff3c0000.hdmi (ops dw_hdmi_rockchip_ops) [drm] Initialized rockchip 1.0.0 20140818 for display-subsystem on minor 0 So, prevent this by enabling rockchip,disable-device-link-resume in VOP node so that VOP enablement for that iommu domain ignored during the rk_iommu_resume call as it assumes it handled iommu device attachment in the VOP itself. Signed-off-by: Jagan Teki --- arch/arm64/boot/dts/rockchip/rk3328.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/boot/dts/rockchip/rk3328.dtsi b/arch/arm64/boot/dts/rockchip/rk3328.dtsi index 6d7a7bf72ac7..7ca83bc844c1 100644 --- a/arch/arm64/boot/dts/rockchip/rk3328.dtsi +++ b/arch/arm64/boot/dts/rockchip/rk3328.dtsi @@ -718,6 +718,7 @@ vop_mmu: iommu@ff373f00 { clocks = <&cru ACLK_VOP>, <&cru HCLK_VOP>; clock-names = "aclk", "iface"; #iommu-cells = <0>; + rockchip,disable-device-link-resume; status = "disabled"; };