linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] iommu/arm-smmu: request pcie devices to enable ACS
@ 2016-06-13  9:20 Wei Chen
  2016-06-13 11:18 ` Robin Murphy
  2016-06-13 12:45 ` Will Deacon
  0 siblings, 2 replies; 7+ messages in thread
From: Wei Chen @ 2016-06-13  9:20 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: iommu, linux-kernel, will.deacon, robin.murphy, joro, steve.capper

The PCIe ACS capability will affect the layout of iommu groups.
Generally speaking, if the path from root port to the PCIe device
is ACS enabled, the iommu will create a single iommu group for this
PCIe device. If all PCIe devices on the path are ACS enabled then
Linux can determine this path is ACS enabled.

Linux use two PCIe configuration registers to determine the ACS
status of PCIe devices:
ACS Capability Register and ACS Control Register.

The first register is used to check the implementation of ACS function
of a PCIe device, the second register is used to check the enable status
of ACS function. If one PCIe device has implemented and enabled the ACS
function then Linux will determine this PCIe device enabled ACS.

>From the Chapter:6.12 of PCI Express Base Specification Revision 3.1a,
we can find that when a PCIe device implements ACS function, the enable
status is set to disabled by default and can be enabled by ACS-aware
software.

ACS will affect the iommu groups topology, so, the iommu driver is
ACS-aware software. This patch adds a call to pci_request_acs() to the
arm-smmu driver to enable the ACS function in PCIe devices that support
it.

Signed-off-by: Wei Chen <Wei.Chen@arm.com>
---
 drivers/iommu/arm-smmu-v3.c | 2 ++
 drivers/iommu/arm-smmu.c    | 4 +++-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c
index 94b6821..30ea899 100644
--- a/drivers/iommu/arm-smmu-v3.c
+++ b/drivers/iommu/arm-smmu-v3.c
@@ -2686,6 +2686,8 @@ static int __init arm_smmu_init(void)
        if (ret)
                return ret;

+       pci_request_acs();
+
        return bus_set_iommu(&pci_bus_type, &arm_smmu_ops);
 }

diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c
index 9345a3f..ab365ec 100644
--- a/drivers/iommu/arm-smmu.c
+++ b/drivers/iommu/arm-smmu.c
@@ -2096,8 +2096,10 @@ static int __init arm_smmu_init(void)
 #endif

 #ifdef CONFIG_PCI
-       if (!iommu_present(&pci_bus_type))
+       if (!iommu_present(&pci_bus_type)) {
+               pci_request_acs();
                bus_set_iommu(&pci_bus_type, &arm_smmu_ops);
+       }
 #endif

        return 0;
--
2.7.4

IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] iommu/arm-smmu: request pcie devices to enable ACS
  2016-06-13  9:20 [PATCH] iommu/arm-smmu: request pcie devices to enable ACS Wei Chen
@ 2016-06-13 11:18 ` Robin Murphy
  2016-06-13 12:41   ` Auger Eric
  2016-06-13 12:45 ` Will Deacon
  1 sibling, 1 reply; 7+ messages in thread
From: Robin Murphy @ 2016-06-13 11:18 UTC (permalink / raw)
  To: Wei Chen, linux-arm-kernel; +Cc: steve.capper, will.deacon, linux-kernel, iommu

On 13/06/16 10:20, Wei Chen wrote:
> The PCIe ACS capability will affect the layout of iommu groups.
> Generally speaking, if the path from root port to the PCIe device
> is ACS enabled, the iommu will create a single iommu group for this
> PCIe device. If all PCIe devices on the path are ACS enabled then
> Linux can determine this path is ACS enabled.
>
> Linux use two PCIe configuration registers to determine the ACS
> status of PCIe devices:
> ACS Capability Register and ACS Control Register.
>
> The first register is used to check the implementation of ACS function
> of a PCIe device, the second register is used to check the enable status
> of ACS function. If one PCIe device has implemented and enabled the ACS
> function then Linux will determine this PCIe device enabled ACS.
>
>  From the Chapter:6.12 of PCI Express Base Specification Revision 3.1a,
> we can find that when a PCIe device implements ACS function, the enable
> status is set to disabled by default and can be enabled by ACS-aware
> software.
>
> ACS will affect the iommu groups topology, so, the iommu driver is
> ACS-aware software. This patch adds a call to pci_request_acs() to the
> arm-smmu driver to enable the ACS function in PCIe devices that support
> it.
>
> Signed-off-by: Wei Chen <Wei.Chen@arm.com>

Makes sense to me:

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

p.s. The confidential disclaimer is a good way to get patches ignored 
here on the lists - please check with Steve about getting set up on the 
appropriate SMTP server.

Robin.

> ---
>   drivers/iommu/arm-smmu-v3.c | 2 ++
>   drivers/iommu/arm-smmu.c    | 4 +++-
>   2 files changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c
> index 94b6821..30ea899 100644
> --- a/drivers/iommu/arm-smmu-v3.c
> +++ b/drivers/iommu/arm-smmu-v3.c
> @@ -2686,6 +2686,8 @@ static int __init arm_smmu_init(void)
>          if (ret)
>                  return ret;
>
> +       pci_request_acs();
> +
>          return bus_set_iommu(&pci_bus_type, &arm_smmu_ops);
>   }
>
> diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c
> index 9345a3f..ab365ec 100644
> --- a/drivers/iommu/arm-smmu.c
> +++ b/drivers/iommu/arm-smmu.c
> @@ -2096,8 +2096,10 @@ static int __init arm_smmu_init(void)
>   #endif
>
>   #ifdef CONFIG_PCI
> -       if (!iommu_present(&pci_bus_type))
> +       if (!iommu_present(&pci_bus_type)) {
> +               pci_request_acs();
>                  bus_set_iommu(&pci_bus_type, &arm_smmu_ops);
> +       }
>   #endif
>
>          return 0;
> --
> 2.7.4
>
> IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
>
> _______________________________________________
> iommu mailing list
> iommu@lists.linux-foundation.org
> https://lists.linuxfoundation.org/mailman/listinfo/iommu
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] iommu/arm-smmu: request pcie devices to enable ACS
  2016-06-13 11:18 ` Robin Murphy
@ 2016-06-13 12:41   ` Auger Eric
  0 siblings, 0 replies; 7+ messages in thread
From: Auger Eric @ 2016-06-13 12:41 UTC (permalink / raw)
  To: Robin Murphy, Wei Chen, linux-arm-kernel
  Cc: iommu, will.deacon, linux-kernel, steve.capper

Wei,
Le 13/06/2016 à 13:18, Robin Murphy a écrit :
> On 13/06/16 10:20, Wei Chen wrote:
>> The PCIe ACS capability will affect the layout of iommu groups.
>> Generally speaking, if the path from root port to the PCIe device
>> is ACS enabled, the iommu will create a single iommu group for this
>> PCIe device. If all PCIe devices on the path are ACS enabled then
>> Linux can determine this path is ACS enabled.
>>
>> Linux use two PCIe configuration registers to determine the ACS
>> status of PCIe devices:
>> ACS Capability Register and ACS Control Register.
>>
>> The first register is used to check the implementation of ACS function
>> of a PCIe device, the second register is used to check the enable status
>> of ACS function. If one PCIe device has implemented and enabled the ACS
>> function then Linux will determine this PCIe device enabled ACS.
>>
>>  From the Chapter:6.12 of PCI Express Base Specification Revision 3.1a,
>> we can find that when a PCIe device implements ACS function, the enable
>> status is set to disabled by default and can be enabled by ACS-aware
>> software.
>>
>> ACS will affect the iommu groups topology, so, the iommu driver is
>> ACS-aware software. This patch adds a call to pci_request_acs() to the
>> arm-smmu driver to enable the ACS function in PCIe devices that support
>> it.
nit: I would add ", when they get probed."

Besides Reviewed-by: Eric Auger <eric.auger@redhat.com>

Best Regards

Eric
>>
>> Signed-off-by: Wei Chen <Wei.Chen@arm.com>
> 
> Makes sense to me:
> 
> Reviewed-by: Robin Murphy <robin.murphy@arm.com>
> 
> p.s. The confidential disclaimer is a good way to get patches ignored
> here on the lists - please check with Steve about getting set up on the
> appropriate SMTP server.
> 
> Robin.
> 
>> ---
>>   drivers/iommu/arm-smmu-v3.c | 2 ++
>>   drivers/iommu/arm-smmu.c    | 4 +++-
>>   2 files changed, 5 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c
>> index 94b6821..30ea899 100644
>> --- a/drivers/iommu/arm-smmu-v3.c
>> +++ b/drivers/iommu/arm-smmu-v3.c
>> @@ -2686,6 +2686,8 @@ static int __init arm_smmu_init(void)
>>          if (ret)
>>                  return ret;
>>
>> +       pci_request_acs();
>> +
>>          return bus_set_iommu(&pci_bus_type, &arm_smmu_ops);
>>   }
>>
>> diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c
>> index 9345a3f..ab365ec 100644
>> --- a/drivers/iommu/arm-smmu.c
>> +++ b/drivers/iommu/arm-smmu.c
>> @@ -2096,8 +2096,10 @@ static int __init arm_smmu_init(void)
>>   #endif
>>
>>   #ifdef CONFIG_PCI
>> -       if (!iommu_present(&pci_bus_type))
>> +       if (!iommu_present(&pci_bus_type)) {
>> +               pci_request_acs();
>>                  bus_set_iommu(&pci_bus_type, &arm_smmu_ops);
>> +       }
>>   #endif
>>
>>          return 0;
>> -- 
>> 2.7.4
>>
>> IMPORTANT NOTICE: The contents of this email and any attachments are
>> confidential and may also be privileged. If you are not the intended
>> recipient, please notify the sender immediately and do not disclose
>> the contents to any other person, use it for any purpose, or store or
>> copy the information in any medium. Thank you.
>>
>> _______________________________________________
>> iommu mailing list
>> iommu@lists.linux-foundation.org
>> https://lists.linuxfoundation.org/mailman/listinfo/iommu
>>
> 
> _______________________________________________
> iommu mailing list
> iommu@lists.linux-foundation.org
> https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] iommu/arm-smmu: request pcie devices to enable ACS
  2016-06-13  9:20 [PATCH] iommu/arm-smmu: request pcie devices to enable ACS Wei Chen
  2016-06-13 11:18 ` Robin Murphy
@ 2016-06-13 12:45 ` Will Deacon
  2016-06-14  3:11   ` Wei Chen
  1 sibling, 1 reply; 7+ messages in thread
From: Will Deacon @ 2016-06-13 12:45 UTC (permalink / raw)
  To: Wei Chen
  Cc: linux-arm-kernel, iommu, linux-kernel, robin.murphy, joro, steve.capper

On Mon, Jun 13, 2016 at 05:20:17PM +0800, Wei Chen wrote:
> The PCIe ACS capability will affect the layout of iommu groups.
> Generally speaking, if the path from root port to the PCIe device
> is ACS enabled, the iommu will create a single iommu group for this
> PCIe device. If all PCIe devices on the path are ACS enabled then
> Linux can determine this path is ACS enabled.
> 
> Linux use two PCIe configuration registers to determine the ACS
> status of PCIe devices:
> ACS Capability Register and ACS Control Register.
> 
> The first register is used to check the implementation of ACS function
> of a PCIe device, the second register is used to check the enable status
> of ACS function. If one PCIe device has implemented and enabled the ACS
> function then Linux will determine this PCIe device enabled ACS.
> 
> From the Chapter:6.12 of PCI Express Base Specification Revision 3.1a,
> we can find that when a PCIe device implements ACS function, the enable
> status is set to disabled by default and can be enabled by ACS-aware
> software.
> 
> ACS will affect the iommu groups topology, so, the iommu driver is
> ACS-aware software. This patch adds a call to pci_request_acs() to the
> arm-smmu driver to enable the ACS function in PCIe devices that support
> it.
> 
> Signed-off-by: Wei Chen <Wei.Chen@arm.com>
> ---
>  drivers/iommu/arm-smmu-v3.c | 2 ++
>  drivers/iommu/arm-smmu.c    | 4 +++-
>  2 files changed, 5 insertions(+), 1 deletion(-)

Thanks, queued for 4.8 w/ Robin and Eric's reviewed-by tags and the minor
commit wording change.

Will

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] iommu/arm-smmu: request pcie devices to enable ACS
  2016-06-13 12:45 ` Will Deacon
@ 2016-06-14  3:11   ` Wei Chen
  2016-06-14  8:56     ` Will Deacon
  0 siblings, 1 reply; 7+ messages in thread
From: Wei Chen @ 2016-06-14  3:11 UTC (permalink / raw)
  To: Will Deacon
  Cc: Wei Chen, steve.capper, joro, linux-kernel, iommu, robin.murphy,
	linux-arm-kernel

On 13 June 2016 at 20:45, Will Deacon <will.deacon@arm.com> wrote:
> On Mon, Jun 13, 2016 at 05:20:17PM +0800, Wei Chen wrote:
>> The PCIe ACS capability will affect the layout of iommu groups.
>> Generally speaking, if the path from root port to the PCIe device
>> is ACS enabled, the iommu will create a single iommu group for this
>> PCIe device. If all PCIe devices on the path are ACS enabled then
>> Linux can determine this path is ACS enabled.
>>
>> Linux use two PCIe configuration registers to determine the ACS
>> status of PCIe devices:
>> ACS Capability Register and ACS Control Register.
>>
>> The first register is used to check the implementation of ACS function
>> of a PCIe device, the second register is used to check the enable status
>> of ACS function. If one PCIe device has implemented and enabled the ACS
>> function then Linux will determine this PCIe device enabled ACS.
>>
>> From the Chapter:6.12 of PCI Express Base Specification Revision 3.1a,
>> we can find that when a PCIe device implements ACS function, the enable
>> status is set to disabled by default and can be enabled by ACS-aware
>> software.
>>
>> ACS will affect the iommu groups topology, so, the iommu driver is
>> ACS-aware software. This patch adds a call to pci_request_acs() to the
>> arm-smmu driver to enable the ACS function in PCIe devices that support
>> it.
>>
>> Signed-off-by: Wei Chen <Wei.Chen@arm.com>
>> ---
>>  drivers/iommu/arm-smmu-v3.c | 2 ++
>>  drivers/iommu/arm-smmu.c    | 4 +++-
>>  2 files changed, 5 insertions(+), 1 deletion(-)
>
> Thanks, queued for 4.8 w/ Robin and Eric's reviewed-by tags and the minor
> commit wording change.
>

Thanks, I will post a v2 patch to include above changes.

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] iommu/arm-smmu: request pcie devices to enable ACS
  2016-06-14  3:11   ` Wei Chen
@ 2016-06-14  8:56     ` Will Deacon
  2016-06-14 10:00       ` Wei Chen
  0 siblings, 1 reply; 7+ messages in thread
From: Will Deacon @ 2016-06-14  8:56 UTC (permalink / raw)
  To: Wei Chen
  Cc: Wei Chen, steve.capper, joro, linux-kernel, iommu, robin.murphy,
	linux-arm-kernel

On Tue, Jun 14, 2016 at 11:11:36AM +0800, Wei Chen wrote:
> On 13 June 2016 at 20:45, Will Deacon <will.deacon@arm.com> wrote:
> > On Mon, Jun 13, 2016 at 05:20:17PM +0800, Wei Chen wrote:
> >> The PCIe ACS capability will affect the layout of iommu groups.
> >> Generally speaking, if the path from root port to the PCIe device
> >> is ACS enabled, the iommu will create a single iommu group for this
> >> PCIe device. If all PCIe devices on the path are ACS enabled then
> >> Linux can determine this path is ACS enabled.
> >>
> >> Linux use two PCIe configuration registers to determine the ACS
> >> status of PCIe devices:
> >> ACS Capability Register and ACS Control Register.
> >>
> >> The first register is used to check the implementation of ACS function
> >> of a PCIe device, the second register is used to check the enable status
> >> of ACS function. If one PCIe device has implemented and enabled the ACS
> >> function then Linux will determine this PCIe device enabled ACS.
> >>
> >> From the Chapter:6.12 of PCI Express Base Specification Revision 3.1a,
> >> we can find that when a PCIe device implements ACS function, the enable
> >> status is set to disabled by default and can be enabled by ACS-aware
> >> software.
> >>
> >> ACS will affect the iommu groups topology, so, the iommu driver is
> >> ACS-aware software. This patch adds a call to pci_request_acs() to the
> >> arm-smmu driver to enable the ACS function in PCIe devices that support
> >> it.
> >>
> >> Signed-off-by: Wei Chen <Wei.Chen@arm.com>
> >> ---
> >>  drivers/iommu/arm-smmu-v3.c | 2 ++
> >>  drivers/iommu/arm-smmu.c    | 4 +++-
> >>  2 files changed, 5 insertions(+), 1 deletion(-)
> >
> > Thanks, queued for 4.8 w/ Robin and Eric's reviewed-by tags and the minor
> > commit wording change.
> >
> 
> Thanks, I will post a v2 patch to include above changes.

:/ As above, I've already queued this.

Will

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [PATCH] iommu/arm-smmu: request pcie devices to enable ACS
  2016-06-14  8:56     ` Will Deacon
@ 2016-06-14 10:00       ` Wei Chen
  0 siblings, 0 replies; 7+ messages in thread
From: Wei Chen @ 2016-06-14 10:00 UTC (permalink / raw)
  To: Will Deacon, Wei Chen
  Cc: Steve Capper, joro, linux-kernel, iommu, Robin Murphy, linux-arm-kernel



> -----Original Message-----
> From: Will Deacon [mailto:will.deacon@arm.com]
> Sent: 2016年6月14日 16:56
> To: Wei Chen
> Cc: Wei Chen; Steve Capper; joro@8bytes.org; linux-kernel@vger.kernel.org;
> iommu@lists.linux-foundation.org; Robin Murphy; linux-arm-
> kernel@lists.infradead.org
> Subject: Re: [PATCH] iommu/arm-smmu: request pcie devices to enable ACS
>
> On Tue, Jun 14, 2016 at 11:11:36AM +0800, Wei Chen wrote:
> > On 13 June 2016 at 20:45, Will Deacon <will.deacon@arm.com> wrote:
> > > On Mon, Jun 13, 2016 at 05:20:17PM +0800, Wei Chen wrote:
> > >> The PCIe ACS capability will affect the layout of iommu groups.
> > >> Generally speaking, if the path from root port to the PCIe device
> > >> is ACS enabled, the iommu will create a single iommu group for this
> > >> PCIe device. If all PCIe devices on the path are ACS enabled then
> > >> Linux can determine this path is ACS enabled.
> > >>
> > >> Linux use two PCIe configuration registers to determine the ACS
> > >> status of PCIe devices:
> > >> ACS Capability Register and ACS Control Register.
> > >>
> > >> The first register is used to check the implementation of ACS
> > >> function of a PCIe device, the second register is used to check the
> > >> enable status of ACS function. If one PCIe device has implemented
> > >> and enabled the ACS function then Linux will determine this PCIe
> device enabled ACS.
> > >>
> > >> From the Chapter:6.12 of PCI Express Base Specification Revision
> > >> 3.1a, we can find that when a PCIe device implements ACS function,
> > >> the enable status is set to disabled by default and can be enabled
> > >> by ACS-aware software.
> > >>
> > >> ACS will affect the iommu groups topology, so, the iommu driver is
> > >> ACS-aware software. This patch adds a call to pci_request_acs() to
> > >> the arm-smmu driver to enable the ACS function in PCIe devices that
> > >> support it.
> > >>
> > >> Signed-off-by: Wei Chen <Wei.Chen@arm.com>
> > >> ---
> > >>  drivers/iommu/arm-smmu-v3.c | 2 ++
> > >>  drivers/iommu/arm-smmu.c    | 4 +++-
> > >>  2 files changed, 5 insertions(+), 1 deletion(-)
> > >
> > > Thanks, queued for 4.8 w/ Robin and Eric's reviewed-by tags and the
> > > minor commit wording change.
> > >
> >
> > Thanks, I will post a v2 patch to include above changes.
>
> :/ As above, I've already queued this.
Oh, thank you :)
>
> Will

IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-06-14 10:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-13  9:20 [PATCH] iommu/arm-smmu: request pcie devices to enable ACS Wei Chen
2016-06-13 11:18 ` Robin Murphy
2016-06-13 12:41   ` Auger Eric
2016-06-13 12:45 ` Will Deacon
2016-06-14  3:11   ` Wei Chen
2016-06-14  8:56     ` Will Deacon
2016-06-14 10:00       ` Wei Chen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).