From patchwork Wed Feb 1 12:53:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Philippe Brucker X-Patchwork-Id: 13124420 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 D94DDC636D3 for ; Wed, 1 Feb 2023 14:31:06 +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=iyje/EJ3uQz51AzUlBRW1eeoWtvR7i6k1JDpITPe8x4=; b=2eEFQ2+fGSVmrm DcJmzXVHiuvF9149zZAs6mX6+YgyE3q8TTQchQRzpsJvK57nsoq+k9PgzWRO1wpHLMJkHMjT1R8Yo yA6mYsb36dqRYEXJQbR1h0//gL4NoDiwvrXknfose8Ro7GYzGeKsXrr4PGNHxyPfph9fIediYyG1c pSOgET6Sh4i+cn6+h+OJpohRoiZqg0KvPe4T8HslYhE2Wm3LHTzndnvrLQuqPVdgPH+bKEkRXnSpZ Xw1hy3gkfoSfDeAhFyHJdnyJf4r9o0IVekA2j2Hp3X3daJS/WHkOrWjyDBdoBDUEie4ArulG/KJDC 8zdpxKWimzqyxoC86+5A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pNE7S-00CMds-7o; Wed, 01 Feb 2023 14:29:51 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pNDhi-00CBmy-13 for linux-arm-kernel@bombadil.infradead.org; Wed, 01 Feb 2023 14:03:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:MIME-Version :References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=vFG9Kxksr5XAD5z+jpFTZuXE6wo3TJrZX1lzDDnThIE=; b=jXA9Z1Pz+n/99nCqdEgFRo/A/T yxNZhSFmGylYU1K+lxfGnq1skn4mK6dPWtj/Wp9+hWzKYXIyGLHplsFI3jFNUs5OImoqGdGYqP6wz AIqrU+/63w4LBwjPLagSsmJZrE39iH7cCQOnHY/97U14RmFJ/lhwG2Qys6w21wab3iOE8+shNpZBr ILtC/rZlEk1lLhJcK1RuaA6nFA7H5phOXagINRKoQqfia7oBl7DkMhSwhPuM6nPFUJh5aNp4wxTSr El2VeLZbjcS2Sj5zZaznjped7tWTC6c8ZPjHGJ0o4Qx9haFBk/9W0Rq9frUO3cyZzFGX24oC9AHJq AKJzAY2g==; Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]) by desiato.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pNChg-004m2v-1M for linux-arm-kernel@lists.infradead.org; Wed, 01 Feb 2023 12:59:10 +0000 Received: by mail-wr1-x42c.google.com with SMTP id t7so8870281wrp.5 for ; Wed, 01 Feb 2023 04:59:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=vFG9Kxksr5XAD5z+jpFTZuXE6wo3TJrZX1lzDDnThIE=; b=XQ5yAOTwtSa7tp94IvyGR3xbhNDZa61S076xE+WBkEiPX3SQP4glj9DnCIsmbfPs9u Dv/3/6PfyG17r2c8HIa6nD0O+f+gNGhig98UvWmqpUY/8RShjXUjJLI92xSWYug1OZO3 3kEiXPlErhcHmP2p06hYJWhAkyifML7LCP9PNidG+f4pvYxjzmgP0H4h3YuqsoaHteEG ictCQ+A9VbTIiSFOTJ63N81XZv1l1qoUpOMgH3amdoEH7fyVhbf5znCxC0aewHVSCHd6 hnQSC5sNzfLKD1m8mDLilOrn26EDOE+MdiQHvk5j7E73YHthY6eBH3PGRT2zeT+SQ78R mnQg== 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=vFG9Kxksr5XAD5z+jpFTZuXE6wo3TJrZX1lzDDnThIE=; b=nlERmPallD2JhPRNzAa6cCl7T4kI9pQJnrqSFYnd2R0kN2aNZrxTGNGBZqb8r+3Dct 9zs/49YKpvojECsVwFEvovenEgINUMWKPGxwGQatKisjI1WvwC2AEVDD5xy4dCZsk5Lm vBwPmJ8stoFKKduNCnxFXsiGrPdl+5y1zqE5osZW3FQ4Iz6vXBuPUUHc57XwTzKzKY9+ 1S9tFO5YNEqymJ7r4smhIfeTLYIGfKQe2w66/vDUWfeuIOsw9o78uZJVQh6TS3BLLLDI AQ2mk1U+GAkoxRnaYI0XDtv2LWqPOHWLMwN/rUsBFRWWPxtO0fALh9UWTIPSKgQOC/ec J0XQ== X-Gm-Message-State: AO0yUKX4kk27Yd1syOuwi93mZU+jp9SRVwnFQQSofTC4B9cUYjbZpfpJ fmbaVJaPys/I8sAr+yBNalEKtg== X-Google-Smtp-Source: AK7set/oRWkQRL/1T6Fw11ETCaloaCZVNgIY5U+8Bhq0XoWcFkzYXbslbxbBP9XnuIbhQiQhf0YVZg== X-Received: by 2002:a05:6000:1706:b0:2bf:f2f2:7d68 with SMTP id n6-20020a056000170600b002bff2f27d68mr3107911wrc.21.1675256381425; Wed, 01 Feb 2023 04:59:41 -0800 (PST) Received: from localhost.localdomain (054592b0.skybroadband.com. [5.69.146.176]) by smtp.gmail.com with ESMTPSA id m15-20020a056000024f00b002bfae16ee2fsm17972811wrz.111.2023.02.01.04.59.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Feb 2023 04:59:41 -0800 (PST) From: Jean-Philippe Brucker To: maz@kernel.org, catalin.marinas@arm.com, will@kernel.org, joro@8bytes.org Cc: robin.murphy@arm.com, james.morse@arm.com, suzuki.poulose@arm.com, oliver.upton@linux.dev, yuzenghui@huawei.com, smostafa@google.com, dbrazdil@google.com, ryan.roberts@arm.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, iommu@lists.linux.dev, Jean-Philippe Brucker Subject: [RFC PATCH 28/45] iommu/arm-smmu-v3: Extract driver-specific bits from probe function Date: Wed, 1 Feb 2023 12:53:12 +0000 Message-Id: <20230201125328.2186498-29-jean-philippe@linaro.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230201125328.2186498-1-jean-philippe@linaro.org> References: <20230201125328.2186498-1-jean-philippe@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230201_125908_803085_EE3FEB6C X-CRM114-Status: GOOD ( 14.28 ) 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 As we're about to share the arm_smmu_device_hw_probe() function with the KVM driver, extract two bits that are specific to the normal driver. Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 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 97d24ee5c14d..bcbd691ca96a 100644 --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c @@ -3454,7 +3454,7 @@ static int arm_smmu_device_hw_probe(struct arm_smmu_device *smmu) if (reg & IDR0_MSI) { smmu->features |= ARM_SMMU_FEAT_MSI; - if (coherent && !disable_msipolling) + if (coherent) smmu->options |= ARM_SMMU_OPT_MSIPOLL; } @@ -3598,11 +3598,6 @@ static int arm_smmu_device_hw_probe(struct arm_smmu_device *smmu) smmu->oas = 48; } - if (arm_smmu_ops.pgsize_bitmap == -1UL) - arm_smmu_ops.pgsize_bitmap = smmu->pgsize_bitmap; - else - arm_smmu_ops.pgsize_bitmap |= smmu->pgsize_bitmap; - /* Set the DMA mask for our table walker */ if (dma_set_mask_and_coherent(smmu->dev, DMA_BIT_MASK(smmu->oas))) dev_warn(smmu->dev, @@ -3803,6 +3798,14 @@ static int arm_smmu_device_probe(struct platform_device *pdev) if (ret) return ret; + if (disable_msipolling) + smmu->options &= ~ARM_SMMU_OPT_MSIPOLL; + + if (arm_smmu_ops.pgsize_bitmap == -1UL) + arm_smmu_ops.pgsize_bitmap = smmu->pgsize_bitmap; + else + arm_smmu_ops.pgsize_bitmap |= smmu->pgsize_bitmap; + /* Initialise in-memory data structures */ ret = arm_smmu_init_structures(smmu); if (ret)