From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.6 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FAKE_REPLY_C,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F417DC1975A for ; Thu, 12 Mar 2020 20:59:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C558720724 for ; Thu, 12 Mar 2020 20:59:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1584046741; bh=sZrxWzYm4Q2gQ/nKayUGqNHfr3nP8m8qZiAHKqaks08=; h=Date:From:To:Cc:Subject:In-Reply-To:List-ID:From; b=mKUL/KDwMQKOPvKt+q7EhNWl1wPaq4iYmO6ZkHOjzH1TX76NSs//+/XcwkcTP36rs xpq5HpImBZsnLZDNLmc/FAKYxCMJG7OTgi8/3eufSuMYqeJ0k++FEY760u1qIHhVkb 0mXmEZe25WwRGRib8pSLy3h1rcYbwKzobrlg9K+E= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727144AbgCLU7B (ORCPT ); Thu, 12 Mar 2020 16:59:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:45528 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726246AbgCLU7A (ORCPT ); Thu, 12 Mar 2020 16:59:00 -0400 Received: from localhost (mobile-166-175-186-165.mycingular.net [166.175.186.165]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id CA66B206B7; Thu, 12 Mar 2020 20:58:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1584046740; bh=sZrxWzYm4Q2gQ/nKayUGqNHfr3nP8m8qZiAHKqaks08=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=YoAaCQPJTwGmp7XWP86L78EAbP87WHaly0Mp6Ed8cwzHqWkTNzAekl0Vckbc5pcmt sHCTW0fPtyDVPWOuPF8zuumu2s9LhFTzzRroslWpC97D1efkVIlDqL6XyysJdOWTM/ cfylvimv3zTN/vGEqEvIIqwZ9L3tXOyXL77JU+ks= Date: Thu, 12 Mar 2020 15:58:58 -0500 From: Bjorn Helgaas To: Jean-Philippe Brucker Cc: will@kernel.org, robh+dt@kernel.org, joro@8bytes.org, baolu.lu@linux.intel.com, sudeep.holla@arm.com, linux-doc@vger.kernel.org, linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-acpi@vger.kernel.org, iommu@lists.linux-foundation.org, lorenzo.pieralisi@arm.com, corbet@lwn.net, mark.rutland@arm.com, liviu.dudau@arm.com, guohanjun@huawei.com, rjw@rjwysocki.net, lenb@kernel.org, robin.murphy@arm.com, dwmw2@infradead.org, amurray@thegoodpenguin.co.uk, frowand.list@gmail.com Subject: Re: [PATCH v2 04/11] ACPI/IORT: Check ATS capability in root complex node Message-ID: <20200312205858.GA178807@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200311124506.208376-5-jean-philippe@linaro.org> User-Agent: Mutt/1.12.2 (2019-09-21) Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org On Wed, Mar 11, 2020 at 01:44:59PM +0100, Jean-Philippe Brucker wrote: > When initializing a PCI root bridge, copy its "ATS supported" attribute > into the root bridge. > > Acked-by: Hanjun Guo > Signed-off-by: Jean-Philippe Brucker > --- > drivers/acpi/arm64/iort.c | 27 +++++++++++++++++++++++++++ > drivers/acpi/pci_root.c | 3 +++ > include/linux/acpi_iort.h | 8 ++++++++ > 3 files changed, 38 insertions(+) > > diff --git a/drivers/acpi/arm64/iort.c b/drivers/acpi/arm64/iort.c > index ed3d2d1a7ae9..d99d7f5b51e1 100644 > --- a/drivers/acpi/arm64/iort.c > +++ b/drivers/acpi/arm64/iort.c > @@ -1633,6 +1633,33 @@ static void __init iort_enable_acs(struct acpi_iort_node *iort_node) > } > } > } > + > +static acpi_status iort_match_host_bridge_callback(struct acpi_iort_node *node, > + void *context) > +{ > + struct acpi_iort_root_complex *pci_rc; > + struct pci_host_bridge *host_bridge = context; > + > + pci_rc = (struct acpi_iort_root_complex *)node->node_data; > + > + return pci_domain_nr(host_bridge->bus) == pci_rc->pci_segment_number ? > + AE_OK : AE_NOT_FOUND; > +} > + > +void iort_pci_host_bridge_setup(struct pci_host_bridge *host_bridge) > +{ > + struct acpi_iort_node *node; > + struct acpi_iort_root_complex *pci_rc; > + > + node = iort_scan_node(ACPI_IORT_NODE_PCI_ROOT_COMPLEX, > + iort_match_host_bridge_callback, host_bridge); > + if (!node) > + return; > + > + pci_rc = (struct acpi_iort_root_complex *)node->node_data; > + host_bridge->ats_supported = !!(pci_rc->ats_attribute & > + ACPI_IORT_ATS_SUPPORTED); > +} > #else > static inline void iort_enable_acs(struct acpi_iort_node *iort_node) { } > #endif > diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c > index d1e666ef3fcc..eb2fb8f17c0b 100644 > --- a/drivers/acpi/pci_root.c > +++ b/drivers/acpi/pci_root.c > @@ -6,6 +6,7 @@ > * Copyright (C) 2001, 2002 Paul Diefenbaugh > */ > > +#include > #include > #include > #include > @@ -917,6 +918,8 @@ struct pci_bus *acpi_pci_root_create(struct acpi_pci_root *root, > if (!(root->osc_control_set & OSC_PCI_EXPRESS_LTR_CONTROL)) > host_bridge->native_ltr = 0; > > + iort_pci_host_bridge_setup(host_bridge); Similar comment as on the OF side. You mentioned at [1] that "it's important that we only enable ATS if the host bridge supports it". That should be captured in a commit log and comment somewhere here. That suggests to me that we should not set bridge->ats_supported = 1; by default in pci_init_host_bridge(), but rather leave it zero as it is by default, and then do things like: if (iort_pci_host_bridge_ats_supported(bridge)) bridge->ats_supported = 1; if (of_pci_host_bridge_ats_supported(bridge)) bridge->ats_supported = 1; I don't know what you do about IVRS and DMAR, which don't appear in this series except in the comment. [1] https://lore.kernel.org/r/20200213165049.508908-1-jean-philippe@linaro.org > /* > * Evaluate the "PCI Boot Configuration" _DSM Function. If it > * exists and returns 0, we must preserve any PCI resource > diff --git a/include/linux/acpi_iort.h b/include/linux/acpi_iort.h > index 8e7e2ec37f1b..7b06871cc3aa 100644 > --- a/include/linux/acpi_iort.h > +++ b/include/linux/acpi_iort.h > @@ -10,6 +10,7 @@ > #include > #include > #include > +#include > > #define IORT_IRQ_MASK(irq) (irq & 0xffffffffULL) > #define IORT_IRQ_TRIGGER_MASK(irq) ((irq >> 32) & 0xffffffffULL) > @@ -55,4 +56,11 @@ int iort_iommu_msi_get_resv_regions(struct device *dev, struct list_head *head) > { return 0; } > #endif > > +#if defined(CONFIG_ACPI_IORT) && defined(CONFIG_PCI) > +void iort_pci_host_bridge_setup(struct pci_host_bridge *host_bridge); > +#else > +static inline > +void iort_pci_host_bridge_setup(struct pci_host_bridge *host_bridge) { } > +#endif > + > #endif /* __ACPI_IORT_H__ */ > -- > 2.25.1 > From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.3 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, FAKE_REPLY_C,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 241E3C2BB1D for ; Thu, 12 Mar 2020 20:59:06 +0000 (UTC) Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id ECA74206B7 for ; Thu, 12 Mar 2020 20:59:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="YoAaCQPJ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org ECA74206B7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=iommu-bounces@lists.linux-foundation.org Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id C4E7585116; Thu, 12 Mar 2020 20:59:05 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ee2DNe8AbDAU; Thu, 12 Mar 2020 20:59:04 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by fraxinus.osuosl.org (Postfix) with ESMTP id C4595850EA; Thu, 12 Mar 2020 20:59:04 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id AD071C089F; Thu, 12 Mar 2020 20:59:04 +0000 (UTC) Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id F058DC0177 for ; Thu, 12 Mar 2020 20:59:03 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id DEC068758D for ; Thu, 12 Mar 2020 20:59:03 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id I2jxUnl-099Q for ; Thu, 12 Mar 2020 20:59:00 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by whitealder.osuosl.org (Postfix) with ESMTPS id 5CF378701C for ; Thu, 12 Mar 2020 20:59:00 +0000 (UTC) Received: from localhost (mobile-166-175-186-165.mycingular.net [166.175.186.165]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id CA66B206B7; Thu, 12 Mar 2020 20:58:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1584046740; bh=sZrxWzYm4Q2gQ/nKayUGqNHfr3nP8m8qZiAHKqaks08=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=YoAaCQPJTwGmp7XWP86L78EAbP87WHaly0Mp6Ed8cwzHqWkTNzAekl0Vckbc5pcmt sHCTW0fPtyDVPWOuPF8zuumu2s9LhFTzzRroslWpC97D1efkVIlDqL6XyysJdOWTM/ cfylvimv3zTN/vGEqEvIIqwZ9L3tXOyXL77JU+ks= Date: Thu, 12 Mar 2020 15:58:58 -0500 From: Bjorn Helgaas To: Jean-Philippe Brucker Subject: Re: [PATCH v2 04/11] ACPI/IORT: Check ATS capability in root complex node Message-ID: <20200312205858.GA178807@google.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200311124506.208376-5-jean-philippe@linaro.org> User-Agent: Mutt/1.12.2 (2019-09-21) Cc: mark.rutland@arm.com, linux-doc@vger.kernel.org, linux-pci@vger.kernel.org, liviu.dudau@arm.com, guohanjun@huawei.com, frowand.list@gmail.com, corbet@lwn.net, will@kernel.org, linux-acpi@vger.kernel.org, lenb@kernel.org, devicetree@vger.kernel.org, robh+dt@kernel.org, linux-arm-kernel@lists.infradead.org, dwmw2@infradead.org, rjw@rjwysocki.net, iommu@lists.linux-foundation.org, sudeep.holla@arm.com, robin.murphy@arm.com, amurray@thegoodpenguin.co.uk X-BeenThere: iommu@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Development issues for Linux IOMMU support List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: iommu-bounces@lists.linux-foundation.org Sender: "iommu" On Wed, Mar 11, 2020 at 01:44:59PM +0100, Jean-Philippe Brucker wrote: > When initializing a PCI root bridge, copy its "ATS supported" attribute > into the root bridge. > > Acked-by: Hanjun Guo > Signed-off-by: Jean-Philippe Brucker > --- > drivers/acpi/arm64/iort.c | 27 +++++++++++++++++++++++++++ > drivers/acpi/pci_root.c | 3 +++ > include/linux/acpi_iort.h | 8 ++++++++ > 3 files changed, 38 insertions(+) > > diff --git a/drivers/acpi/arm64/iort.c b/drivers/acpi/arm64/iort.c > index ed3d2d1a7ae9..d99d7f5b51e1 100644 > --- a/drivers/acpi/arm64/iort.c > +++ b/drivers/acpi/arm64/iort.c > @@ -1633,6 +1633,33 @@ static void __init iort_enable_acs(struct acpi_iort_node *iort_node) > } > } > } > + > +static acpi_status iort_match_host_bridge_callback(struct acpi_iort_node *node, > + void *context) > +{ > + struct acpi_iort_root_complex *pci_rc; > + struct pci_host_bridge *host_bridge = context; > + > + pci_rc = (struct acpi_iort_root_complex *)node->node_data; > + > + return pci_domain_nr(host_bridge->bus) == pci_rc->pci_segment_number ? > + AE_OK : AE_NOT_FOUND; > +} > + > +void iort_pci_host_bridge_setup(struct pci_host_bridge *host_bridge) > +{ > + struct acpi_iort_node *node; > + struct acpi_iort_root_complex *pci_rc; > + > + node = iort_scan_node(ACPI_IORT_NODE_PCI_ROOT_COMPLEX, > + iort_match_host_bridge_callback, host_bridge); > + if (!node) > + return; > + > + pci_rc = (struct acpi_iort_root_complex *)node->node_data; > + host_bridge->ats_supported = !!(pci_rc->ats_attribute & > + ACPI_IORT_ATS_SUPPORTED); > +} > #else > static inline void iort_enable_acs(struct acpi_iort_node *iort_node) { } > #endif > diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c > index d1e666ef3fcc..eb2fb8f17c0b 100644 > --- a/drivers/acpi/pci_root.c > +++ b/drivers/acpi/pci_root.c > @@ -6,6 +6,7 @@ > * Copyright (C) 2001, 2002 Paul Diefenbaugh > */ > > +#include > #include > #include > #include > @@ -917,6 +918,8 @@ struct pci_bus *acpi_pci_root_create(struct acpi_pci_root *root, > if (!(root->osc_control_set & OSC_PCI_EXPRESS_LTR_CONTROL)) > host_bridge->native_ltr = 0; > > + iort_pci_host_bridge_setup(host_bridge); Similar comment as on the OF side. You mentioned at [1] that "it's important that we only enable ATS if the host bridge supports it". That should be captured in a commit log and comment somewhere here. That suggests to me that we should not set bridge->ats_supported = 1; by default in pci_init_host_bridge(), but rather leave it zero as it is by default, and then do things like: if (iort_pci_host_bridge_ats_supported(bridge)) bridge->ats_supported = 1; if (of_pci_host_bridge_ats_supported(bridge)) bridge->ats_supported = 1; I don't know what you do about IVRS and DMAR, which don't appear in this series except in the comment. [1] https://lore.kernel.org/r/20200213165049.508908-1-jean-philippe@linaro.org > /* > * Evaluate the "PCI Boot Configuration" _DSM Function. If it > * exists and returns 0, we must preserve any PCI resource > diff --git a/include/linux/acpi_iort.h b/include/linux/acpi_iort.h > index 8e7e2ec37f1b..7b06871cc3aa 100644 > --- a/include/linux/acpi_iort.h > +++ b/include/linux/acpi_iort.h > @@ -10,6 +10,7 @@ > #include > #include > #include > +#include > > #define IORT_IRQ_MASK(irq) (irq & 0xffffffffULL) > #define IORT_IRQ_TRIGGER_MASK(irq) ((irq >> 32) & 0xffffffffULL) > @@ -55,4 +56,11 @@ int iort_iommu_msi_get_resv_regions(struct device *dev, struct list_head *head) > { return 0; } > #endif > > +#if defined(CONFIG_ACPI_IORT) && defined(CONFIG_PCI) > +void iort_pci_host_bridge_setup(struct pci_host_bridge *host_bridge); > +#else > +static inline > +void iort_pci_host_bridge_setup(struct pci_host_bridge *host_bridge) { } > +#endif > + > #endif /* __ACPI_IORT_H__ */ > -- > 2.25.1 > _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.5 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,FAKE_REPLY_C,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1B414C10DCE for ; Thu, 12 Mar 2020 20:59:08 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E6A17206B7 for ; Thu, 12 Mar 2020 20:59:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="IdXHCCU1"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="YoAaCQPJ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E6A17206B7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:References: List-Owner; bh=+6YWP9NNmc+zIWNGa02a424uav6Mb4NmJHawe1Ch0YM=; b=IdXHCCU1LmLl7T LIZmR7cUBgtjSdyisB2hShnXyjr+Z1XHCy7ElvuNx3LdDp0MbYBmw7HqyrrDTylhfrlm9FUvIYos8 qNsYeumIvXnU2REKawGGOG5Trb7xAAWUmjn5I9W622hI06zjJPlIHDbz1rbG28DgG3m3ThVJADkHr WPhd9f2nJeBzzeMfb9ivtWVQ4S6AyGReSicbRoQ4BDLiMUbQnwF0OMX2BZrhylfNEZMWCr1tfF/GT ccsom86co+5VR73M4RoJuUYEOnVoRWxprSjU6HbVXlLCGYFus6yWl/R8EZhWu9AOohohFyxqmgyku QRwTRWE8anFtWA2Z3ctw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jCUv1-00006Z-R0; Thu, 12 Mar 2020 20:59:03 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jCUuy-00005e-Jg for linux-arm-kernel@lists.infradead.org; Thu, 12 Mar 2020 20:59:02 +0000 Received: from localhost (mobile-166-175-186-165.mycingular.net [166.175.186.165]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id CA66B206B7; Thu, 12 Mar 2020 20:58:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1584046740; bh=sZrxWzYm4Q2gQ/nKayUGqNHfr3nP8m8qZiAHKqaks08=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=YoAaCQPJTwGmp7XWP86L78EAbP87WHaly0Mp6Ed8cwzHqWkTNzAekl0Vckbc5pcmt sHCTW0fPtyDVPWOuPF8zuumu2s9LhFTzzRroslWpC97D1efkVIlDqL6XyysJdOWTM/ cfylvimv3zTN/vGEqEvIIqwZ9L3tXOyXL77JU+ks= Date: Thu, 12 Mar 2020 15:58:58 -0500 From: Bjorn Helgaas To: Jean-Philippe Brucker Subject: Re: [PATCH v2 04/11] ACPI/IORT: Check ATS capability in root complex node Message-ID: <20200312205858.GA178807@google.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200311124506.208376-5-jean-philippe@linaro.org> User-Agent: Mutt/1.12.2 (2019-09-21) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200312_135900_690579_CCCFA862 X-CRM114-Status: GOOD ( 18.87 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, linux-doc@vger.kernel.org, linux-pci@vger.kernel.org, liviu.dudau@arm.com, guohanjun@huawei.com, frowand.list@gmail.com, lorenzo.pieralisi@arm.com, corbet@lwn.net, will@kernel.org, joro@8bytes.org, linux-acpi@vger.kernel.org, lenb@kernel.org, devicetree@vger.kernel.org, robh+dt@kernel.org, linux-arm-kernel@lists.infradead.org, dwmw2@infradead.org, rjw@rjwysocki.net, iommu@lists.linux-foundation.org, sudeep.holla@arm.com, baolu.lu@linux.intel.com, robin.murphy@arm.com, amurray@thegoodpenguin.co.uk Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Mar 11, 2020 at 01:44:59PM +0100, Jean-Philippe Brucker wrote: > When initializing a PCI root bridge, copy its "ATS supported" attribute > into the root bridge. > > Acked-by: Hanjun Guo > Signed-off-by: Jean-Philippe Brucker > --- > drivers/acpi/arm64/iort.c | 27 +++++++++++++++++++++++++++ > drivers/acpi/pci_root.c | 3 +++ > include/linux/acpi_iort.h | 8 ++++++++ > 3 files changed, 38 insertions(+) > > diff --git a/drivers/acpi/arm64/iort.c b/drivers/acpi/arm64/iort.c > index ed3d2d1a7ae9..d99d7f5b51e1 100644 > --- a/drivers/acpi/arm64/iort.c > +++ b/drivers/acpi/arm64/iort.c > @@ -1633,6 +1633,33 @@ static void __init iort_enable_acs(struct acpi_iort_node *iort_node) > } > } > } > + > +static acpi_status iort_match_host_bridge_callback(struct acpi_iort_node *node, > + void *context) > +{ > + struct acpi_iort_root_complex *pci_rc; > + struct pci_host_bridge *host_bridge = context; > + > + pci_rc = (struct acpi_iort_root_complex *)node->node_data; > + > + return pci_domain_nr(host_bridge->bus) == pci_rc->pci_segment_number ? > + AE_OK : AE_NOT_FOUND; > +} > + > +void iort_pci_host_bridge_setup(struct pci_host_bridge *host_bridge) > +{ > + struct acpi_iort_node *node; > + struct acpi_iort_root_complex *pci_rc; > + > + node = iort_scan_node(ACPI_IORT_NODE_PCI_ROOT_COMPLEX, > + iort_match_host_bridge_callback, host_bridge); > + if (!node) > + return; > + > + pci_rc = (struct acpi_iort_root_complex *)node->node_data; > + host_bridge->ats_supported = !!(pci_rc->ats_attribute & > + ACPI_IORT_ATS_SUPPORTED); > +} > #else > static inline void iort_enable_acs(struct acpi_iort_node *iort_node) { } > #endif > diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c > index d1e666ef3fcc..eb2fb8f17c0b 100644 > --- a/drivers/acpi/pci_root.c > +++ b/drivers/acpi/pci_root.c > @@ -6,6 +6,7 @@ > * Copyright (C) 2001, 2002 Paul Diefenbaugh > */ > > +#include > #include > #include > #include > @@ -917,6 +918,8 @@ struct pci_bus *acpi_pci_root_create(struct acpi_pci_root *root, > if (!(root->osc_control_set & OSC_PCI_EXPRESS_LTR_CONTROL)) > host_bridge->native_ltr = 0; > > + iort_pci_host_bridge_setup(host_bridge); Similar comment as on the OF side. You mentioned at [1] that "it's important that we only enable ATS if the host bridge supports it". That should be captured in a commit log and comment somewhere here. That suggests to me that we should not set bridge->ats_supported = 1; by default in pci_init_host_bridge(), but rather leave it zero as it is by default, and then do things like: if (iort_pci_host_bridge_ats_supported(bridge)) bridge->ats_supported = 1; if (of_pci_host_bridge_ats_supported(bridge)) bridge->ats_supported = 1; I don't know what you do about IVRS and DMAR, which don't appear in this series except in the comment. [1] https://lore.kernel.org/r/20200213165049.508908-1-jean-philippe@linaro.org > /* > * Evaluate the "PCI Boot Configuration" _DSM Function. If it > * exists and returns 0, we must preserve any PCI resource > diff --git a/include/linux/acpi_iort.h b/include/linux/acpi_iort.h > index 8e7e2ec37f1b..7b06871cc3aa 100644 > --- a/include/linux/acpi_iort.h > +++ b/include/linux/acpi_iort.h > @@ -10,6 +10,7 @@ > #include > #include > #include > +#include > > #define IORT_IRQ_MASK(irq) (irq & 0xffffffffULL) > #define IORT_IRQ_TRIGGER_MASK(irq) ((irq >> 32) & 0xffffffffULL) > @@ -55,4 +56,11 @@ int iort_iommu_msi_get_resv_regions(struct device *dev, struct list_head *head) > { return 0; } > #endif > > +#if defined(CONFIG_ACPI_IORT) && defined(CONFIG_PCI) > +void iort_pci_host_bridge_setup(struct pci_host_bridge *host_bridge); > +#else > +static inline > +void iort_pci_host_bridge_setup(struct pci_host_bridge *host_bridge) { } > +#endif > + > #endif /* __ACPI_IORT_H__ */ > -- > 2.25.1 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel