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 2BAF7C46467 for ; Wed, 4 Jan 2023 22:05:54 +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:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=AVw3sV2U3rIW3ZMwOUE5uJCDJ9AVHuqEAhGFXIiYyl8=; b=eIUkaNGNpoCnLH M5kztyOS91polKzC/LCGsoSvUZsSgEa0bLX3cjbNGYxY6n9lFTWKMJcEPW0IMoa4WirKhdbzJY7SV pyy2IdXwmSJNGyraNVzKIZQJ4nFiwOhFlOOjKb81s1YimGWR3h6rFAZ1rie7s+nPRILndjAdhWAkE m0X6JNCZwOB5y575RyU+f6NQH6cXW/ceGwB8/mKviaMkn46tbfIzt8ZfduZKw9ak52BLGr7JApN3c EZpmDG6v22tuFtNb1On+6SyQ+vBfmIpyfocytwbUGmWADvkzDBMARj2LkbkJoxkpY+ZketecSs/v3 GL21yklCrmrsl3vM1zzw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pDBsQ-00CKQ9-KX; Wed, 04 Jan 2023 22:04:50 +0000 Received: from mail-ej1-x634.google.com ([2a00:1450:4864:20::634]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pDBsO-00CKIi-Gm for linux-arm-kernel@lists.infradead.org; Wed, 04 Jan 2023 22:04:49 +0000 Received: by mail-ej1-x634.google.com with SMTP id jo4so85992533ejb.7 for ; Wed, 04 Jan 2023 14:04:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=VAgESyffyGfL2EhiYgHo7ieKIsVwn7XJhQmStMSRKhc=; b=phZ4NEuz02LsQ6So2V3GDbdOgwyUdlRwWhE5T2GTNM/a5pN71DO/CDYus16Rv/B0ZK pJ0qqJvDjI4bKk9DQPd/Lrk5Jjy9BrpWHESRd9N09T8gtnRjrW9MoNVa+KtRnr4zLubD 7tTmunNmEQ3JXQcKYJ05+jf/lTcKuELd6zucImxruAGzLylewyGpovnNdY3icMfC3m7E n7hW6kSKL78yD7ihTeiIvHudmokzhrkGqT0vsMGR08nr0JnlWzpLRS9K2VxR0fvV6LYA ZXe2NwMbfNEoNtoJ/Gjw8WW2adAZM36yGRp+BE6Vx39jQA4BQqJJ8ifhw03MCZAgOd1R T59w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding: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=VAgESyffyGfL2EhiYgHo7ieKIsVwn7XJhQmStMSRKhc=; b=ruJikq345TMqL0yLiMqhQHDZBfSZVVywOSoro7sEmxtWr4eKzFZ5C0dd+m8jDzAUiR 8NzmiFRwBp8MvSUOZRoYS1bESK5gkpMpGFQFXNyvZi3Df131v3J7EYsts8yQTYmQd9Qb mu0QKgTcuXol2DeKnPQn0R1yXlwbY2LCcrUcYeyCE1VLkWkBAYdOQ2NKIjnsbwiResml tpjNDKLPQCtW9n8Q/jYozK0283p+juUWWXE6roUinkO845piGcRaC0uGoLhcRwTqQkir u0DoEl3f1sMztSyUSqA2PdyGiyYE2yERPXNV/Ct6/nLAq7BIJIuPJRJQRihZAWGzeBaB EXjw== X-Gm-Message-State: AFqh2kqaFeVJy3Hl66X2DiHPIhaie8f4Mk5gbJ+zpy7H6zVZzDcZ070N KMTDjFENds3KdcMSUgxPZYA= X-Google-Smtp-Source: AMrXdXueZ4a9lP4WZD0oUUo0ysvovdN+8hgWpPMcryijlJBywkg9NIsmu669fcPxczi1QTbkkiMVIw== X-Received: by 2002:a17:906:ecf7:b0:7c4:f6e4:3e92 with SMTP id qt23-20020a170906ecf700b007c4f6e43e92mr49873730ejb.31.1672869885740; Wed, 04 Jan 2023 14:04:45 -0800 (PST) Received: from jernej-laptop.localnet (82-149-19-102.dynamic.telemach.net. [82.149.19.102]) by smtp.gmail.com with ESMTPSA id jg34-20020a170907972200b0084cb8589523sm5336958ejc.139.2023.01.04.14.04.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Jan 2023 14:04:44 -0800 (PST) From: Jernej =?utf-8?B?xaBrcmFiZWM=?= To: Joerg Roedel , Will Deacon , Robin Murphy , Chen-Yu Tsai , Krzysztof Kozlowski , Rob Herring , Samuel Holland Cc: iommu@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Maxime Ripard , Samuel Holland Subject: Re: [PATCH v2 2/6] iommu/sun50i: Track masters attached to the domain Date: Wed, 04 Jan 2023 23:04:43 +0100 Message-ID: <8201525.NyiUUSuA9g@jernej-laptop> In-Reply-To: <20230103010903.11181-3-samuel@sholland.org> References: <20230103010903.11181-1-samuel@sholland.org> <20230103010903.11181-3-samuel@sholland.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230104_140448_630889_78E06469 X-CRM114-Status: GOOD ( 12.31 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Dne torek, 03. januar 2023 ob 02:08:59 CET je Samuel Holland napisal(a): > The refcount logic here is broken. The refcount is initialized to 1 with > no devices attached, so it will be decremented back to 1 when the last > device is detached. However, refcount_dec_and_test() returns true only > when the refcount gets decremented to zero, so the domain will never be > cleaned up, and the hardware will never be disabled. > > Replace the refcount with a mask of masters attached to the domain. The > domain can be cleaned up when the last master detaches. This mask is > also necessary to correctly set the bypass register. > > Fixes: 4100b8c229b3 ("iommu: Add Allwinner H6 IOMMU driver") > Signed-off-by: Samuel Holland Reviewed-by: Jernej Skrabec Best regards, Jernej _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel