From patchwork Fri Mar 31 03:31:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chunyan Zhang X-Patchwork-Id: 7509 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp297193vqo; Thu, 30 Mar 2023 20:44:50 -0700 (PDT) X-Google-Smtp-Source: AKy350bd3i3T1BoTdl1aoPsLuw7N8PKMogSDLf0bmiUo3aP3v61ZVTkbVqlIE4Ppy02kynzULmIR X-Received: by 2002:a17:906:5812:b0:931:85f8:6d00 with SMTP id m18-20020a170906581200b0093185f86d00mr26015245ejq.47.1680234290037; Thu, 30 Mar 2023 20:44:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680234290; cv=none; d=google.com; s=arc-20160816; b=Maatgx3SfIuyFa3hedJd6QA1mUuMie3UdS5f+br8Vyj1skX5bRBXlIPY/CmN87tzrg IFI3HWdH7tK3sxSexiWnVExFKycAviIhWjPrXAvNYcUlVYymdpPv/Q80elD0Qu8eGVc6 YJthnx7ahZV21gcap24POH4YAQ+qHQoj7bAjH6vYniy7638salSlyFmzv8/X9k1FCdAY JV3kNcSRhnxJutdbOMB7iwBfZ6XmnieTRFnodQz5hYA8bMrCK1zX6Wxk+i5A+E87/NmU TaNjfzncrXdzVwMhGpidFo9OxCP8zDDcfQ+ExYniLqJpJuqJSRi56X6zQhCEMN50OxZS o4wQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=f0dyJHBuK5UpoDUR2HtwiB0N1zgJU2RE6kdVXBTWcZE=; b=xVsk3ioL3J6ZJt8DNmvP8urOSI6nvMiyXKmVxh+gPgZuWe8ySYQHJ6n33miNI8JxqK DjkSwc0SOPMFKQMcN5X1Xi2sDg2B6zHJYhYC2rpjPZrapL+UpPZWHtg8MN8qSrBHgLDB rlHc7Pmehd+f4OBo4BQCI6XApRj8QSfYwrr782s+UdCi1Q3A968HpYUuuzo7HOSJCDCr QVEWnX0eO1K/8E879ZYUKGh7+f6BPG9atnIyOA3lXlBvKYEIXVbB37gePSnOVOiqgvIr 7knoX7BWUM6WLKzn2OTZ/Qu8ez4ZrDj+LtG0vz9PPT6AJyX6Xsobq+ECYFfCkGttJSPA suSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=jND5ce5J; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g14-20020a1709063b0e00b0093346a7c3c4si1057999ejf.641.2023.03.30.20.44.25; Thu, 30 Mar 2023 20:44:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=jND5ce5J; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229629AbjCaDbo (ORCPT + 99 others); Thu, 30 Mar 2023 23:31:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41660 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229505AbjCaDbn (ORCPT ); Thu, 30 Mar 2023 23:31:43 -0400 Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D23C2CA18 for ; Thu, 30 Mar 2023 20:31:42 -0700 (PDT) Received: by mail-pj1-x1036.google.com with SMTP id r7-20020a17090b050700b002404be7920aso20045074pjz.5 for ; Thu, 30 Mar 2023 20:31:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1680233502; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=f0dyJHBuK5UpoDUR2HtwiB0N1zgJU2RE6kdVXBTWcZE=; b=jND5ce5JWkxV0kSqsZnPmOZC5F+jlDguHcuLWv0PtRKqc0xvdyrkCYfdLOd5wLTf0I 4f6QOAAEBkUWLxLk+ubfelg6JyUSlWmeVhl6P0hkLnBnoiXbC21BxjBNErX2WoZFzXjI mMPx5i1TgomZRiLJhti472rzFjRjMs78zQo6DboaN4OZaWclZRlviF+5fFQ9N7tbYYOq ZH0rf/Z1+ifs+NYKnKWRoX9AxH4gTrFeCjxMI7Z6q/SOLbig8zWOec041Yq0O6odTKiT jsRK931W+lbOKHwIhflL7hc003WbXxxJ6TytRSXi2ehFRSZ0oPVx48mb4EjT/GUp5+69 OXUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680233502; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=f0dyJHBuK5UpoDUR2HtwiB0N1zgJU2RE6kdVXBTWcZE=; b=xqqUEQKxlwqTitV9SB+DfPz4WJxiNK+PtaZZJdUAumspLPovxWapoNSWQbfbqcVq1m 74mf7MKx9v6cQZxt8tFCMc4pLNPTXo8j3Nj8aReLF5K4Rb3aXKizSLqeiE0KFBQ1fqgD q15TZH74ad9mOFyYwbLGlc/aOKy7QL97OP3B2BNGWWwPJMTsDpx/ZafGpgXnbA1mhq6t IbAlvmr6rJuMuW+wNO3vwgPa8DlT2eYNeDlPkDaeONYqMe2OMoTQZDWG5CjyJoog8be2 gf3qAt89+cvEYTbNlBKgrFa2lpuGDsf+nHDvCfb86WJ39saPZWJXdsuk7Sir4Z7/9iBR SKqQ== X-Gm-Message-State: AAQBX9cNoBefWDjm1OEBajqfD0wlsxfMDwbD5OLcvPJM+YGdvrkaA+wm txS1pTHoObHeXX0ILoME6a0= X-Received: by 2002:a17:903:32c7:b0:199:4be8:be48 with SMTP id i7-20020a17090332c700b001994be8be48mr9694702plr.19.1680233502317; Thu, 30 Mar 2023 20:31:42 -0700 (PDT) Received: from ubt.spreadtrum.com ([138.113.14.245]) by smtp.gmail.com with ESMTPSA id p4-20020a170902eac400b001a239325f1csm449128pld.100.2023.03.30.20.31.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Mar 2023 20:31:41 -0700 (PDT) From: Chunyan Zhang To: Joerg Roedel , Will Deacon , Robin Murphy Cc: iommu@lists.linux.dev, Baolin Wang , Orson Zhai , Chunyan Zhang , Chunyan Zhang , LKML Subject: [RESEND PATCH V3 0/2] Add reattaching support and fix memory leak issue Date: Fri, 31 Mar 2023 11:31:22 +0800 Message-Id: <20230331033124.864691-1-zhang.lyra@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761853350906577433?= X-GMAIL-MSGID: =?utf-8?q?1761853350906577433?= From: Chunyan Zhang V3: * Split into two patches; * Added support reattching an existing domain; * Release DMA buffer only when domain freed. V2: https://lkml.org/lkml/2023/3/7/1717 * Added some comment in sprd_iommu_attach_device() for the reason of calling sprd_iommu_cleanup(). V1: https://lkml.org/lkml/2023/2/10/198 Chunyan Zhang (2): iommu: sprd: release dma buffer to avoid memory leak iommu: sprd: Add support for reattaching an existing domain drivers/iommu/sprd-iommu.c | 54 +++++++++++++++++++++++++++++--------- 1 file changed, 41 insertions(+), 13 deletions(-)