Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp720043ybt; Wed, 1 Jul 2020 08:28:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxiebgAf+96oGP7AbjIqx5MA2b/2sFCo6dJD7TCJhDIkNlnUDT2qYe0ChpD4TN8QzTh08ID X-Received: by 2002:a50:8465:: with SMTP id 92mr28826646edp.388.1593617311621; Wed, 01 Jul 2020 08:28:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593617311; cv=none; d=google.com; s=arc-20160816; b=FNi3HwXp2pQqf6g3G4vE+Boyvwc+GvjaWO5+yj4WA/Yp6guJcbgW0rRX3Ta8aBlqQk AnEckl9WZOOq5V1NXurmk6AGKefH5TfoMjCQougFcOX9IX4kOMtsIhIwPGwG1OCGfGWV XrK8uynrcklfg/QcSjwwta6LB7L2K5gNxGouFJ3yhvi4KqLBoHqlT5rYmqXkq860z4Ti W1KV/DmXVmYC2qMLOrfucoRGn+mgNGMzRpOFiq4ICSAF7oW596ar4Z+Os+lCiAf0NoEO a6KSC/Anx6nwcL2I/6bvo7Rhcusmzqeo7A+cAfb5iSXKSMYX9vkij7MeIl8fwCvAt6Gq sn7Q== 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=BmgllQ8+J36sZ6E2F7wMBR9heCnsB5M3ae+V/7tyVUA=; b=SL1Fd61Dvli3lPkErttHM+w7bbQNuhu2rUD1Qs+1gZTr6OiUs9C5WfL1pxarI2gaDO q7rlEP7YIag9/Tz3cocPxcwIwquL71/fUbbrSHw6i2TiFqXRa/HXC79HUuJdsSKTItsq yJvasWdK+VjKcm97lGJlBxi/BHewcbTu2blDrGmMCPNuA+WwcXzRNLPA/BWilbEMqDAG PbMYgZFIPHuGXE/t8QajbD/anZbByRXDXrphwpSDVVDmgsDHfFEFBjoa6iHGVjEWdY6d pOuEAhmABMMu5eCPdQwD/vT1czpm04BM0eCcrJZReDNJdoUO03xC83Je527ljbhl7xWj dhlA== 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 h23si3727149ejx.452.2020.07.01.08.28.08; Wed, 01 Jul 2020 08:28:31 -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 S1732052AbgGAP1f (ORCPT + 99 others); Wed, 1 Jul 2020 11:27:35 -0400 Received: from mga17.intel.com ([192.55.52.151]:54824 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731738AbgGAP11 (ORCPT ); Wed, 1 Jul 2020 11:27:27 -0400 IronPort-SDR: NOxsUyM6MmbHlnm7jiP3nHuMAdKqzpKSn0b1ex//bcm25b6hPfBo30Q6CA0GU//vDFyvHEgS8d DVhc8IqnrGWQ== X-IronPort-AV: E=McAfee;i="6000,8403,9668"; a="126699718" X-IronPort-AV: E=Sophos;i="5.75,300,1589266800"; d="scan'208";a="126699718" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Jul 2020 08:27:23 -0700 IronPort-SDR: nPa2ycF+ijp5yvuIpV1f7tX1wHc9Tlup6E/v0tKvLuDTWXBOf202Bpd5FkC2b6xUbufZmEWSQm JKwDiNtpXz4A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,300,1589266800"; d="scan'208";a="295591655" Received: from jacob-builder.jf.intel.com ([10.7.199.155]) by orsmga002.jf.intel.com with ESMTP; 01 Jul 2020 08:27:22 -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 v3 6/7] iommu/vt-d: Warn on out-of-range invalidation address Date: Wed, 1 Jul 2020 08:33:55 -0700 Message-Id: <1593617636-79385-7-git-send-email-jacob.jun.pan@linux.intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1593617636-79385-1-git-send-email-jacob.jun.pan@linux.intel.com> References: <1593617636-79385-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. 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 6a0c62c7395c..2e1b53ade784 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