Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp5649832img; Wed, 27 Mar 2019 12:26:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqzw/GBzl8UIQr9JfjFsWsQBjmfPyUlE7Z61gfUt07pqIXrcksv8P5e+Kf+ak8FyAQTMFev6 X-Received: by 2002:a17:902:8697:: with SMTP id g23mr39714284plo.30.1553714773628; Wed, 27 Mar 2019 12:26:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553714773; cv=none; d=google.com; s=arc-20160816; b=plEOoYR6nCOarFqTL9mGiK/PcpNh39ApTV0dzun+xqZVqbYNZQV88JJzeQYaW66fQb dsygtnn/TbnswYydNC3Rc0AA+jKRnKd6g39HWwX8KN5kARWs/kpjRoCG1fVG9LZ224wn lCi7f+8QQPpOpBxIujHa6VY63C2atLPoXuWy5kA/3adKjpcirfC1YuLqmFKlWy9vE9Ov 9bjSzm6fFRPmNRgJ0fC1nOczSsWMOs7Bsn8rmi8H2yujOz4lrtyG/JccEWY4qL+yZAaL cXO10bW6wUCg+toqvgc+WbD9C/FTWWj+rb5QO/HjLCuJI5ARK6AolvmzBIYSDkJGa7nB En5w== 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:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=9ZW0CfnqKrBQ0sJPL14aVv2XqtDpaWioAQlsDdb/5WE=; b=SZOKfesXYoX3M61Ak3kCpRmLTHjg425q2lrl5om4GVSw0DCAavepZScCuIMgFjFiLA srW7FgrXxIgMKpGIzrpiljChi5F1QDghVvW7MWaK7OsBNA9SeFYa2RMWxTLo+uwhnyB0 nzizU3HFuEMk8FAGiY3pfCcekwG2Tu06HBs07SaWmPLkQjWDl8v30oBmSsBIiKFvbeP5 MsIhPSmTJZWUslAQ1lOaoH9oZNKnO0mVp2grqOv0ZJo7LRQGNS6KfizyZrG7DoLhKfoQ qf0uF6UiV2fGlbAgj2z9pJHzGLh7CF9dje1TLhUQepED+h1+0QGxBZUHfy+wgegyfHAQ 3T5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Qx0FVn+F; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 61si20823364plr.153.2019.03.27.12.25.58; Wed, 27 Mar 2019 12:26:13 -0700 (PDT) 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; dkim=pass header.i=@kernel.org header.s=default header.b=Qx0FVn+F; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387904AbfC0TZZ (ORCPT + 99 others); Wed, 27 Mar 2019 15:25:25 -0400 Received: from mail.kernel.org ([198.145.29.99]:46364 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387652AbfC0SFR (ORCPT ); Wed, 27 Mar 2019 14:05:17 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9DB052075C; Wed, 27 Mar 2019 18:05:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553709916; bh=imhAhvKBfVxSgtEyaM9rgSOH6CZY096luAI1Flr42eo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Qx0FVn+FQEHU2in37IMj5QhhvoAvI1JzHwJmrJzRp9JoabiuLrUbsYSOkepqdZJXI fexj/dhBwuT2+wG7UV4ISEwxg5NOMNtD8YUrNTvptxIRajQk8u80m+ke2SyVyvDela z1faVfoljp9TvLiBet3MAF/c5XDU6m7oa6/Kc1rg= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Sebastian Ott , Martin Schwidefsky , Sasha Levin , linux-s390@vger.kernel.org Subject: [PATCH AUTOSEL 5.0 111/262] s390/ism: ignore some errors during deregistration Date: Wed, 27 Mar 2019 13:59:26 -0400 Message-Id: <20190327180158.10245-111-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190327180158.10245-1-sashal@kernel.org> References: <20190327180158.10245-1-sashal@kernel.org> MIME-Version: 1.0 X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sebastian Ott [ Upstream commit 0ff06c44efeede4acd068847d3bf8cf894b6c664 ] Prior to dma unmap/free operations the ism driver tries to ensure that the memory is no longer accessed by the HW. When errors during deregistration of memory regions from the HW occur the ism driver will not unmap/free this memory. When we receive notification from the hypervisor that a PCI function has been detached we can no longer access the device and would never unmap/free these memory regions which led to complaints by the DMA debug API. Treat this kind of errors during the deregistration of memory regions from the HW as success since it is already ensured that the memory is no longer accessed by HW. Reported-by: Karsten Graul Reported-by: Hans Wippel Signed-off-by: Sebastian Ott Signed-off-by: Martin Schwidefsky Signed-off-by: Sasha Levin --- drivers/s390/net/ism_drv.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/s390/net/ism_drv.c b/drivers/s390/net/ism_drv.c index ed8e58f09054..3e132592c1fe 100644 --- a/drivers/s390/net/ism_drv.c +++ b/drivers/s390/net/ism_drv.c @@ -141,10 +141,13 @@ static int register_ieq(struct ism_dev *ism) static int unregister_sba(struct ism_dev *ism) { + int ret; + if (!ism->sba) return 0; - if (ism_cmd_simple(ism, ISM_UNREG_SBA)) + ret = ism_cmd_simple(ism, ISM_UNREG_SBA); + if (ret && ret != ISM_ERROR) return -EIO; dma_free_coherent(&ism->pdev->dev, PAGE_SIZE, @@ -158,10 +161,13 @@ static int unregister_sba(struct ism_dev *ism) static int unregister_ieq(struct ism_dev *ism) { + int ret; + if (!ism->ieq) return 0; - if (ism_cmd_simple(ism, ISM_UNREG_IEQ)) + ret = ism_cmd_simple(ism, ISM_UNREG_IEQ); + if (ret && ret != ISM_ERROR) return -EIO; dma_free_coherent(&ism->pdev->dev, PAGE_SIZE, @@ -287,7 +293,7 @@ static int ism_unregister_dmb(struct smcd_dev *smcd, struct smcd_dmb *dmb) cmd.request.dmb_tok = dmb->dmb_tok; ret = ism_cmd(ism, &cmd); - if (ret) + if (ret && ret != ISM_ERROR) goto out; ism_free_dmb(ism, dmb); -- 2.19.1