[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] arm/smmu: Complete SMR masking support


  • To: Michal Orzel <michal.orzel@xxxxxxx>
  • From: Rahul Singh <Rahul.Singh@xxxxxxx>
  • Date: Thu, 12 Sep 2024 15:59:25 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=arm.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com])
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
  • Arc-message-signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=9KcpM2rGC6e/1zKMkkuAjzgZ40IaEzS9F0fv4HAySOo=; b=w8JPDYqxAZuxaJ1juMrXI92tYEtU74pT88wiNKm9L15zoIB4lh9CA9ZgOHto/Lzf7L5Oo099XK6IrxRBI5C7ukHCca4UVSC8L1G31fYH72LAff7bI37UCdIDFwTcFFrqv5ghHM4+nY3GKQF8SFPVVyQas7q5yLXPPEFzbqgp30JZRoxHhhinuK66Hfoh8fFKEJIcQJQU/XcgYGUwuxdNE7mGVDE+4z+HTnx8rJqDYmvyGUTY9YUICUOQYAasgKksOAvgen7pBxjLxzHDeOqNFbYzJlnO9kU/QthQNg3UcwNf/P0TNqJkR2P32CuiRBcLs5HMekyHwyWvjWM9C0nOPw==
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=9KcpM2rGC6e/1zKMkkuAjzgZ40IaEzS9F0fv4HAySOo=; b=eF/LOX7Yf0796R7Mc2Qudj4E6M1C7RUiEuc7l5S+t0c124GPDAuw+ETTuK9l8t5SfSrDIeTc8aKNFnaTfRXliNsmVTcUz6kXdFRm8trqUh1eWpd3bQILpPv4uv4CihpYq6nVU7Ub5Se2LGAMmhoajE0vuPxWhETwprHTswKpm98cTu7AGu/GS7AquiFu9UkgYDkrkAjCKdN82kOS8b7nJXPrL9VakH8P8aaJuad+VcLg0fyNLWTn0Wx4W6kUqFnOG+nZ4xI3WmeyPhMIlm5Egge4BSaeXLr71zqoqMpbhr5i6vnSq+lOT7j/hD1SSb9ESO8bOlzWfGwKAbfOYzynsg==
  • Arc-seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=IPKvHRaaQagJb5GeaXSQc7EHNYOOpGpKm7IGM/WCj7Mu6UZ6hKWLF7KcieIvR1/fkyeBAfxYhVgqqX4DHXEZB6lGqdjMoYvg3yowbzzEuJ6dR1/gU5XWLo/il2icEdvME5BQRCYLuJKHpOJGKfn6tVFKUI95YdatvUG41RsiYWTvF35xe1+4YDkzIDTQ6pb+smTrqJklKEcMZFY6Iz11+1sxHH/yKZH+r8ZmsEdzbBmVr5r/c5bfn/opvhsXBj4CLnTvuddT8dKHAxf/PentHSKKdQ3/MpZYtFtjlHvzAkc7f86DmuRQ5N8lqVhUBHZDVo5rFPxOS3uELb3t2ID1kA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=BFJaOP61cqzU7cmx57L6h3Zd5RtKxar3EYHdMZm9fz3dERg83K9QAxwtBsp9sfJa08g1bof49siVBhicY0g4RFIaMZ3ghUSrOQO6yO6Uj1+xKa+lU28hjzLSDol0A6386whCDkVX6huUkVqdlK0dIK7/d6MX4O+whCOTIzSSNIl3xXGlTpzrfS/qFbwF3Xp1jvbgbkNChqMSwmXeowB1kaWbjtvGIAwEnm9guzZeQhlprKXKwrbUOwTNvBJfr7ESj4MRvOKFawqA3Or/BIOvITjdBShWQpbVOqaZx5yCX9XUsYw5zTNLVLvYJhIEAWLw2JNsjpIWFJF1e/+mT3QiKw==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Bertrand Marquis <Bertrand.Marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Thu, 12 Sep 2024 15:59:56 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Thread-index: AQHa/sgroXTHOnPTlE6Mlgy4MozhabJUW8aA
  • Thread-topic: [PATCH] arm/smmu: Complete SMR masking support

Hi Michal,


> On 4 Sep 2024, at 1:43 PM, Michal Orzel <michal.orzel@xxxxxxx> wrote:
> 
> SMR masking support allows deriving a mask either using a 2-cell iommu
> specifier (per master) or stream-match-mask SMMU dt property (global
> config). Even though the mask is stored in the fwid when adding a
> device (in arm_smmu_dt_xlate_generic()), we still set it to 0 when
> allocating SMEs (in arm_smmu_master_alloc_smes()). So at the end, we
> always ignore the mask when programming SMRn registers. This leads to
> SMMU failures. Fix it by completing the support.
> 
> A bit of history:
> Linux support for SMR allocation was mainly done with:
> 588888a7399d ("iommu/arm-smmu: Intelligent SMR allocation")
> 021bb8420d44 ("iommu/arm-smmu: Wire up generic configuration support")
> 
> Taking the mask into account in arm_smmu_master_alloc_smes() was added
> as part of the second commit, although quite hidden in the thicket of
> other changes. We backported only the first patch with: 0435784cc75d
> ("xen/arm: smmuv1: Intelligent SMR allocation") but the changes to take
> the mask into account were missed.
> 
> Signed-off-by: Michal Orzel <michal.orzel@xxxxxxx>

Reviewed-by: Rahul Singh <rahul.singh@xxxxxxx>

Regards,
Rahul

> ---
> xen/drivers/passthrough/arm/smmu.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/xen/drivers/passthrough/arm/smmu.c 
> b/xen/drivers/passthrough/arm/smmu.c
> index f2cee82f553a..4c8a446754cc 100644
> --- a/xen/drivers/passthrough/arm/smmu.c
> +++ b/xen/drivers/passthrough/arm/smmu.c
> @@ -1619,19 +1619,21 @@ static int arm_smmu_master_alloc_smes(struct device 
> *dev)
> spin_lock(&smmu->stream_map_lock);
> /* Figure out a viable stream map entry allocation */
> for_each_cfg_sme(cfg, i, idx, fwspec->num_ids) {
> + uint16_t mask = (fwspec->ids[i] >> SMR_MASK_SHIFT) & SMR_MASK_MASK;
> +
> if (idx != INVALID_SMENDX) {
> ret = -EEXIST;
> goto out_err;
> }
> 
> - ret = arm_smmu_find_sme(smmu, fwspec->ids[i], 0);
> + ret = arm_smmu_find_sme(smmu, fwspec->ids[i], mask);
> if (ret < 0)
> goto out_err;
> 
> idx = ret;
> if (smrs && smmu->s2crs[idx].count == 0) {
> smrs[idx].id = fwspec->ids[i];
> - smrs[idx].mask = 0; /* We don't currently share SMRs */
> + smrs[idx].mask = mask;
> smrs[idx].valid = true;
> }
> smmu->s2crs[idx].count++;
> -- 
> 2.25.1
> 


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.