Received: by 10.223.164.202 with SMTP id h10csp629895wrb; Thu, 30 Nov 2017 16:43:27 -0800 (PST) X-Google-Smtp-Source: AGs4zMZOCvO6nRm1UXTQKDXLfCbK/tlu/BjGRVV9NzA4BjkwHE5lnyVcXF5Xp5WR/BF7yaXCaDMB X-Received: by 10.98.201.216 with SMTP id l85mr8468368pfk.217.1512089007273; Thu, 30 Nov 2017 16:43:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512089007; cv=none; d=google.com; s=arc-20160816; b=bcALQ991a8Gyk2Kwo9KUlGwtmcv1xORVbvz6akY4c77hDnYwGxSmIr/SyEncNcUMWu h9zep4AD2H9NzYdnz5R+bY3foQvCdlBtEjjxT3DhHlNjYsDz7Z3b1cmCi06FzC3BNYWl mAWvWm6DaJUziehapOzNMws9QdJEHkJ18kWt7uCUuK609dKcYSfa34Hc7dxclMmWAwTL gY2850WSGqaFVlvzaojOw3+v3mKFWVsGsKFMVqId7M2HYuHdlmvx3aW5ZezdZx7u9szg dRvQefTlzM7wA7iF96b9UNQ79X+qZW8t8jaMTjnKx21AT8SvGJGFXgrdnNL90rSZMUeD O0+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=PFNROdI6MxfSQJsdiJiwHHj4eH9qvPRyqk2f/20u1z4=; b=HeGOuZYzFELWj3p55gW5P60/6dXiViYIE5BITZak9ySy2oG0K/aerxuYEoZnjSZRXt cKP7TvKQbqj19tK4mHWnt+e490u+BBTXbeV4sXVq7DguPC3tSvJTaEfs9kvfmMiXAMG+ jjfngyNM1PPu5Y36Wxcx8ilkCcMLUgn8xI0cPsYkqUNq7wlTLMrE7k3weAXQVoj0y9le c3BGRlpbcakB+GOoq7B02gZE/ki2kNtzFBDsNSExXpkskDkhRK9YuXyQBLlUEsBoR1mA jj8UpDZrFXPrvA/09nezR8J+I33jIYglzraZq9R8rHri2anq5F9J4H7VWZCxexMsLjhq d+fg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@apm.com header.s=apm header.b=ovJaybxw; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=apm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s4si3895919pgo.278.2017.11.30.16.43.12; Thu, 30 Nov 2017 16:43:27 -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; dkim=pass header.i=@apm.com header.s=apm header.b=ovJaybxw; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=apm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751699AbdLAAnE (ORCPT + 99 others); Thu, 30 Nov 2017 19:43:04 -0500 Received: from mail-wm0-f68.google.com ([74.125.82.68]:46871 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750842AbdLAAnD (ORCPT ); Thu, 30 Nov 2017 19:43:03 -0500 Received: by mail-wm0-f68.google.com with SMTP id r78so788041wme.5 for ; Thu, 30 Nov 2017 16:43:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=apm.com; s=apm; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=PFNROdI6MxfSQJsdiJiwHHj4eH9qvPRyqk2f/20u1z4=; b=ovJaybxwJQzF6FO+gajz5i4WIn+9P5Uj3zImLIm2lKdDcBEM3fpUW84FCw5dKbmdPd w/koStltGMKgrwDaxWFCV2HUREdKXk87Wcql/vd17FUIYPjPN9KeSgSwZg6lMpalEmg9 IZJo1gt/QgIG3cExlJ8gruWRrh3o9U4htTdLQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=PFNROdI6MxfSQJsdiJiwHHj4eH9qvPRyqk2f/20u1z4=; b=m8mGH3qwo6bHB+97gKgKv2z1isuYQbVdP0blDmh1mks4+p7BJ6B0Ksm6Lm6PSSfX58 jbDP1DqS81DX2cm2SwA572PAQRcPoZ4QZbrdBNRDar6TQwIxdxLKawinjBglgveHk6dw oK79t0GhzSW0Hzue63YnsT2qmjZcJymoWYbeacMMzjW30pUDnJPNIbs4ClzOjan/0sdC twhrLeCThBMfLo89BNOKlFIuISxJfv8T13/LoxbuXelmmrljqYFw1LMcHNHInVhG637e nRboXsbxQImnnCC+IGzLpwaCvxGZVoXNA1+CE3bpv7DXi54kP8JSQs7hPN8yyb/fyFhS CKNw== X-Gm-Message-State: AJaThX6MLRAUvRGs2GQ+8ydipVS2xSbflrabBDmYDwn/yhanr+RMegFT v9vrp1f1jofp7wiCe3zSjbwjdizo8flO80dRyNl8gQ== X-Received: by 10.28.64.68 with SMTP id n65mr2132484wma.0.1512088981503; Thu, 30 Nov 2017 16:43:01 -0800 (PST) MIME-Version: 1.0 Received: by 10.28.66.76 with HTTP; Thu, 30 Nov 2017 16:43:00 -0800 (PST) In-Reply-To: References: <20170803123239.11359-1-lorenzo.pieralisi@arm.com> From: Feng Kan Date: Thu, 30 Nov 2017 16:43:00 -0800 Message-ID: Subject: Re: [PATCH v3 0/5] ACPI: DMA ranges management To: Lorenzo Pieralisi Cc: "linux-acpi@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" , Will Deacon , Hanjun Guo , Jon Masters , Robert Moore , Robin Murphy , Zhang Rui , "Rafael J. Wysocki" , Nate Watterson Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 29, 2017 at 11:28 PM, Feng Kan wrote: > On Thu, Aug 3, 2017 at 5:32 AM, Lorenzo Pieralisi > wrote: >> This patch series is v3 of a previous posting: >> >> v2->v3: >> - Fixed DMA masks computation >> - Fixed size computation overflow in acpi_dma_get_range() >> >> v1->v2: >> - Reworked acpi_dma_get_range() flow and logs >> - Added IORT named component address limits >> - Renamed acpi_dev_get_resources() helper function >> - Rebased against v4.13-rc3 >> >> v2: http://lkml.kernel.org/r/20170731152323.32488-1-lorenzo.pieralisi@arm.com >> v1: http://lkml.kernel.org/r/20170720144517.32529-1-lorenzo.pieralisi@arm.com >> >> -- Original cover letter -- >> >> As reported in: >> >> http://lkml.kernel.org/r/CAL85gmA_SSCwM80TKdkZqEe+S1beWzDEvdki1kpkmUTDRmSP7g@mail.gmail.com >> >> the bus connecting devices to an IOMMU bus can be smaller in size than >> the IOMMU input address bits which results in devices DMA HW bugs in >> particular related to IOVA allocation (ie chopping of higher address >> bits owing to system bus HW capabilities mismatch with the IOMMU). >> >> Fortunately this problem can be solved through an already present but never >> used ACPI 6.2 firmware bindings (ie _DMA object) allowing to define the DMA >> window for a specific bus in ACPI and therefore all upstream devices >> connected to it. >> >> This small patch series enables _DMA parsing in ACPI core code and >> use it in ACPI IORT code in order to detect DMA ranges for devices and >> update their data structures to make them work with their related DMA >> addressing restrictions. >> >> Cc: Will Deacon >> Cc: Hanjun Guo >> Cc: Feng Kan >> Cc: Jon Masters >> Cc: Robert Moore >> Cc: Robin Murphy >> Cc: Zhang Rui >> Cc: "Rafael J. Wysocki" >> >> Lorenzo Pieralisi (5): >> ACPICA: resource_mgr: Allow _DMA method in walk resources >> ACPI: Make acpi_dev_get_resources() method agnostic >> ACPI: Introduce DMA ranges parsing >> ACPI: Make acpi_dma_configure() DMA regions aware >> ACPI/IORT: Add IORT named component memory address limits >> >> drivers/acpi/acpica/rsxface.c | 7 ++-- >> drivers/acpi/arm64/iort.c | 57 ++++++++++++++++++++++++++- >> drivers/acpi/resource.c | 82 +++++++++++++++++++++++++++++--------- >> drivers/acpi/scan.c | 91 +++++++++++++++++++++++++++++++++++++++---- >> include/acpi/acnames.h | 1 + >> include/acpi/acpi_bus.h | 2 + >> include/linux/acpi.h | 8 ++++ >> include/linux/acpi_iort.h | 5 ++- >> 8 files changed, 219 insertions(+), 34 deletions(-) >> >> -- >> 2.10.0 >> > Lorenzo: > > A network driver can use pci_set_dma_mask or its like to override what > is done with this patch here. > Which would result in iova allocation greater than the original _DMA > aperture. Should we force > the dma_set_mask to not change if an existing mask is already set? Let me clarify the question some more, in our system the IOMMU supports only 42 bits of address. With your _DMA aperture patch, the initial dma_mask and coherent_mask are correctly set by the code. However, the device driver can set the dma_mask and coherent mask at a later point which over writes the initial setting by your code. In which case, once the iova is exhausted with the 32 bit address, it will start seeking more iova address via the dma_limit. In this case it would fail my system since the iommu.aperture_end is that of 48 bits as derived from ias field in the SMMU. Should the dma_limit be the smallest of driver->dma_mask, iommu.aperture_end and your _DMA aperture size via ACPI table? Rather than just the driver->dma_mask and iommu.aperture_end. This will ensure the smallest/correct aperture is used. From 1585475179879896616@xxx Thu Nov 30 07:29:18 +0000 2017 X-GM-THRID: 1574713251984889929 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread