Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1546994ybl; Fri, 13 Dec 2019 17:44:11 -0800 (PST) X-Google-Smtp-Source: APXvYqxKO1exfoC7VNgZJvNqNjFlc8yoITd9jjuB3wUWJ+Q0QJYjq89q5+AMiN1jO6r2sRii4pvU X-Received: by 2002:a05:6830:1715:: with SMTP id 21mr18503760otk.67.1576287851617; Fri, 13 Dec 2019 17:44:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576287851; cv=none; d=google.com; s=arc-20160816; b=KRwoUjxtE8I4AGqqzOkhwIuAsTeAXzCwfCYxVn5fbdBPhdLipmMcjqk8IItkSHElF7 ilCKdW5Lai3wPPd7Agozx+8sbvszTHC+Zk90ZFpKQ0seapKy2wUKwAIE9zvEb2yicc3v OgHPTJ1MY1+JefjvjJwh1jbNJl/To624l+smNF3GATmRDfKS+t8BltUkMq/SjLgNirXS vmd5Tb7JeXh2XACUKx/prBvpSnh86SbnrW6s/mOwtVEyqyF6fFukWRATVzyWK95csZFC ICXV1pg4Jr6JFniOpDejOEzbzUCqQqsXvgvQE4wQc4gL4Njw2M9NqeaTU7FyNKXjNDQ2 e0sg== 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:to:subject:cc; bh=0/9P/EhmfklUjLlQbfTTpmWOEdaYKL0weoJaG/vTZLo=; b=SO2iob3eXkhHJBRFeuIl/nSHLfWiVEW84/k4J4I8jnJQ5H9K5+lDrOanleGFonsbBu tP5TGqEnIM4Xl2W10NEMXp8BG0JLXQA8VJJ7EQgEmJWDx141Pm4MQ0NdtNF/P6U3/sjs mo3owYLkVMATx7OsbPCTCJX9Cw44jzvO+jFx08B8OWGCxdvsrZX40Z3jpnolILJlVJ1U gzY9ybbv97DBhdpB4KlccXsbkLy4lrZYyxw9CVvnaruHYCPfQ8uHKw8+iE2hdGJzuhcv yfcdKf9ff+Q5ljGpwOm21trMebxK1et40NkLeKovi8cn10GTEDIvab6naDqBoAYdcKJd S9Jg== 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 w127si6326704oib.188.2019.12.13.17.43.59; Fri, 13 Dec 2019 17:44:11 -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 S1726676AbfLNBnR (ORCPT + 99 others); Fri, 13 Dec 2019 20:43:17 -0500 Received: from mga12.intel.com ([192.55.52.136]:46212 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726170AbfLNBnR (ORCPT ); Fri, 13 Dec 2019 20:43:17 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Dec 2019 17:43:16 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,311,1571727600"; d="scan'208";a="226461161" Received: from allen-box.sh.intel.com (HELO [10.239.159.136]) ([10.239.159.136]) by orsmga002.jf.intel.com with ESMTP; 13 Dec 2019 17:43:15 -0800 Cc: baolu.lu@linux.intel.com, Joerg Roedel , iommu@lists.linux-foundation.org, stable@vger.kernel.org Subject: Re: [PATCH] iommu/vt-d: Allocate reserved region for ISA with correct permission To: Jerry Snitselaar , linux-kernel@vger.kernel.org References: <20191213053642.5696-1-jsnitsel@redhat.com> From: Lu Baolu Message-ID: <5ccaaec0-b070-b820-cebd-6b7ad179109c@linux.intel.com> Date: Sat, 14 Dec 2019 09:42:27 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.1 MIME-Version: 1.0 In-Reply-To: <20191213053642.5696-1-jsnitsel@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 Hi Jerry, On 12/13/19 1:36 PM, Jerry Snitselaar wrote: > Currently the reserved region for ISA is allocated with no > permissions. If a dma domain is being used, mapping this region will > fail. Set the permissions to DMA_PTE_READ|DMA_PTE_WRITE. > > Cc: Joerg Roedel > Cc: Lu Baolu > Cc: iommu@lists.linux-foundation.org > Cc: stable@vger.kernel.org # v5.3+ > Fixes: d850c2ee5fe2 ("iommu/vt-d: Expose ISA direct mapping region via iommu_get_resv_regions") > Signed-off-by: Jerry Snitselaar > --- > drivers/iommu/intel-iommu.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c > index 0c8d81f56a30..998529cebcf2 100644 > --- a/drivers/iommu/intel-iommu.c > +++ b/drivers/iommu/intel-iommu.c > @@ -5736,7 +5736,7 @@ static void intel_iommu_get_resv_regions(struct device *device, > struct pci_dev *pdev = to_pci_dev(device); > > if ((pdev->class >> 8) == PCI_CLASS_BRIDGE_ISA) { > - reg = iommu_alloc_resv_region(0, 1UL << 24, 0, > + reg = iommu_alloc_resv_region(0, 1UL << 24, prot, > IOMMU_RESV_DIRECT); This also applies to the IOAPIC range. Can you please change them together? diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index 0c8d81f56a30..256e48434f68 100644 --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c @@ -5736,7 +5736,7 @@ static void intel_iommu_get_resv_regions(struct device *device, struct pci_dev *pdev = to_pci_dev(device); if ((pdev->class >> 8) == PCI_CLASS_BRIDGE_ISA) { - reg = iommu_alloc_resv_region(0, 1UL << 24, 0, + reg = iommu_alloc_resv_region(0, 1UL << 24, prot, IOMMU_RESV_DIRECT); if (reg) list_add_tail(®->list, head); @@ -5746,7 +5746,7 @@ static void intel_iommu_get_resv_regions(struct device *device, reg = iommu_alloc_resv_region(IOAPIC_RANGE_START, IOAPIC_RANGE_END - IOAPIC_RANGE_START + 1, - 0, IOMMU_RESV_MSI); + prot, IOMMU_RESV_MSI); if (!reg) return; list_add_tail(®->list, head); Best regards, baolu > if (reg) > list_add_tail(®->list, head); >