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 3A071C54731 for ; Tue, 27 Aug 2024 16:02:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:In-Reply-To:From:References:Cc:To:Subject:MIME-Version:Date: Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=6wQ2MSa/Yka1ALoY04MLbT9l+pHjt3gi4ODGm1S6m9o=; b=YKnSVtG0WdUajrXEk0NUw3obvB qGhXTAzHuenVjLdHS+i48WcV2be9hUZmoasMQ6Om6skDqzpGGd5CdyyUK1seOMo+yG2z0ZvFizp18 3tm0+0a+lfxLBzX8Pe6ywtKX7c4+TzUEFayGnFhBQf4/UG6NHl8kgiVQdk4SY6qGXfz85npAfJYCA 12RtZ3xO+PujFjpMaZ/Fsvgy0FMjvVuy3GIvBuapL5gaEuLUCAJePDPgbM1JEI18wgm6m96FQo6eU VDoroVjGx1FqWmTJ/+SZw4n+7igBEZqOhptEodLkZFlUlHe1Qj67HtlQVmnjHwz2YIaWWRunLmT8Z V+T18F6g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1siyeL-0000000Bzyh-0AZi; Tue, 27 Aug 2024 16:02:29 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1siyZx-0000000Byx4-0ncp for linux-arm-kernel@lists.infradead.org; Tue, 27 Aug 2024 15:57:58 +0000 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 211F8DA7; Tue, 27 Aug 2024 08:58:22 -0700 (PDT) Received: from [10.1.196.40] (e121345-lin.cambridge.arm.com [10.1.196.40]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A0B283F762; Tue, 27 Aug 2024 08:57:54 -0700 (PDT) Message-ID: <3256d9ce-2c10-4cdd-b4c4-358f2c30a9a3@arm.com> Date: Tue, 27 Aug 2024 16:57:48 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v13 06/10] iommu/arm-smmu-v3: Add acpi_smmu_acpi_probe_model for impl To: Will Deacon , Nicolin Chen Cc: joro@8bytes.org, jgg@nvidia.com, thierry.reding@gmail.com, vdumpa@nvidia.com, jonathanh@nvidia.com, linux-kernel@vger.kernel.org, iommu@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-tegra@vger.kernel.org References: <8a2629bb98cabb1be72b32c120bb5ed0114b21bc.1724453781.git.nicolinc@nvidia.com> <20240827130233.GF4772@willie-the-truck> From: Robin Murphy Content-Language: en-GB In-Reply-To: <20240827130233.GF4772@willie-the-truck> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240827_085757_306595_571660E2 X-CRM114-Status: GOOD ( 14.76 ) 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 On 27/08/2024 2:02 pm, Will Deacon wrote: > On Fri, Aug 23, 2024 at 05:10:40PM -0700, Nicolin Chen wrote: >> For model-specific implementation, repurpose the acpi_smmu_get_options() >> to a wider acpi_smmu_acpi_probe_model(). A new model can add to the list >> in this new function. >> >> Suggested-by: Will Deacon >> Signed-off-by: Nicolin Chen >> --- >> drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 18 +++++++++++++----- >> 1 file changed, 13 insertions(+), 5 deletions(-) >> >> diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c >> index afdb8a76a72a..ceb31d63f79b 100644 >> --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c >> +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c >> @@ -4341,18 +4341,28 @@ static int arm_smmu_device_hw_probe(struct arm_smmu_device *smmu) >> } >> >> #ifdef CONFIG_ACPI >> -static void acpi_smmu_get_options(u32 model, struct arm_smmu_device *smmu) >> +static int acpi_smmu_iort_probe_model(struct acpi_iort_node *node, >> + struct arm_smmu_device *smmu) >> { >> - switch (model) { >> + struct acpi_iort_smmu_v3 *iort_smmu = >> + (struct acpi_iort_smmu_v3 *)node->node_data; >> + >> + switch (iort_smmu->model) { >> case ACPI_IORT_SMMU_V3_CAVIUM_CN99XX: >> smmu->options |= ARM_SMMU_OPT_PAGE0_REGS_ONLY; >> break; >> case ACPI_IORT_SMMU_V3_HISILICON_HI161X: >> smmu->options |= ARM_SMMU_OPT_SKIP_PREFETCH; >> break; >> + case ACPI_IORT_SMMU_V3_GENERIC: >> + break; >> + default: >> + dev_err(smmu->dev, "Unknown/unsupported IORT model!\n"); >> + return -ENXIO; > > We probably don't want this 'default' case, otherwise the driver will > need to be updated every time there's a new model. ...although the intent is very strongly that there should never be any new models, because by now hardware should really not be failing to implement SMMU_IIDR correctly. In some ways, having this might help further discourage people from abusing the mechanism and making random stuff up in their firmware :/ Cheers, Robin.