Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp673795pxu; Wed, 14 Oct 2020 10:42:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzB8ZXiosR7jwVA+ygkNDiWnpN6gtI6WhqDqTEHsdgPM41kz4YlP0pJWsGwft9zV3JefwIy X-Received: by 2002:a17:906:d8b6:: with SMTP id qc22mr190366ejb.196.1602697328131; Wed, 14 Oct 2020 10:42:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602697328; cv=none; d=google.com; s=arc-20160816; b=iq/rdsFjwFSdaMmiSt089cEU7gACblozIwbP7NSGEIkcBOuGHNxtfwV9bPo+mleQm4 ptAQkWgGR+iHCqvrkdk7gOMuvEwY5N+UbOGaWogENBhVzOdnAdDBkX+QqHlrzoRwKKDe V7Bt+QpkMwUKdC6bkMK5sRBmLW7DCMWb5jHs461Gc4hRWYmyEBmwTlAynvoy1P+TiKqz Xqa3tGt9n7oL3EBg498Z1qP7xLaMimxawUz9Br4H8yoXEQ4xmK1gV9O+9DelfVEXcLym o+4kfa8AJh5itXYT3Ixskf+u/9x3a1xDsIL7KgTRo+4nyho9WvPjvgu3UjGG70k7HGmA ibEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=GbhKGV5Fc7MRxfW1yEvrX35gH0GKCrfV3nhxeXXPt5Q=; b=kJxCxKuHpXJfK4nlGtBJ9xlTF9uAKh4R11yI5VnfSdp+q11+en55C+jNQopkqSWqCw VzmL1THpKTxGo8QH8997gb7UmZrMS0COiZv3eoszn9BLRPsaT+5IBByRDH/R2C1Glf9A 1anA0igb46mFOcsiuowJjGHWbkGvXpNRBjUXqi625WDluRYIBgWsCt3GvjgCH+6SqWi7 wmZK9K26AkuRlMOE/IBaJzIfMjte4cHE6YXkT/4V09lAEqjO6LId2S85klpybGbzVPMv A7B73oK9iOR6IU1RQjpaFqOn5E+fE/d4KZzUvKQvzCii1HMxGccFNvLhOlJjfPMn4X2U MHCw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t18si230286eje.652.2020.10.14.10.41.45; Wed, 14 Oct 2020 10:42:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727783AbgJNPxA (ORCPT + 99 others); Wed, 14 Oct 2020 11:53:00 -0400 Received: from foss.arm.com ([217.140.110.172]:52200 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726439AbgJNPw7 (ORCPT ); Wed, 14 Oct 2020 11:52:59 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 21EBFD6E; Wed, 14 Oct 2020 08:52:59 -0700 (PDT) Received: from [10.57.48.76] (unknown [10.57.48.76]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 2F2A23F71F; Wed, 14 Oct 2020 08:52:57 -0700 (PDT) Subject: Re: [PATCH 4/8] iommu/arm-smmu: Support test_smr_masks implementation detail deviation To: kholk11@gmail.com, will@kernel.org Cc: joro@8bytes.org, bjorn.andersson@linaro.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, marijns95@gmail.com, konradybcio@gmail.com, martin.botka1@gmail.com, linux-arm-msm@vger.kernel.org, phone-devel@vger.kernel.org, linux-kernel@vger.kernel.org References: <20200926130004.13528-1-kholk11@gmail.com> <20200926130004.13528-5-kholk11@gmail.com> From: Robin Murphy Message-ID: <00afa417-d897-22ee-25a5-cba1bf96c669@arm.com> Date: Wed, 14 Oct 2020 16:52:56 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:78.0) Gecko/20100101 Thunderbird/78.3.2 MIME-Version: 1.0 In-Reply-To: <20200926130004.13528-5-kholk11@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020-09-26 14:00, kholk11@gmail.com wrote: > From: AngeloGioacchino Del Regno > > At least some Qualcomm SoCs do need to override the function > arm_smmu_test_smr_masks entirely: add a test_smr_masks function > to the implementation details structure and call it properly. > > Signed-off-by: AngeloGioacchino Del Regno > --- > drivers/iommu/arm/arm-smmu/arm-smmu.c | 6 ++++++ > drivers/iommu/arm/arm-smmu/arm-smmu.h | 1 + > 2 files changed, 7 insertions(+) > > diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu.c b/drivers/iommu/arm/arm-smmu/arm-smmu.c > index 09c42af9f31e..446a78dde9cd 100644 > --- a/drivers/iommu/arm/arm-smmu/arm-smmu.c > +++ b/drivers/iommu/arm/arm-smmu/arm-smmu.c > @@ -977,6 +977,12 @@ static void arm_smmu_test_smr_masks(struct arm_smmu_device *smmu) > > if (!smmu->smrs) > return; > + > + if (smmu->impl && smmu->impl->test_smr_masks) { > + smmu->impl->test_smr_masks(smmu); Meh, this doesn't need a special hook - just have ->cfg_probe() initialise your masks early and bail out here if smr_mask_mask is already set. You could actually bypass this test as-is by marking all your SMR entries as valid, but that's likely to cause far more problems elsewhere than it solves here ;) Robin. > + return; > + } > + > /* > * If we've had to accommodate firmware memory regions, we may > * have live SMRs by now; tread carefully... > diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu.h b/drivers/iommu/arm/arm-smmu/arm-smmu.h > index d890a4a968e8..2cd3d126f675 100644 > --- a/drivers/iommu/arm/arm-smmu/arm-smmu.h > +++ b/drivers/iommu/arm/arm-smmu/arm-smmu.h > @@ -387,6 +387,7 @@ struct arm_smmu_impl { > int (*cfg_probe)(struct arm_smmu_device *smmu); > int (*reset)(struct arm_smmu_device *smmu); > int (*init_context)(struct arm_smmu_domain *smmu_domain); > + void (*test_smr_masks)(struct arm_smmu_device *smmu); > void (*tlb_sync)(struct arm_smmu_device *smmu, int page, int sync, > int status); > int (*def_domain_type)(struct device *dev); >