Received: by 2002:ac0:8845:0:0:0:0:0 with SMTP id g63csp473443img; Tue, 26 Feb 2019 03:24:52 -0800 (PST) X-Google-Smtp-Source: AHgI3IYC19PjftcbxqpvwFB28+hVIQnY4IhdsvacC5bL74rXTHZAg/CVnV1xoBoodzcs63Vn/Jd9 X-Received: by 2002:a63:d449:: with SMTP id i9mr20751277pgj.449.1551180292591; Tue, 26 Feb 2019 03:24:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551180292; cv=none; d=google.com; s=arc-20160816; b=wRY5TS6s0YjE72hET7va6Qu6xXIzPsGWxyVzl8NUz3GRo4kV8ZLKDhwkFjLx63vykj I5BLdsBFBehSmm/xw2E6lrGb/NW4N2Y8534SSfa1V8EZjFy4TRrbcARCUm/95Jdma0CW xXzY9C19I65lm0kdm799+dRK5i1bvDyw9efNV0kdwv09fqiFCUp3KFsQZz9dRnxaU9XO PMiyVZ0Uk5iDcn+q9N5m4/AWSy8Zkk05TnwHTLi1KFYCVMP9cpRrGvrZ224cFhmPyS6g RsugTqsO3wuGgC+J6LAVbejd+woa0T3ski9r4FsaG0Y/VtCCPPu292mVslD6DSzYb/fv D6LQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=53KMTKhsCo3MwC+89kM7OIvXPIYMFS7JMF4BAF2Ol3g=; b=W7QUaPY5VW+6TF9Okc64RYqGPPIctHx+BVIT1DAFu/YuX1+mvubkDvzweh2JKYe4/i lxTQbX5510q0wp+6kp+3xXn4rhjbqPYBj+gMsboptQnZjZJB+icEFs7kMV/9IkNMlUH5 KV4lvP3uXgUi8MxnGiyXtbWeWfMcr2AIvelM6TalrNFoZ/77x5OMfcwOzZFT3wnRlU4m H42/gUhg/uoH8TOXTnSzENzgU/yTZk2IODHUmVGCmOsFYf0UE3dQwxSid5IUV3qn78Tt qqfzV5PwSSm0MKFfYt5yGJyZcnbwKfbY2AcRekrUNaWqIPSV8h3Am5sKOoMmQKbHTTTq e71Q== 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d10si12909314pfh.133.2019.02.26.03.24.37; Tue, 26 Feb 2019 03:24:52 -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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727845AbfBZLYN (ORCPT + 99 others); Tue, 26 Feb 2019 06:24:13 -0500 Received: from mx1.redhat.com ([209.132.183.28]:42258 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726240AbfBZLYM (ORCPT ); Tue, 26 Feb 2019 06:24:12 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 585AE368D0; Tue, 26 Feb 2019 11:24:12 +0000 (UTC) Received: from localhost (unknown [10.40.205.183]) by smtp.corp.redhat.com (Postfix) with ESMTP id D5BFA5DA2A; Tue, 26 Feb 2019 11:24:09 +0000 (UTC) Date: Tue, 26 Feb 2019 12:24:08 +0100 From: Stanislaw Gruszka To: Joerg Roedel Cc: Lorenzo Bianconi , Rosen Penev , linux-wireless , Samuel Sieb , Alexander Duyck , iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org Subject: Re: MT76x2U crashes XHCI driver on AMD Ryzen system Message-ID: <20190226112407.GB2989@redhat.com> References: <1547404075.1582.0@smtp.gmail.com> <20190114091841.GA23045@localhost.localdomain> <20190115090400.GA2267@localhost.localdomain> <20190218143742.GA11872@redhat.com> <20190226100535.GA20740@8bytes.org> <20190226103450.GA2989@redhat.com> <20190226104413.GH20740@8bytes.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190226104413.GH20740@8bytes.org> User-Agent: Mutt/1.8.3 (2017-05-23) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 26 Feb 2019 11:24:12 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 26, 2019 at 11:44:13AM +0100, Joerg Roedel wrote: > On Tue, Feb 26, 2019 at 11:34:51AM +0100, Stanislaw Gruszka wrote: > > On Tue, Feb 26, 2019 at 11:05:36AM +0100, Joerg Roedel wrote: > > If sg->offset > PAGE_SIZE is fine then most likely we have problem with > > alignment. > > The map_sg implementation in the AMD IOMMU driver uses sg_phys() which > handles the sg->page + sg->offset calculation fine. > > > Note hat issue is with dma_map_sg(), switching to dma_map_single() > > by using urb->transfer_buffer instead of urb->sg make things work > > on AMD IOMMU. > > On the other hand this points to a bug in the driver, I'll look further > if I can spot something there. I think so too. And I have done some changes that avoid strange allocation scheme and use usb synchronous messages instead of allocating buffers with unaligned sizes. However things work ok on Intel IOMMU and there is no documentation what are dma_map_sg() requirement versus dma_map_single() which works. I think there are some unwritten requirements and things can work on some platforms and fails on others (different IOMMUs, no-IOMMU on some ARCHes) Stanislaw