All of lore.kernel.org
 help / color / mirror / Atom feed
From: Robin Murphy <robin.murphy@arm.com>
To: Jean-Philippe Brucker <jean-philippe@linaro.org>,
	will@kernel.org, lpieralisi@kernel.org, kw@linux.com,
	robh@kernel.org, bhelgaas@google.com, krzk+dt@kernel.org,
	conor+dt@kernel.org, liviu.dudau@arm.com, sudeep.holla@arm.com,
	joro@8bytes.org
Cc: nicolinc@nvidia.com, ketanp@nvidia.com,
	linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	iommu@lists.linux.dev, devicetree@vger.kernel.org
Subject: Re: [PATCH 2/3] iommu/of: Support ats-supported device-tree property
Date: Tue, 30 Apr 2024 14:57:42 +0100	[thread overview]
Message-ID: <46eba57e-edbf-4fe5-8cc6-5fe11bf7aca0@arm.com> (raw)
In-Reply-To: <20240429113938.192706-4-jean-philippe@linaro.org>

On 29/04/2024 12:39 pm, Jean-Philippe Brucker wrote:
> Device-tree declares whether a PCI root-complex supports ATS by setting
> the "ats-supported" property. Copy this flag into device fwspec to let
> IOMMU drivers quickly check if they can enable ATS for a device.

I don't think this functionally conflicts with what I've got going on in 
this area at the moment, and although the way it fits around the other 
error handling seems a bit obtuse and clunky IMO, apparently that's the 
fault of the existing ACPI implementation, so for now,

Reviewed-by: Robin Murphy <robin.murphy@arm.com>

> Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
> Tested-by: Ketan Patil <ketanp@nvidia.com>
> ---
>   drivers/iommu/of_iommu.c | 9 +++++++++
>   1 file changed, 9 insertions(+)
> 
> diff --git a/drivers/iommu/of_iommu.c b/drivers/iommu/of_iommu.c
> index 3afe0b48a48db..082b94c2b3291 100644
> --- a/drivers/iommu/of_iommu.c
> +++ b/drivers/iommu/of_iommu.c
> @@ -105,6 +105,14 @@ static int of_iommu_configure_device(struct device_node *master_np,
>   		      of_iommu_configure_dev(master_np, dev);
>   }
>   
> +static void of_pci_check_device_ats(struct device *dev, struct device_node *np)
> +{
> +	struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(dev);
> +
> +	if (fwspec && of_property_read_bool(np, "ats-supported"))
> +		fwspec->flags |= IOMMU_FWSPEC_PCI_RC_ATS;
> +}
> +
>   /*
>    * Returns:
>    *  0 on success, an iommu was configured
> @@ -147,6 +155,7 @@ int of_iommu_configure(struct device *dev, struct device_node *master_np,
>   		pci_request_acs();
>   		err = pci_for_each_dma_alias(to_pci_dev(dev),
>   					     of_pci_iommu_init, &info);
> +		of_pci_check_device_ats(dev, master_np);
>   	} else {
>   		err = of_iommu_configure_device(master_np, dev, id);
>   	}

WARNING: multiple messages have this Message-ID (diff)
From: Robin Murphy <robin.murphy@arm.com>
To: Jean-Philippe Brucker <jean-philippe@linaro.org>,
	will@kernel.org, lpieralisi@kernel.org, kw@linux.com,
	robh@kernel.org, bhelgaas@google.com, krzk+dt@kernel.org,
	conor+dt@kernel.org, liviu.dudau@arm.com, sudeep.holla@arm.com,
	joro@8bytes.org
Cc: nicolinc@nvidia.com, ketanp@nvidia.com,
	linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	iommu@lists.linux.dev, devicetree@vger.kernel.org
Subject: Re: [PATCH 2/3] iommu/of: Support ats-supported device-tree property
Date: Tue, 30 Apr 2024 14:57:42 +0100	[thread overview]
Message-ID: <46eba57e-edbf-4fe5-8cc6-5fe11bf7aca0@arm.com> (raw)
In-Reply-To: <20240429113938.192706-4-jean-philippe@linaro.org>

On 29/04/2024 12:39 pm, Jean-Philippe Brucker wrote:
> Device-tree declares whether a PCI root-complex supports ATS by setting
> the "ats-supported" property. Copy this flag into device fwspec to let
> IOMMU drivers quickly check if they can enable ATS for a device.

I don't think this functionally conflicts with what I've got going on in 
this area at the moment, and although the way it fits around the other 
error handling seems a bit obtuse and clunky IMO, apparently that's the 
fault of the existing ACPI implementation, so for now,

Reviewed-by: Robin Murphy <robin.murphy@arm.com>

> Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
> Tested-by: Ketan Patil <ketanp@nvidia.com>
> ---
>   drivers/iommu/of_iommu.c | 9 +++++++++
>   1 file changed, 9 insertions(+)
> 
> diff --git a/drivers/iommu/of_iommu.c b/drivers/iommu/of_iommu.c
> index 3afe0b48a48db..082b94c2b3291 100644
> --- a/drivers/iommu/of_iommu.c
> +++ b/drivers/iommu/of_iommu.c
> @@ -105,6 +105,14 @@ static int of_iommu_configure_device(struct device_node *master_np,
>   		      of_iommu_configure_dev(master_np, dev);
>   }
>   
> +static void of_pci_check_device_ats(struct device *dev, struct device_node *np)
> +{
> +	struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(dev);
> +
> +	if (fwspec && of_property_read_bool(np, "ats-supported"))
> +		fwspec->flags |= IOMMU_FWSPEC_PCI_RC_ATS;
> +}
> +
>   /*
>    * Returns:
>    *  0 on success, an iommu was configured
> @@ -147,6 +155,7 @@ int of_iommu_configure(struct device *dev, struct device_node *master_np,
>   		pci_request_acs();
>   		err = pci_for_each_dma_alias(to_pci_dev(dev),
>   					     of_pci_iommu_init, &info);
> +		of_pci_check_device_ats(dev, master_np);
>   	} else {
>   		err = of_iommu_configure_device(master_np, dev, id);
>   	}

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2024-04-30 13:57 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-29 11:39 [PATCH 0/3] Enable PCIe ATS for devicetree boot Jean-Philippe Brucker
2024-04-29 11:39 ` Jean-Philippe Brucker
2024-04-29 11:39 ` [PATCH 1/3] dt-bindings: PCI: generic: Add ats-supported property Jean-Philippe Brucker
2024-04-29 11:39   ` Jean-Philippe Brucker
2024-04-30 10:22   ` Liviu Dudau
2024-04-30 10:22     ` Liviu Dudau
2024-04-29 11:39 ` [PATCH 2/3] iommu/of: Support ats-supported device-tree property Jean-Philippe Brucker
2024-04-29 11:39   ` Jean-Philippe Brucker
2024-04-29 15:00   ` Jason Gunthorpe
2024-04-29 15:00     ` Jason Gunthorpe
2024-04-30 10:23   ` Liviu Dudau
2024-04-30 10:23     ` Liviu Dudau
2024-04-30 13:57   ` Robin Murphy [this message]
2024-04-30 13:57     ` Robin Murphy
2024-05-02  4:55   ` Nicolin Chen
2024-05-02  4:55     ` Nicolin Chen
2024-04-29 11:39 ` [PATCH 3/3] arm64: dts: fvp: Enable PCIe ATS for Base RevC FVP Jean-Philippe Brucker
2024-04-29 11:39   ` Jean-Philippe Brucker
2024-05-16 10:44   ` Sudeep Holla
2024-05-16 10:44     ` Sudeep Holla
2024-05-15 18:28 ` [PATCH 0/3] Enable PCIe ATS for devicetree boot Vidya Sagar
2024-05-15 18:28   ` Vidya Sagar
2024-05-15 18:52   ` Bjorn Helgaas
2024-05-15 18:52     ` Bjorn Helgaas
2024-05-16  7:35     ` Jean-Philippe Brucker
2024-05-16  7:35       ` Jean-Philippe Brucker
2024-05-16 10:41       ` Sudeep Holla
2024-05-16 10:41         ` Sudeep Holla
2024-05-16 11:42         ` Jean-Philippe Brucker
2024-05-16 11:42           ` Jean-Philippe Brucker
2024-05-21 10:25         ` liviu.dudau
2024-05-21 10:25           ` liviu.dudau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=46eba57e-edbf-4fe5-8cc6-5fe11bf7aca0@arm.com \
    --to=robin.murphy@arm.com \
    --cc=bhelgaas@google.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=iommu@lists.linux.dev \
    --cc=jean-philippe@linaro.org \
    --cc=joro@8bytes.org \
    --cc=ketanp@nvidia.com \
    --cc=krzk+dt@kernel.org \
    --cc=kw@linux.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=liviu.dudau@arm.com \
    --cc=lpieralisi@kernel.org \
    --cc=nicolinc@nvidia.com \
    --cc=robh@kernel.org \
    --cc=sudeep.holla@arm.com \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.