Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp577947ybt; Mon, 6 Jul 2020 17:08:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJylxHiJH2rDp14ReSMYqN1vC+SeFbQp5c/qKouMZeppq1kDSnAdldaNFbterNU6Srn+skhG X-Received: by 2002:a17:906:5909:: with SMTP id h9mr43445278ejq.501.1594080518011; Mon, 06 Jul 2020 17:08:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594080518; cv=none; d=google.com; s=arc-20160816; b=DRFSXjBGEXUSDyUA8/3ZsSswz1mBsyTXVOZh2RXngB91KiaO1UmKfhLz1HcV51uQxY bPohrzx11BkKp8+O4Pn2Ih15kC0XxkvnbF1eXH9NUVkMToJBBsF8RVgTHuVi2XbgZoYL 4vXGIKFyA3IFab+Iun7+IG1+fVThMYR2zWtqb6TO2X8JEJd4jKX9WAGGDC7YD83bJ8Cw 2KJT4jXiCpFiFJtzmF8BhnJuc3EcdgLp2MuoovDT/HxknR1zQ7h6hsKxyKH3HwbR3bMQ qz4O5kNw6nfSOcWkT/JWUHkn3909wMMvytph7kvRh9YtrnAsWkuYXnL+rHh0JTxJr8DT o30g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:ironport-sdr:ironport-sdr; bh=Es+UcspB6DKGF/kijbtcecMjiXqNS2T6wCN6UBMnIzo=; b=hCwOJL+n3ayh1d00oabmz6dHVnXD/4bzq6T4+IJ6elWXnOfLiZnTbS1qnI8IV2HAqq NUM7oSW93Y2EyAa0fbq7a/K2uZhIl+vo5JQKt4GOTYl851Pf7phll/+P87cvVR2098L6 tqefgPLFW+2L3kFGv0UiU8iBfxm8Lt96zmnwhEGGfuXRovVtyl9vcaNkRF+ap3433Anx Wssrxe/5C4ejkNvEfXVgmT1oL3bAsE02JU7fu0gKNure82B2MciI1gtf9zOwedHMn1Jp d99O5MCLMRv+RW9hGkS6/nT6MEcQMqBfEEtqhHl5tf9hMy3sjaEqKX23OA8slQGRnvH2 ew0A== 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p7si13984831edm.514.2020.07.06.17.08.15; Mon, 06 Jul 2020 17:08:38 -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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727097AbgGGAGj (ORCPT + 99 others); Mon, 6 Jul 2020 20:06:39 -0400 Received: from mga07.intel.com ([134.134.136.100]:18975 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726951AbgGGAGU (ORCPT ); Mon, 6 Jul 2020 20:06:20 -0400 IronPort-SDR: dAXuSvwy+Dncb/Hc0kORXwzox6vMmFvm6Cb6Gnc5DJ3hiMnmXf6AccZMGMRsqcBcF+zkB2XMBP /IW5yRWufWzQ== X-IronPort-AV: E=McAfee;i="6000,8403,9674"; a="212492293" X-IronPort-AV: E=Sophos;i="5.75,321,1589266800"; d="scan'208";a="212492293" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jul 2020 17:06:17 -0700 IronPort-SDR: NORpXiscpzAgT3JuqHHMG4Q6991N7MfI+GqnDOm44Cw/YvAOWrfjFXnmaxwolubNBhRjAJ+RLm JoEVKbyNJ5Fg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,321,1589266800"; d="scan'208";a="456913827" Received: from jacob-builder.jf.intel.com ([10.7.199.155]) by orsmga005.jf.intel.com with ESMTP; 06 Jul 2020 17:06:17 -0700 From: Jacob Pan To: iommu@lists.linux-foundation.org, LKML , "Lu Baolu" , Joerg Roedel , David Woodhouse Cc: Yi Liu , "Tian, Kevin" , Raj Ashok , Eric Auger , Jacob Pan Subject: [PATCH v4 6/7] iommu/vt-d: Warn on out-of-range invalidation address Date: Mon, 6 Jul 2020 17:12:53 -0700 Message-Id: <1594080774-33413-7-git-send-email-jacob.jun.pan@linux.intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1594080774-33413-1-git-send-email-jacob.jun.pan@linux.intel.com> References: <1594080774-33413-1-git-send-email-jacob.jun.pan@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org For guest requested IOTLB invalidation, address and mask are provided as part of the invalidation data. VT-d HW silently ignores any address bits below the mask. SW shall also allow such case but give warning if address does not align with the mask. This patch relax the fault handling from error to warning and proceed with invalidation request with the given mask. Fixes: 6ee1b77ba3ac0 ("iommu/vt-d: Add svm/sva invalidate function") Acked-by: Lu Baolu Signed-off-by: Jacob Pan --- drivers/iommu/intel/iommu.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c index 3bf03c6cd15f..c3a9a85a3c3f 100644 --- a/drivers/iommu/intel/iommu.c +++ b/drivers/iommu/intel/iommu.c @@ -5439,13 +5439,12 @@ intel_iommu_sva_invalidate(struct iommu_domain *domain, struct device *dev, switch (BIT(cache_type)) { case IOMMU_CACHE_INV_TYPE_IOTLB: + /* HW will ignore LSB bits based on address mask */ if (inv_info->granularity == IOMMU_INV_GRANU_ADDR && size && (inv_info->addr_info.addr & ((BIT(VTD_PAGE_SHIFT + size)) - 1))) { - pr_err_ratelimited("Address out of range, 0x%llx, size order %llu\n", - inv_info->addr_info.addr, size); - ret = -ERANGE; - goto out_unlock; + pr_err_ratelimited("User address not aligned, 0x%llx, size order %llu\n", + inv_info->addr_info.addr, size); } /* -- 2.7.4