From nobody Mon Oct 6 01:47:44 2025 Received: from mail-ed1-f74.google.com (mail-ed1-f74.google.com [209.85.208.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 668D0277C9E for ; Mon, 28 Jul 2025 17:53:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.74 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753725221; cv=none; b=YuhOXAuaESYNWgnRoM1ATpqSPvQcMTU4plqQY0J/+pXXG/KwkcgCtlO3EMhU/k4B37dr8JHFgeTjbVs5EygQfPcO7q4o85iZ4zdPdZbH33oxUlD/r+dZLjDRQNEp4e1whTYATZ5GVKr6OpzINsTs21Bxde2vIGPbqyiEcve41qI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753725221; c=relaxed/simple; bh=cc4qIV7R4IboXoEryrgrWSTN4pA0n7UvacWmOG9Xt0g=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=RzhUstk+ZIPlqxH8MSKwI1+6BIVANnCukqupXdaYb6d0wurEysTOMVm1ajiHl9xsW5Kpd+qCZYXfSrnR4G5LMz1zGQG650kabJHO6tnPpHmdq65Z4JdCYBxwIELtLg0Jj/yTSbGCTn00NejD8yHO9HstsMMpYWPvWBDetn95FAI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--smostafa.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=jpOA/iuS; arc=none smtp.client-ip=209.85.208.74 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--smostafa.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="jpOA/iuS" Received: by mail-ed1-f74.google.com with SMTP id 4fb4d7f45d1cf-61525af8a0bso1818648a12.2 for ; Mon, 28 Jul 2025 10:53:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1753725218; x=1754330018; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=R18CRwRipna7yM1UAYryO2eun2b5lSz7TequZZhl+Fo=; b=jpOA/iuS3CoahCz8ZZHW1ZRmwBgtO1tiGWNVYw4XL8IXy7axBH9RbyZ+Up4t7JDmdY XptzuryZtewBFsplLtPxLPOHwsy79alGIcbLhMyQXFL4zlspMbNxPfl2kEvc/EGWg6RT nMHQGqAUbHPZcYNsPykg6wRyEDfgqLoiLug81J1b/awGhrIM9w+r+tA59JIA8YnBGXaO yqzj044/xzhFThOPpFNJUXUARipFPWpHJ6zNzmBzB6258GjSbClG/ZkroylesQTPuDOS vKJ395sJTg/x/S1KEZZkzlwkJWJp8h5fvBdTqvJINA2rQ4DT+cadYM1KPKf+Fi2f6u/z ILxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1753725218; x=1754330018; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=R18CRwRipna7yM1UAYryO2eun2b5lSz7TequZZhl+Fo=; b=FAhxor8R5GhNdSKN2BMYtJVUW0MgUuE0pnNFpxOD5GvamSDTR+mFmOUQR6/0iCGSri SG80z5mjzCtnXa4LXf4lTxkcYzJuvqwGhnU/Uw/e4y4y1LsfafgfY372TdCxoGllbAN3 4CWa0WUaPNv+Y/vaZcGOBE+MFNrjL3p3MLbI+tXb0FYg9D6QUD3MOiMaefULRwdbs9kB ZPJMxmOCofTU25TRPokd/K1z2VO0bztkdEyOXobA9Peb4KTGPDbTfbZoTnaEZRVdwt9i D+88t0RUsirlh+YsE0JGCe/NvHeZL9sq6xOs7YIlLNTRX1he+tWAYf02jcMEeQ/MXRGO iPUQ== X-Gm-Message-State: AOJu0Yw+QBbA4HoR10xqNEQrt+femSX1dw4XhuhE7De7xgg2+8ouhGCa jXK+I+2e3iwV/Q9w6Y+yWOVNGYhtN1oGBWL8d27LtKs9+OftN+XPlUAHz3D78lOCvsEjPda2dJW SYFJmoeMER+hAx0qknwwFqP1LvXTHHCKnps0GxkuTc+224tFJIRrqSzUxCsUI7hKCKrBKijZ++q MpG4mOjZVbyb5uRLJ/IEwjizt6Co3n/3gvcTVQexGPrAzfzOCfMOm7Rc4= X-Google-Smtp-Source: AGHT+IGIrNMQeE/kWCI/brr7kS87BOY/bq6CCQ1xjchC98i6bmhfhF9J/7LevHBGbUwRoLbmWwCwzxtv61jC5A== X-Received: from eddf14.prod.google.com ([2002:a05:6402:354e:b0:612:c149:d25d]) (user=smostafa job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6402:268f:b0:60c:9d90:93c7 with SMTP id 4fb4d7f45d1cf-614f1f12240mr12562721a12.34.1753725217591; Mon, 28 Jul 2025 10:53:37 -0700 (PDT) Date: Mon, 28 Jul 2025 17:52:54 +0000 In-Reply-To: <20250728175316.3706196-1-smostafa@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20250728175316.3706196-1-smostafa@google.com> X-Mailer: git-send-email 2.50.1.552.g942d659e1b-goog Message-ID: <20250728175316.3706196-8-smostafa@google.com> Subject: [PATCH v3 07/29] iommu/arm-smmu-v3: Extract driver-specific bits from probe function From: Mostafa Saleh To: linux-kernel@vger.kernel.org, kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, iommu@lists.linux.dev Cc: maz@kernel.org, oliver.upton@linux.dev, joey.gouly@arm.com, suzuki.poulose@arm.com, yuzenghui@huawei.com, catalin.marinas@arm.com, will@kernel.org, robin.murphy@arm.com, jean-philippe@linaro.org, qperret@google.com, tabba@google.com, jgg@ziepe.ca, mark.rutland@arm.com, praan@google.com, Mostafa Saleh Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Jean-Philippe Brucker As we're about to share the arm_smmu_device_hw_probe() function with the KVM driver, extract bits that are specific to the normal driver. Signed-off-by: Jean-Philippe Brucker Signed-off-by: Mostafa Saleh --- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/ar= m/arm-smmu-v3/arm-smmu-v3.c index 10cc6dc26b7b..801b792dda36 100644 --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c @@ -4353,7 +4353,7 @@ static int arm_smmu_device_hw_probe(struct arm_smmu_d= evice *smmu) =20 if (reg & IDR0_MSI) { smmu->features |=3D ARM_SMMU_FEAT_MSI; - if (coherent && !disable_msipolling) + if (coherent) smmu->options |=3D ARM_SMMU_OPT_MSIPOLL; } =20 @@ -4504,11 +4504,6 @@ static int arm_smmu_device_hw_probe(struct arm_smmu_= device *smmu) smmu->oas =3D 48; } =20 - if (arm_smmu_ops.pgsize_bitmap =3D=3D -1UL) - arm_smmu_ops.pgsize_bitmap =3D smmu->pgsize_bitmap; - else - arm_smmu_ops.pgsize_bitmap |=3D 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, @@ -4522,9 +4517,6 @@ static int arm_smmu_device_hw_probe(struct arm_smmu_d= evice *smmu) =20 arm_smmu_device_iidr_probe(smmu); =20 - if (arm_smmu_sva_supported(smmu)) - smmu->features |=3D ARM_SMMU_FEAT_SVA; - dev_info(smmu->dev, "ias %lu-bit, oas %lu-bit (features 0x%08x)\n", smmu->ias, smmu->oas, smmu->features); return 0; @@ -4794,6 +4786,17 @@ static int arm_smmu_device_probe(struct platform_dev= ice *pdev) if (ret) return ret; =20 + if (arm_smmu_sva_supported(smmu)) + smmu->features |=3D ARM_SMMU_FEAT_SVA; + + if (disable_msipolling) + smmu->options &=3D ~ARM_SMMU_OPT_MSIPOLL; + + if (arm_smmu_ops.pgsize_bitmap =3D=3D -1UL) + arm_smmu_ops.pgsize_bitmap =3D smmu->pgsize_bitmap; + else + arm_smmu_ops.pgsize_bitmap |=3D smmu->pgsize_bitmap; + /* Initialise in-memory data structures */ ret =3D arm_smmu_init_structures(smmu); if (ret) --=20 2.50.1.552.g942d659e1b-goog