Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1055141ybh; Thu, 16 Jul 2020 01:43:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzHLQiCUApOb7GCe2irK1r4GS3hXYQNCF4LRTcoW1Onk/LvlggRmRCFjRgSUEyrcvbxCIYv X-Received: by 2002:a17:906:d79c:: with SMTP id pj28mr2571706ejb.397.1594889019121; Thu, 16 Jul 2020 01:43:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594889019; cv=none; d=google.com; s=arc-20160816; b=rT4B8P4zZXq2TG2+XEAEVxmhvcUxYg+qMVM3bI1dqkJ87AXUdIiO8JR2u7RDXvppLD 7By629yzlVJTBPzjjn029UrhVfVOACntGb5RgxddRTq+tHKyj/fLwAFk5bwGzZsRv3Za wl2Ll7fHyAWfBeEY/OYUKe4l2i6+SwjEPCQQ1cGrFjjKkalsHPk9ndL7ceuiNQtpsCOX +iJXz2bCy2NO7WVlmUfjkcCBxBP7abKb2PJBkh59fcQeqObCEm46p4B8RkRhWvhVof7g utlvf5tzqEz5zY8riXRmAs4QAf4LL+1Lc/mwZyTpZwUtbmJ8CGnbY3pJER8RdFZYX1EY USWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=3JoxqAmTFw434/QVJaUcaRG4zXwjowYpW92aIp44qUc=; b=xiIORkzMGVNtSm0u48NngYPzSMLCJNP0/uuvYzpvEQvimnuN0M+1ntEgdtazhXu6e7 Eqbv7fEj33K8AVrA27cWIK8z8Ha7LHFwU3dlqg2hnjDZ8SwJV2Y40HfbCOz/Mr5zzZXU IaTdxn1nyqSTOe9omCGQxUe+xzZbmwDQpqOmR0wtL3y0/g1AAyUZZuAUw3nR5Vos++ih SG0VCb0Z2HBtAICf144ItvD05DaC5oiqU+xvMIkgIm3iV4TaTVinWMl5eUTwGfs9dSeU r5T8yv11tMZ2NcV6z+N/rkaNVuNEkoSrcFAq5Tkk37gz/3W8ULUHNoaEnkg3T7YDLZLN ynLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=itth0U3X; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cm10si2881117edb.208.2020.07.16.01.43.16; Thu, 16 Jul 2020 01:43:39 -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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=itth0U3X; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727032AbgGPIk7 (ORCPT + 99 others); Thu, 16 Jul 2020 04:40:59 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:42518 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725921AbgGPIk7 (ORCPT ); Thu, 16 Jul 2020 04:40:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1594888857; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3JoxqAmTFw434/QVJaUcaRG4zXwjowYpW92aIp44qUc=; b=itth0U3XqylnOlsFoxH4olvInbkO5+tBOl1EpPuiNx7a7s31w6h/VFvL6WaoDTyW8wN53V /r8AUVOEO+QjEA8nndoMOCZpdzTFxazGw41JTk26uIPxE0IETrJea1IH4DmzWRtaubh8XQ lyFW6kUDhmULmOHnVwsRQeQakXBqWnM= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-369-Z6Si8xQgPLCeaoFso_z7uQ-1; Thu, 16 Jul 2020 04:40:54 -0400 X-MC-Unique: Z6Si8xQgPLCeaoFso_z7uQ-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6ED61107ACCA; Thu, 16 Jul 2020 08:40:52 +0000 (UTC) Received: from [10.36.115.54] (ovpn-115-54.ams2.redhat.com [10.36.115.54]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 362D274F64; Thu, 16 Jul 2020 08:40:49 +0000 (UTC) Subject: Re: [PATCH v4 6/7] iommu/vt-d: Warn on out-of-range invalidation address To: Jacob Pan , iommu@lists.linux-foundation.org, LKML , Lu Baolu , Joerg Roedel , David Woodhouse Cc: Yi Liu , "Tian, Kevin" , Raj Ashok References: <1594080774-33413-1-git-send-email-jacob.jun.pan@linux.intel.com> <1594080774-33413-7-git-send-email-jacob.jun.pan@linux.intel.com> From: Auger Eric Message-ID: <8a0a2896-74f9-94a9-f401-c46d9d157023@redhat.com> Date: Thu, 16 Jul 2020 10:40:48 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: <1594080774-33413-7-git-send-email-jacob.jun.pan@linux.intel.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Jacob, On 7/7/20 2:12 AM, Jacob Pan wrote: > 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 following your replies on my v3 comments, Reviewed-by: Eric Auger Thanks Eric > --- > 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); > } > > /* >