Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp3229583ybc; Mon, 18 Nov 2019 11:40:10 -0800 (PST) X-Google-Smtp-Source: APXvYqye6iGoGIsU8nl4CPFR7F1pfmAPntV1287zwuc+xiTuVEfpKDpMrKVgKQeTsCc/xUKhtosd X-Received: by 2002:a17:906:4019:: with SMTP id v25mr29363733ejj.11.1574106009969; Mon, 18 Nov 2019 11:40:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574106009; cv=none; d=google.com; s=arc-20160816; b=sB3cGSUCnsud7sgOeUgVij7VKyPFQUY6TxDMOW04bJNEqT5EonqnRFzgZdmgGw9FYV /EyYIUtxPVdXRu2Ka/mvQGaxMdsgzwdPlOR0jm4wXM0MH4UIo0hfY/iDn2uNXUU8BRn+ ProyZZHogZF0r2im8JrcvnP1plDsg0kR9fJwNsNFswoQQXsxVjTAHXRHF3BoONTOrcte UeNv1eTtJt5XMS/bN2YhmGNhZlbF43w3aLeildfuGhG6ARCH43wDC6nmwJE/CGDB+w9v aH8kWcfdMP3qln9RxEnL8LfPQvsTUc/M24qhCGelqOO3fLHUdUn1hOaKa2zEVTzlvKQL u9GQ== 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; bh=NUvSFaM1ljnf1aFqdktTxulyhgPZJP9EjUs8it9G6pk=; b=o43oVBpRvlGnQpkqAZFRjvx5wzgW7IYPnasrCg+9Ox/RcshdraxAOC+h0ejR4OhWxh JcJ3BScJ1n7nUKtzXvx78A5Lu4SmqSuH+nEKegyvICvXf5vIYiwRKwz1eAcfIIEKycfo zokmNzSi0CDYjTMjCDwQLFmGGDgek130lO3FZoXCLTSER1zYnPbPYar+yRCuPMnjLAyJ mNUHj2Nahj8Tlek6CtHikyE1/gjbhcLjAzw6z0pK9vCSVte8UhW6lRb4+11Fq5Xpvasx Ei+9x98jHMi37NpY6XhuLS1RY3Tbu2YQRE6vFlyGQrIoDQ47iQWFSmo/NO2KpYqQzxgh etVw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id t27si11439321edd.304.2019.11.18.11.39.46; Mon, 18 Nov 2019 11:40:09 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1727097AbfKRTiS (ORCPT + 99 others); Mon, 18 Nov 2019 14:38:18 -0500 Received: from mga02.intel.com ([134.134.136.20]:60276 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726874AbfKRTiB (ORCPT ); Mon, 18 Nov 2019 14:38:01 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Nov 2019 11:37:59 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,321,1569308400"; d="scan'208";a="380760871" Received: from jacob-builder.jf.intel.com ([10.7.199.155]) by orsmga005.jf.intel.com with ESMTP; 18 Nov 2019 11:37:59 -0800 From: Jacob Pan To: iommu@lists.linux-foundation.org, LKML , Joerg Roedel , "Lu Baolu" , David Woodhouse Cc: "Tian, Kevin" , Raj Ashok , "Yi Liu" , Eric Auger , Jacob Pan Subject: [PATCH v2 09/10] iommu/vt-d: Avoid sending invalid page response Date: Mon, 18 Nov 2019 11:42:32 -0800 Message-Id: <1574106153-45867-10-git-send-email-jacob.jun.pan@linux.intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1574106153-45867-1-git-send-email-jacob.jun.pan@linux.intel.com> References: <1574106153-45867-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 Page responses should only be sent when last page in group (LPIG) or private data is present in the page request. This patch avoids sending invalid descriptors. Fixes: 5d308fc1ecf53 ("iommu/vt-d: Add 256-bit invalidation descriptor support") Signed-off-by: Jacob Pan Acked-by: Lu Baolu --- drivers/iommu/intel-svm.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/iommu/intel-svm.c b/drivers/iommu/intel-svm.c index 26a2f57763ec..098c89246593 100644 --- a/drivers/iommu/intel-svm.c +++ b/drivers/iommu/intel-svm.c @@ -688,11 +688,10 @@ static irqreturn_t prq_event_thread(int irq, void *d) if (req->priv_data_present) memcpy(&resp.qw2, req->priv_data, sizeof(req->priv_data)); + resp.qw2 = 0; + resp.qw3 = 0; + qi_submit_sync(&resp, iommu); } - resp.qw2 = 0; - resp.qw3 = 0; - qi_submit_sync(&resp, iommu); - head = (head + sizeof(*req)) & PRQ_RING_MASK; } -- 2.7.4