Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2729807imj; Mon, 18 Feb 2019 11:05:04 -0800 (PST) X-Google-Smtp-Source: AHgI3IaS4QbEElMOuPyxHrdSBhFPNG0oAXGz7ixsGbIpuEYlkGa1z3iO/NkACXchmF40pkyYMOh0 X-Received: by 2002:a62:1d8f:: with SMTP id d137mr25306026pfd.11.1550516704048; Mon, 18 Feb 2019 11:05:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550516704; cv=none; d=google.com; s=arc-20160816; b=bjzi8/eaj6/M/OqbLhyxDpkOs55hLg352W0OjBb4h7z2zImL6TTgWu3XCi1Jo5mIDv fWf2sPPN8KMh2Lmgdr8PtnAujF2BByWOCSis2K2eFix60DsIS5ELuwSK+Fu7v0wIslwq k144hCULv5Rb7B9X38jbgQekgjxfvl0n+DNL1hdcesS0DhldC06zF17sWK2t0908wnIz ALCavcm3sS3fzgR8BW25HOzPEB6WtrXXlZyJaVUCfkGZnQc82NYvuI3V6A1b/PQSXUvZ zL5liw4WdUblWSerkihssjl3+uRFSjXAfk1Ij4f+HCVZT/kVIlipVZvlaENl/A6+Z9XE SrmA== 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; bh=/CHn/mB2phfEhEkp+YhKPwq3ZbC4wx+JLgwReaygpuw=; b=MT7nGjOsak/kHZ8CL+uMhcL0GV4PiXyBzxdfWmypyOxD3a9bgZccdA5LkkRaX1s55u u2fP1qVfwhS0XHkIvKsUXYusum2RMJ7cDQSasTnKiQQc7cmWoBZ8lCY4cX6bFvoIwFez gAy4aBAWuNsPpxbSlgbsSk9CLlk9UxKisgKZULUU2Yy85g0ZEKrzfeVAi9uZCK2bG6vu iBXInUwjNBnF/URp4oukbJmbrdQJ4CT9fZ3FNCD3Y8xHGhaOG1FbFmRmJiFnQcFdYGK1 R/8pdJrTZkqFjmgC47zX1wDHnWu9JFywwb0VHuuYHO2/wIXFE/cLCo18EOiD3Ow8EH7h VUjQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b11si8262834pgk.77.2019.02.18.11.04.48; Mon, 18 Feb 2019 11:05:04 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387665AbfBRRhg (ORCPT + 99 others); Mon, 18 Feb 2019 12:37:36 -0500 Received: from foss.arm.com ([217.140.101.70]:34952 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729728AbfBRRhg (ORCPT ); Mon, 18 Feb 2019 12:37:36 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id E565D80D; Mon, 18 Feb 2019 09:02:22 -0800 (PST) Received: from [10.1.196.75] (e110467-lin.cambridge.arm.com [10.1.196.75]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 87C683F675; Mon, 18 Feb 2019 09:02:01 -0800 (PST) Subject: Re: MT76x2U crashes XHCI driver on AMD Ryzen system To: Stanislaw Gruszka , Lorenzo Bianconi Cc: Samuel Sieb , linux-wireless , linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org, Rosen Penev , Alexander Duyck References: <83A1D243-9073-48D1-9F26-5A2581DCB829@gmail.com> <1547404075.1582.0@smtp.gmail.com> <20190114091841.GA23045@localhost.localdomain> <20190115090400.GA2267@localhost.localdomain> <20190218143742.GA11872@redhat.com> From: Robin Murphy Message-ID: <2cc5674a-a3a0-d8fe-65f5-4357da9b85d3@arm.com> Date: Mon, 18 Feb 2019 17:01:59 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <20190218143742.GA11872@redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 18/02/2019 14:37, Stanislaw Gruszka wrote: [...] > Another issue is that dma_map_sg() & dma_map_page() may require some > constraints. I'm not sure about that and I want to clarify that with > CCed mm maintainers. I think DMA drivers may expect sg->offset < PAGE_SIZE > for both dma_map_sg() and dma_map_page(). Additionally dma_map_page() > maight expect that offset & length specify buffer within one page. Luckily, this came up a while back[1] and we seemed to reach a consensus that sg->offset >= PAGE_SIZE for dma_map_sg() was weird but valid. IIRC it was only the Intel IOMMU code which failed to handle that case appropriately (and which I fixed) - the AMD IOMMU code always looked like it should be OK, but I'm not sure I've ever seen definitive test results (and I don't have hardware to do so myself). For dma_map_page(), length >= PAGE_SIZE should be perfectly valid and handled correctly. The offset >= PAGE_SIZE case is a bit harder to justify, but at the same time has less scope for the DMA API backend to get it wrong, so either way is likely to be OK in practice (in particular the AMD IOMMU code looks like it won't have a problem, since its map_page() implementation converts page and offset to a plain physical address before doing anything else). Robin. [1] https://lists.linuxfoundation.org/pipermail/iommu/2017-September/024148.html