All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ACPI/IORT: Fix build error when IOMMU_SUPPORT disabled
@ 2019-05-15  3:34 ` Kefeng Wang
  0 siblings, 0 replies; 16+ messages in thread
From: Kefeng Wang @ 2019-05-15  3:34 UTC (permalink / raw)
  To: linux-acpi, linux-arm-kernel
  Cc: guohanjun, Kefeng Wang, Jean-Philippe Brucker, Lorenzo Pieralisi,
	Will Deacon

drivers/acpi/arm64/iort.c: In function iort_iommu_configure:
drivers/acpi/arm64/iort.c:1079:21: error: struct iommu_fwspec has no member named flags
    dev->iommu_fwspec->flags |= IOMMU_FWSPEC_PCI_RC_ATS;
                     ^~
drivers/acpi/arm64/iort.c:1079:32: error: IOMMU_FWSPEC_PCI_RC_ATS
undeclared (first use in this function)
    dev->iommu_fwspec->flags |= IOMMU_FWSPEC_PCI_RC_ATS;
                                ^~~~~~~~~~~~~~~~~~~~~~~
drivers/acpi/arm64/iort.c:1079:32: note: each undeclared identifier is reported only once for each function it appears in

Cc: Jean-Philippe Brucker <jean-philippe.brucker@arm.com>
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Fixes: 5702ee24182f ("ACPI/IORT: Check ATS capability in root complex nodes")
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 drivers/acpi/arm64/iort.c | 2 +-
 include/linux/iommu.h     | 9 +++++++++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/acpi/arm64/iort.c b/drivers/acpi/arm64/iort.c
index 9058cb084b91..4ccf0dd99852 100644
--- a/drivers/acpi/arm64/iort.c
+++ b/drivers/acpi/arm64/iort.c
@@ -1076,7 +1076,7 @@ const struct iommu_ops *iort_iommu_configure(struct device *dev)
 					     iort_pci_iommu_init, &info);
 
 		if (!err && iort_pci_rc_supports_ats(node))
-			dev->iommu_fwspec->flags |= IOMMU_FWSPEC_PCI_RC_ATS;
+			iommu_fwspec_set_ats_flags(dev);
 	} else {
 		int i = 0;
 
diff --git a/include/linux/iommu.h b/include/linux/iommu.h
index a815cf6f6f47..0a84556c0eb6 100644
--- a/include/linux/iommu.h
+++ b/include/linux/iommu.h
@@ -479,6 +479,11 @@ static inline void dev_iommu_fwspec_set(struct device *dev,
 	dev->iommu_fwspec = fwspec;
 }
 
+static inline void iommu_fwspec_set_ats_flags(struct device *dev)
+{
+	dev->iommu_fwspec->flags |= IOMMU_FWSPEC_PCI_RC_ATS;
+}
+
 int iommu_probe_device(struct device *dev);
 void iommu_release_device(struct device *dev);
 
@@ -770,6 +775,10 @@ static inline void iommu_fwspec_free(struct device *dev)
 {
 }
 
+static inline void iommu_fwspec_set_ats_flags(struct device *dev)
+{
+}
+
 static inline int iommu_fwspec_add_ids(struct device *dev, u32 *ids,
 				       int num_ids)
 {
-- 
2.20.1


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

* [PATCH] ACPI/IORT: Fix build error when IOMMU_SUPPORT disabled
@ 2019-05-15  3:34 ` Kefeng Wang
  0 siblings, 0 replies; 16+ messages in thread
From: Kefeng Wang @ 2019-05-15  3:34 UTC (permalink / raw)
  To: linux-acpi, linux-arm-kernel
  Cc: Jean-Philippe Brucker, Kefeng Wang, Lorenzo Pieralisi,
	Will Deacon, guohanjun

drivers/acpi/arm64/iort.c: In function iort_iommu_configure:
drivers/acpi/arm64/iort.c:1079:21: error: struct iommu_fwspec has no member named flags
    dev->iommu_fwspec->flags |= IOMMU_FWSPEC_PCI_RC_ATS;
                     ^~
drivers/acpi/arm64/iort.c:1079:32: error: IOMMU_FWSPEC_PCI_RC_ATS
undeclared (first use in this function)
    dev->iommu_fwspec->flags |= IOMMU_FWSPEC_PCI_RC_ATS;
                                ^~~~~~~~~~~~~~~~~~~~~~~
drivers/acpi/arm64/iort.c:1079:32: note: each undeclared identifier is reported only once for each function it appears in

Cc: Jean-Philippe Brucker <jean-philippe.brucker@arm.com>
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Fixes: 5702ee24182f ("ACPI/IORT: Check ATS capability in root complex nodes")
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 drivers/acpi/arm64/iort.c | 2 +-
 include/linux/iommu.h     | 9 +++++++++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/acpi/arm64/iort.c b/drivers/acpi/arm64/iort.c
index 9058cb084b91..4ccf0dd99852 100644
--- a/drivers/acpi/arm64/iort.c
+++ b/drivers/acpi/arm64/iort.c
@@ -1076,7 +1076,7 @@ const struct iommu_ops *iort_iommu_configure(struct device *dev)
 					     iort_pci_iommu_init, &info);
 
 		if (!err && iort_pci_rc_supports_ats(node))
-			dev->iommu_fwspec->flags |= IOMMU_FWSPEC_PCI_RC_ATS;
+			iommu_fwspec_set_ats_flags(dev);
 	} else {
 		int i = 0;
 
diff --git a/include/linux/iommu.h b/include/linux/iommu.h
index a815cf6f6f47..0a84556c0eb6 100644
--- a/include/linux/iommu.h
+++ b/include/linux/iommu.h
@@ -479,6 +479,11 @@ static inline void dev_iommu_fwspec_set(struct device *dev,
 	dev->iommu_fwspec = fwspec;
 }
 
+static inline void iommu_fwspec_set_ats_flags(struct device *dev)
+{
+	dev->iommu_fwspec->flags |= IOMMU_FWSPEC_PCI_RC_ATS;
+}
+
 int iommu_probe_device(struct device *dev);
 void iommu_release_device(struct device *dev);
 
@@ -770,6 +775,10 @@ static inline void iommu_fwspec_free(struct device *dev)
 {
 }
 
+static inline void iommu_fwspec_set_ats_flags(struct device *dev)
+{
+}
+
 static inline int iommu_fwspec_add_ids(struct device *dev, u32 *ids,
 				       int num_ids)
 {
-- 
2.20.1


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

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

* [PATCH RESEND] ACPI/IORT: Fix build error when IOMMU_SUPPORT disabled
  2019-05-15  3:34 ` Kefeng Wang
@ 2019-05-15  3:42   ` Kefeng Wang
  -1 siblings, 0 replies; 16+ messages in thread
From: Kefeng Wang @ 2019-05-15  3:42 UTC (permalink / raw)
  To: linux-acpi, linux-arm-kernel
  Cc: guohanjun, Kefeng Wang, Jean-Philippe Brucker, Lorenzo Pieralisi,
	Will Deacon, Hulk Robot

drivers/acpi/arm64/iort.c: In function iort_iommu_configure:
drivers/acpi/arm64/iort.c:1079:21: error: struct iommu_fwspec has no member named flags
    dev->iommu_fwspec->flags |= IOMMU_FWSPEC_PCI_RC_ATS;
                     ^~
drivers/acpi/arm64/iort.c:1079:32: error: IOMMU_FWSPEC_PCI_RC_ATS
undeclared (first use in this function)
    dev->iommu_fwspec->flags |= IOMMU_FWSPEC_PCI_RC_ATS;
                                ^~~~~~~~~~~~~~~~~~~~~~~
drivers/acpi/arm64/iort.c:1079:32: note: each undeclared identifier is reported only once for each function it appears in

If IOMMU_SUPPORT not enabled, struct iommu_fwspec without members and
IOMMU_FWSPEC_PCI_RC_ATS not defined, add new iommu_fwspec_set_ats_flags()
to set IOMMU_FWSPEC_PCI_RC_ATS flags to solve build error.

Cc: Jean-Philippe Brucker <jean-philippe.brucker@arm.com>
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Reported-by: Hulk Robot <hulkci@huawei.com>
Fixes: 5702ee24182f ("ACPI/IORT: Check ATS capability in root complex nodes")
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 drivers/acpi/arm64/iort.c | 2 +-
 include/linux/iommu.h     | 9 +++++++++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/acpi/arm64/iort.c b/drivers/acpi/arm64/iort.c
index 9058cb084b91..4ccf0dd99852 100644
--- a/drivers/acpi/arm64/iort.c
+++ b/drivers/acpi/arm64/iort.c
@@ -1076,7 +1076,7 @@ const struct iommu_ops *iort_iommu_configure(struct device *dev)
 					     iort_pci_iommu_init, &info);
 
 		if (!err && iort_pci_rc_supports_ats(node))
-			dev->iommu_fwspec->flags |= IOMMU_FWSPEC_PCI_RC_ATS;
+			iommu_fwspec_set_ats_flags(dev);
 	} else {
 		int i = 0;
 
diff --git a/include/linux/iommu.h b/include/linux/iommu.h
index a815cf6f6f47..0a84556c0eb6 100644
--- a/include/linux/iommu.h
+++ b/include/linux/iommu.h
@@ -479,6 +479,11 @@ static inline void dev_iommu_fwspec_set(struct device *dev,
 	dev->iommu_fwspec = fwspec;
 }
 
+static inline void iommu_fwspec_set_ats_flags(struct device *dev)
+{
+	dev->iommu_fwspec->flags |= IOMMU_FWSPEC_PCI_RC_ATS;
+}
+
 int iommu_probe_device(struct device *dev);
 void iommu_release_device(struct device *dev);
 
@@ -770,6 +775,10 @@ static inline void iommu_fwspec_free(struct device *dev)
 {
 }
 
+static inline void iommu_fwspec_set_ats_flags(struct device *dev)
+{
+}
+
 static inline int iommu_fwspec_add_ids(struct device *dev, u32 *ids,
 				       int num_ids)
 {
-- 
2.20.1


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

* [PATCH RESEND] ACPI/IORT: Fix build error when IOMMU_SUPPORT disabled
@ 2019-05-15  3:42   ` Kefeng Wang
  0 siblings, 0 replies; 16+ messages in thread
From: Kefeng Wang @ 2019-05-15  3:42 UTC (permalink / raw)
  To: linux-acpi, linux-arm-kernel
  Cc: Kefeng Wang, Lorenzo Pieralisi, Jean-Philippe Brucker,
	Will Deacon, Hulk Robot, guohanjun

drivers/acpi/arm64/iort.c: In function iort_iommu_configure:
drivers/acpi/arm64/iort.c:1079:21: error: struct iommu_fwspec has no member named flags
    dev->iommu_fwspec->flags |= IOMMU_FWSPEC_PCI_RC_ATS;
                     ^~
drivers/acpi/arm64/iort.c:1079:32: error: IOMMU_FWSPEC_PCI_RC_ATS
undeclared (first use in this function)
    dev->iommu_fwspec->flags |= IOMMU_FWSPEC_PCI_RC_ATS;
                                ^~~~~~~~~~~~~~~~~~~~~~~
drivers/acpi/arm64/iort.c:1079:32: note: each undeclared identifier is reported only once for each function it appears in

If IOMMU_SUPPORT not enabled, struct iommu_fwspec without members and
IOMMU_FWSPEC_PCI_RC_ATS not defined, add new iommu_fwspec_set_ats_flags()
to set IOMMU_FWSPEC_PCI_RC_ATS flags to solve build error.

Cc: Jean-Philippe Brucker <jean-philippe.brucker@arm.com>
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Reported-by: Hulk Robot <hulkci@huawei.com>
Fixes: 5702ee24182f ("ACPI/IORT: Check ATS capability in root complex nodes")
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 drivers/acpi/arm64/iort.c | 2 +-
 include/linux/iommu.h     | 9 +++++++++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/acpi/arm64/iort.c b/drivers/acpi/arm64/iort.c
index 9058cb084b91..4ccf0dd99852 100644
--- a/drivers/acpi/arm64/iort.c
+++ b/drivers/acpi/arm64/iort.c
@@ -1076,7 +1076,7 @@ const struct iommu_ops *iort_iommu_configure(struct device *dev)
 					     iort_pci_iommu_init, &info);
 
 		if (!err && iort_pci_rc_supports_ats(node))
-			dev->iommu_fwspec->flags |= IOMMU_FWSPEC_PCI_RC_ATS;
+			iommu_fwspec_set_ats_flags(dev);
 	} else {
 		int i = 0;
 
diff --git a/include/linux/iommu.h b/include/linux/iommu.h
index a815cf6f6f47..0a84556c0eb6 100644
--- a/include/linux/iommu.h
+++ b/include/linux/iommu.h
@@ -479,6 +479,11 @@ static inline void dev_iommu_fwspec_set(struct device *dev,
 	dev->iommu_fwspec = fwspec;
 }
 
+static inline void iommu_fwspec_set_ats_flags(struct device *dev)
+{
+	dev->iommu_fwspec->flags |= IOMMU_FWSPEC_PCI_RC_ATS;
+}
+
 int iommu_probe_device(struct device *dev);
 void iommu_release_device(struct device *dev);
 
@@ -770,6 +775,10 @@ static inline void iommu_fwspec_free(struct device *dev)
 {
 }
 
+static inline void iommu_fwspec_set_ats_flags(struct device *dev)
+{
+}
+
 static inline int iommu_fwspec_add_ids(struct device *dev, u32 *ids,
 				       int num_ids)
 {
-- 
2.20.1


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

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

* Re: [PATCH RESEND] ACPI/IORT: Fix build error when IOMMU_SUPPORT disabled
  2019-05-15  3:42   ` Kefeng Wang
@ 2019-05-15 10:15     ` Will Deacon
  -1 siblings, 0 replies; 16+ messages in thread
From: Will Deacon @ 2019-05-15 10:15 UTC (permalink / raw)
  To: Kefeng Wang
  Cc: linux-acpi, linux-arm-kernel, guohanjun, Jean-Philippe Brucker,
	Lorenzo Pieralisi, Hulk Robot

On Wed, May 15, 2019 at 11:42:53AM +0800, Kefeng Wang wrote:
> drivers/acpi/arm64/iort.c: In function iort_iommu_configure:
> drivers/acpi/arm64/iort.c:1079:21: error: struct iommu_fwspec has no member named flags
>     dev->iommu_fwspec->flags |= IOMMU_FWSPEC_PCI_RC_ATS;
>                      ^~
> drivers/acpi/arm64/iort.c:1079:32: error: IOMMU_FWSPEC_PCI_RC_ATS
> undeclared (first use in this function)
>     dev->iommu_fwspec->flags |= IOMMU_FWSPEC_PCI_RC_ATS;
>                                 ^~~~~~~~~~~~~~~~~~~~~~~
> drivers/acpi/arm64/iort.c:1079:32: note: each undeclared identifier is reported only once for each function it appears in
> 
> If IOMMU_SUPPORT not enabled, struct iommu_fwspec without members and
> IOMMU_FWSPEC_PCI_RC_ATS not defined, add new iommu_fwspec_set_ats_flags()
> to set IOMMU_FWSPEC_PCI_RC_ATS flags to solve build error.
> 
> Cc: Jean-Philippe Brucker <jean-philippe.brucker@arm.com>
> Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> Cc: Will Deacon <will.deacon@arm.com>
> Reported-by: Hulk Robot <hulkci@huawei.com>

What's this "Hulk Robot"? Does it report things publicly?

Anyway, I can pick this up if Lorenzo acks it.

Will

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

* Re: [PATCH RESEND] ACPI/IORT: Fix build error when IOMMU_SUPPORT disabled
@ 2019-05-15 10:15     ` Will Deacon
  0 siblings, 0 replies; 16+ messages in thread
From: Will Deacon @ 2019-05-15 10:15 UTC (permalink / raw)
  To: Kefeng Wang
  Cc: Lorenzo Pieralisi, Hulk Robot, Jean-Philippe Brucker, linux-acpi,
	guohanjun, linux-arm-kernel

On Wed, May 15, 2019 at 11:42:53AM +0800, Kefeng Wang wrote:
> drivers/acpi/arm64/iort.c: In function iort_iommu_configure:
> drivers/acpi/arm64/iort.c:1079:21: error: struct iommu_fwspec has no member named flags
>     dev->iommu_fwspec->flags |= IOMMU_FWSPEC_PCI_RC_ATS;
>                      ^~
> drivers/acpi/arm64/iort.c:1079:32: error: IOMMU_FWSPEC_PCI_RC_ATS
> undeclared (first use in this function)
>     dev->iommu_fwspec->flags |= IOMMU_FWSPEC_PCI_RC_ATS;
>                                 ^~~~~~~~~~~~~~~~~~~~~~~
> drivers/acpi/arm64/iort.c:1079:32: note: each undeclared identifier is reported only once for each function it appears in
> 
> If IOMMU_SUPPORT not enabled, struct iommu_fwspec without members and
> IOMMU_FWSPEC_PCI_RC_ATS not defined, add new iommu_fwspec_set_ats_flags()
> to set IOMMU_FWSPEC_PCI_RC_ATS flags to solve build error.
> 
> Cc: Jean-Philippe Brucker <jean-philippe.brucker@arm.com>
> Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> Cc: Will Deacon <will.deacon@arm.com>
> Reported-by: Hulk Robot <hulkci@huawei.com>

What's this "Hulk Robot"? Does it report things publicly?

Anyway, I can pick this up if Lorenzo acks it.

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] 16+ messages in thread

* Re: [PATCH RESEND] ACPI/IORT: Fix build error when IOMMU_SUPPORT disabled
  2019-05-15 10:15     ` Will Deacon
@ 2019-05-15 12:06       ` Lorenzo Pieralisi
  -1 siblings, 0 replies; 16+ messages in thread
From: Lorenzo Pieralisi @ 2019-05-15 12:06 UTC (permalink / raw)
  To: Will Deacon
  Cc: Kefeng Wang, linux-acpi, linux-arm-kernel, guohanjun,
	Jean-Philippe Brucker, Hulk Robot, robin.murphy, joro

[+Joerg, Robin]

On Wed, May 15, 2019 at 11:15:34AM +0100, Will Deacon wrote:
> On Wed, May 15, 2019 at 11:42:53AM +0800, Kefeng Wang wrote:
> > drivers/acpi/arm64/iort.c: In function iort_iommu_configure:
> > drivers/acpi/arm64/iort.c:1079:21: error: struct iommu_fwspec has no member named flags
> >     dev->iommu_fwspec->flags |= IOMMU_FWSPEC_PCI_RC_ATS;
> >                      ^~
> > drivers/acpi/arm64/iort.c:1079:32: error: IOMMU_FWSPEC_PCI_RC_ATS
> > undeclared (first use in this function)
> >     dev->iommu_fwspec->flags |= IOMMU_FWSPEC_PCI_RC_ATS;
> >                                 ^~~~~~~~~~~~~~~~~~~~~~~
> > drivers/acpi/arm64/iort.c:1079:32: note: each undeclared identifier is reported only once for each function it appears in
> > 
> > If IOMMU_SUPPORT not enabled, struct iommu_fwspec without members and
> > IOMMU_FWSPEC_PCI_RC_ATS not defined, add new iommu_fwspec_set_ats_flags()
> > to set IOMMU_FWSPEC_PCI_RC_ATS flags to solve build error.
> > 
> > Cc: Jean-Philippe Brucker <jean-philippe.brucker@arm.com>
> > Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> > Cc: Will Deacon <will.deacon@arm.com>
> > Reported-by: Hulk Robot <hulkci@huawei.com>
> 
> What's this "Hulk Robot"? Does it report things publicly?

AFAIK it is Huawei CI system, I had some doubts about leaving
that tag for other patches I dealt with, I am not sure it is
really useful (other than giving Hulk some credit).

> Anyway, I can pick this up if Lorenzo acks it.

Actually I think we should compile out iort_iommu_configure() for
!IOMMU_SUPPORT unless I am missing something, so that we are
removing this source of errors.

If that does not cut it, for this patch:

iommu_fwspec_set_ats_flags() should be iommu_fwspec_set_ats_flag()

The commit log should be fixed (it is pretty weird to start with the
build error and then explain it):

"If IOMMU_SUPPORT is not enabled, struct iommu_fwspec is an empty
struct and IOMMU_FWSPEC_PCI_RC_ATS is not defined, resulting in
the following build error:

drivers/acpi/arm64/iort.c: In function iort_iommu_configure:
drivers/acpi/arm64/iort.c:1079:21: error: struct iommu_fwspec has no member named flags
    dev->iommu_fwspec->flags |= IOMMU_FWSPEC_PCI_RC_ATS;
                     ^~
drivers/acpi/arm64/iort.c:1079:32: error: IOMMU_FWSPEC_PCI_RC_ATS
undeclared (first use in this function)
    dev->iommu_fwspec->flags |= IOMMU_FWSPEC_PCI_RC_ATS;
                                ^~~~~~~~~~~~~~~~~~~~~~~
drivers/acpi/arm64/iort.c:1079:32: note: each undeclared identifier is reported only once for each function it appears in

Add a iommu_fwspec_set_ats_flag() helper function (that is an empty
stub on !IOMMU_SUPPORT) to fix it."

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

* Re: [PATCH RESEND] ACPI/IORT: Fix build error when IOMMU_SUPPORT disabled
@ 2019-05-15 12:06       ` Lorenzo Pieralisi
  0 siblings, 0 replies; 16+ messages in thread
From: Lorenzo Pieralisi @ 2019-05-15 12:06 UTC (permalink / raw)
  To: Will Deacon
  Cc: Kefeng Wang, Hulk Robot, Jean-Philippe Brucker, joro, linux-acpi,
	guohanjun, robin.murphy, linux-arm-kernel

[+Joerg, Robin]

On Wed, May 15, 2019 at 11:15:34AM +0100, Will Deacon wrote:
> On Wed, May 15, 2019 at 11:42:53AM +0800, Kefeng Wang wrote:
> > drivers/acpi/arm64/iort.c: In function iort_iommu_configure:
> > drivers/acpi/arm64/iort.c:1079:21: error: struct iommu_fwspec has no member named flags
> >     dev->iommu_fwspec->flags |= IOMMU_FWSPEC_PCI_RC_ATS;
> >                      ^~
> > drivers/acpi/arm64/iort.c:1079:32: error: IOMMU_FWSPEC_PCI_RC_ATS
> > undeclared (first use in this function)
> >     dev->iommu_fwspec->flags |= IOMMU_FWSPEC_PCI_RC_ATS;
> >                                 ^~~~~~~~~~~~~~~~~~~~~~~
> > drivers/acpi/arm64/iort.c:1079:32: note: each undeclared identifier is reported only once for each function it appears in
> > 
> > If IOMMU_SUPPORT not enabled, struct iommu_fwspec without members and
> > IOMMU_FWSPEC_PCI_RC_ATS not defined, add new iommu_fwspec_set_ats_flags()
> > to set IOMMU_FWSPEC_PCI_RC_ATS flags to solve build error.
> > 
> > Cc: Jean-Philippe Brucker <jean-philippe.brucker@arm.com>
> > Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> > Cc: Will Deacon <will.deacon@arm.com>
> > Reported-by: Hulk Robot <hulkci@huawei.com>
> 
> What's this "Hulk Robot"? Does it report things publicly?

AFAIK it is Huawei CI system, I had some doubts about leaving
that tag for other patches I dealt with, I am not sure it is
really useful (other than giving Hulk some credit).

> Anyway, I can pick this up if Lorenzo acks it.

Actually I think we should compile out iort_iommu_configure() for
!IOMMU_SUPPORT unless I am missing something, so that we are
removing this source of errors.

If that does not cut it, for this patch:

iommu_fwspec_set_ats_flags() should be iommu_fwspec_set_ats_flag()

The commit log should be fixed (it is pretty weird to start with the
build error and then explain it):

"If IOMMU_SUPPORT is not enabled, struct iommu_fwspec is an empty
struct and IOMMU_FWSPEC_PCI_RC_ATS is not defined, resulting in
the following build error:

drivers/acpi/arm64/iort.c: In function iort_iommu_configure:
drivers/acpi/arm64/iort.c:1079:21: error: struct iommu_fwspec has no member named flags
    dev->iommu_fwspec->flags |= IOMMU_FWSPEC_PCI_RC_ATS;
                     ^~
drivers/acpi/arm64/iort.c:1079:32: error: IOMMU_FWSPEC_PCI_RC_ATS
undeclared (first use in this function)
    dev->iommu_fwspec->flags |= IOMMU_FWSPEC_PCI_RC_ATS;
                                ^~~~~~~~~~~~~~~~~~~~~~~
drivers/acpi/arm64/iort.c:1079:32: note: each undeclared identifier is reported only once for each function it appears in

Add a iommu_fwspec_set_ats_flag() helper function (that is an empty
stub on !IOMMU_SUPPORT) to fix it."

_______________________________________________
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] 16+ messages in thread

* Re: [PATCH RESEND] ACPI/IORT: Fix build error when IOMMU_SUPPORT disabled
  2019-05-15 12:06       ` Lorenzo Pieralisi
@ 2019-05-15 12:46         ` Robin Murphy
  -1 siblings, 0 replies; 16+ messages in thread
From: Robin Murphy @ 2019-05-15 12:46 UTC (permalink / raw)
  To: Lorenzo Pieralisi, Will Deacon
  Cc: Kefeng Wang, linux-acpi, linux-arm-kernel, guohanjun,
	Jean-Philippe Brucker, Hulk Robot, joro

On 15/05/2019 13:06, Lorenzo Pieralisi wrote:
> [+Joerg, Robin]
> 
> On Wed, May 15, 2019 at 11:15:34AM +0100, Will Deacon wrote:
>> On Wed, May 15, 2019 at 11:42:53AM +0800, Kefeng Wang wrote:
>>> drivers/acpi/arm64/iort.c: In function iort_iommu_configure:
>>> drivers/acpi/arm64/iort.c:1079:21: error: struct iommu_fwspec has no member named flags
>>>      dev->iommu_fwspec->flags |= IOMMU_FWSPEC_PCI_RC_ATS;
>>>                       ^~
>>> drivers/acpi/arm64/iort.c:1079:32: error: IOMMU_FWSPEC_PCI_RC_ATS
>>> undeclared (first use in this function)
>>>      dev->iommu_fwspec->flags |= IOMMU_FWSPEC_PCI_RC_ATS;
>>>                                  ^~~~~~~~~~~~~~~~~~~~~~~
>>> drivers/acpi/arm64/iort.c:1079:32: note: each undeclared identifier is reported only once for each function it appears in
>>>
>>> If IOMMU_SUPPORT not enabled, struct iommu_fwspec without members and
>>> IOMMU_FWSPEC_PCI_RC_ATS not defined, add new iommu_fwspec_set_ats_flags()
>>> to set IOMMU_FWSPEC_PCI_RC_ATS flags to solve build error.
>>>
>>> Cc: Jean-Philippe Brucker <jean-philippe.brucker@arm.com>
>>> Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
>>> Cc: Will Deacon <will.deacon@arm.com>
>>> Reported-by: Hulk Robot <hulkci@huawei.com>
>>
>> What's this "Hulk Robot"? Does it report things publicly?
> 
> AFAIK it is Huawei CI system, I had some doubts about leaving
> that tag for other patches I dealt with, I am not sure it is
> really useful (other than giving Hulk some credit).
> 
>> Anyway, I can pick this up if Lorenzo acks it.
> 
> Actually I think we should compile out iort_iommu_configure() for
> !IOMMU_SUPPORT unless I am missing something, so that we are
> removing this source of errors.

Indeed, much as I like the compile coverage of not having things 
#ifdefed out in general, this particular case seems like a fairly 
atypical configuration so I'm not sure all the extra fluff of struct 
accessors is really worth it.

Robin.

> If that does not cut it, for this patch:
> 
> iommu_fwspec_set_ats_flags() should be iommu_fwspec_set_ats_flag()
> 
> The commit log should be fixed (it is pretty weird to start with the
> build error and then explain it):
> 
> "If IOMMU_SUPPORT is not enabled, struct iommu_fwspec is an empty
> struct and IOMMU_FWSPEC_PCI_RC_ATS is not defined, resulting in
> the following build error:
> 
> drivers/acpi/arm64/iort.c: In function iort_iommu_configure:
> drivers/acpi/arm64/iort.c:1079:21: error: struct iommu_fwspec has no member named flags
>      dev->iommu_fwspec->flags |= IOMMU_FWSPEC_PCI_RC_ATS;
>                       ^~
> drivers/acpi/arm64/iort.c:1079:32: error: IOMMU_FWSPEC_PCI_RC_ATS
> undeclared (first use in this function)
>      dev->iommu_fwspec->flags |= IOMMU_FWSPEC_PCI_RC_ATS;
>                                  ^~~~~~~~~~~~~~~~~~~~~~~
> drivers/acpi/arm64/iort.c:1079:32: note: each undeclared identifier is reported only once for each function it appears in
> 
> Add a iommu_fwspec_set_ats_flag() helper function (that is an empty
> stub on !IOMMU_SUPPORT) to fix it."
> 

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

* Re: [PATCH RESEND] ACPI/IORT: Fix build error when IOMMU_SUPPORT disabled
@ 2019-05-15 12:46         ` Robin Murphy
  0 siblings, 0 replies; 16+ messages in thread
From: Robin Murphy @ 2019-05-15 12:46 UTC (permalink / raw)
  To: Lorenzo Pieralisi, Will Deacon
  Cc: Kefeng Wang, Hulk Robot, Jean-Philippe Brucker, joro, linux-acpi,
	guohanjun, linux-arm-kernel

On 15/05/2019 13:06, Lorenzo Pieralisi wrote:
> [+Joerg, Robin]
> 
> On Wed, May 15, 2019 at 11:15:34AM +0100, Will Deacon wrote:
>> On Wed, May 15, 2019 at 11:42:53AM +0800, Kefeng Wang wrote:
>>> drivers/acpi/arm64/iort.c: In function iort_iommu_configure:
>>> drivers/acpi/arm64/iort.c:1079:21: error: struct iommu_fwspec has no member named flags
>>>      dev->iommu_fwspec->flags |= IOMMU_FWSPEC_PCI_RC_ATS;
>>>                       ^~
>>> drivers/acpi/arm64/iort.c:1079:32: error: IOMMU_FWSPEC_PCI_RC_ATS
>>> undeclared (first use in this function)
>>>      dev->iommu_fwspec->flags |= IOMMU_FWSPEC_PCI_RC_ATS;
>>>                                  ^~~~~~~~~~~~~~~~~~~~~~~
>>> drivers/acpi/arm64/iort.c:1079:32: note: each undeclared identifier is reported only once for each function it appears in
>>>
>>> If IOMMU_SUPPORT not enabled, struct iommu_fwspec without members and
>>> IOMMU_FWSPEC_PCI_RC_ATS not defined, add new iommu_fwspec_set_ats_flags()
>>> to set IOMMU_FWSPEC_PCI_RC_ATS flags to solve build error.
>>>
>>> Cc: Jean-Philippe Brucker <jean-philippe.brucker@arm.com>
>>> Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
>>> Cc: Will Deacon <will.deacon@arm.com>
>>> Reported-by: Hulk Robot <hulkci@huawei.com>
>>
>> What's this "Hulk Robot"? Does it report things publicly?
> 
> AFAIK it is Huawei CI system, I had some doubts about leaving
> that tag for other patches I dealt with, I am not sure it is
> really useful (other than giving Hulk some credit).
> 
>> Anyway, I can pick this up if Lorenzo acks it.
> 
> Actually I think we should compile out iort_iommu_configure() for
> !IOMMU_SUPPORT unless I am missing something, so that we are
> removing this source of errors.

Indeed, much as I like the compile coverage of not having things 
#ifdefed out in general, this particular case seems like a fairly 
atypical configuration so I'm not sure all the extra fluff of struct 
accessors is really worth it.

Robin.

> If that does not cut it, for this patch:
> 
> iommu_fwspec_set_ats_flags() should be iommu_fwspec_set_ats_flag()
> 
> The commit log should be fixed (it is pretty weird to start with the
> build error and then explain it):
> 
> "If IOMMU_SUPPORT is not enabled, struct iommu_fwspec is an empty
> struct and IOMMU_FWSPEC_PCI_RC_ATS is not defined, resulting in
> the following build error:
> 
> drivers/acpi/arm64/iort.c: In function iort_iommu_configure:
> drivers/acpi/arm64/iort.c:1079:21: error: struct iommu_fwspec has no member named flags
>      dev->iommu_fwspec->flags |= IOMMU_FWSPEC_PCI_RC_ATS;
>                       ^~
> drivers/acpi/arm64/iort.c:1079:32: error: IOMMU_FWSPEC_PCI_RC_ATS
> undeclared (first use in this function)
>      dev->iommu_fwspec->flags |= IOMMU_FWSPEC_PCI_RC_ATS;
>                                  ^~~~~~~~~~~~~~~~~~~~~~~
> drivers/acpi/arm64/iort.c:1079:32: note: each undeclared identifier is reported only once for each function it appears in
> 
> Add a iommu_fwspec_set_ats_flag() helper function (that is an empty
> stub on !IOMMU_SUPPORT) to fix it."
> 

_______________________________________________
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] 16+ messages in thread

* Re: [PATCH RESEND] ACPI/IORT: Fix build error when IOMMU_SUPPORT disabled
  2019-05-15 12:46         ` Robin Murphy
@ 2019-05-15 16:41           ` Lorenzo Pieralisi
  -1 siblings, 0 replies; 16+ messages in thread
From: Lorenzo Pieralisi @ 2019-05-15 16:41 UTC (permalink / raw)
  To: Robin Murphy
  Cc: Will Deacon, Kefeng Wang, linux-acpi, linux-arm-kernel,
	guohanjun, Jean-Philippe Brucker, Hulk Robot, joro

On Wed, May 15, 2019 at 01:46:28PM +0100, Robin Murphy wrote:
> On 15/05/2019 13:06, Lorenzo Pieralisi wrote:
> > [+Joerg, Robin]
> > 
> > On Wed, May 15, 2019 at 11:15:34AM +0100, Will Deacon wrote:
> > > On Wed, May 15, 2019 at 11:42:53AM +0800, Kefeng Wang wrote:
> > > > drivers/acpi/arm64/iort.c: In function iort_iommu_configure:
> > > > drivers/acpi/arm64/iort.c:1079:21: error: struct iommu_fwspec has no member named flags
> > > >      dev->iommu_fwspec->flags |= IOMMU_FWSPEC_PCI_RC_ATS;
> > > >                       ^~
> > > > drivers/acpi/arm64/iort.c:1079:32: error: IOMMU_FWSPEC_PCI_RC_ATS
> > > > undeclared (first use in this function)
> > > >      dev->iommu_fwspec->flags |= IOMMU_FWSPEC_PCI_RC_ATS;
> > > >                                  ^~~~~~~~~~~~~~~~~~~~~~~
> > > > drivers/acpi/arm64/iort.c:1079:32: note: each undeclared identifier is reported only once for each function it appears in
> > > > 
> > > > If IOMMU_SUPPORT not enabled, struct iommu_fwspec without members and
> > > > IOMMU_FWSPEC_PCI_RC_ATS not defined, add new iommu_fwspec_set_ats_flags()
> > > > to set IOMMU_FWSPEC_PCI_RC_ATS flags to solve build error.
> > > > 
> > > > Cc: Jean-Philippe Brucker <jean-philippe.brucker@arm.com>
> > > > Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> > > > Cc: Will Deacon <will.deacon@arm.com>
> > > > Reported-by: Hulk Robot <hulkci@huawei.com>
> > > 
> > > What's this "Hulk Robot"? Does it report things publicly?
> > 
> > AFAIK it is Huawei CI system, I had some doubts about leaving
> > that tag for other patches I dealt with, I am not sure it is
> > really useful (other than giving Hulk some credit).
> > 
> > > Anyway, I can pick this up if Lorenzo acks it.
> > 
> > Actually I think we should compile out iort_iommu_configure() for
> > !IOMMU_SUPPORT unless I am missing something, so that we are
> > removing this source of errors.
> 
> Indeed, much as I like the compile coverage of not having things #ifdefed
> out in general, this particular case seems like a fairly atypical
> configuration so I'm not sure all the extra fluff of struct accessors is
> really worth it.

Ok, I will send a patch shortly to address this issue, if Kefeng
does not object I will drop the CI bot as reporter and add him
instead.

Thanks,
Lorenzo

> 
> Robin.
> 
> > If that does not cut it, for this patch:
> > 
> > iommu_fwspec_set_ats_flags() should be iommu_fwspec_set_ats_flag()
> > 
> > The commit log should be fixed (it is pretty weird to start with the
> > build error and then explain it):
> > 
> > "If IOMMU_SUPPORT is not enabled, struct iommu_fwspec is an empty
> > struct and IOMMU_FWSPEC_PCI_RC_ATS is not defined, resulting in
> > the following build error:
> > 
> > drivers/acpi/arm64/iort.c: In function iort_iommu_configure:
> > drivers/acpi/arm64/iort.c:1079:21: error: struct iommu_fwspec has no member named flags
> >      dev->iommu_fwspec->flags |= IOMMU_FWSPEC_PCI_RC_ATS;
> >                       ^~
> > drivers/acpi/arm64/iort.c:1079:32: error: IOMMU_FWSPEC_PCI_RC_ATS
> > undeclared (first use in this function)
> >      dev->iommu_fwspec->flags |= IOMMU_FWSPEC_PCI_RC_ATS;
> >                                  ^~~~~~~~~~~~~~~~~~~~~~~
> > drivers/acpi/arm64/iort.c:1079:32: note: each undeclared identifier is reported only once for each function it appears in
> > 
> > Add a iommu_fwspec_set_ats_flag() helper function (that is an empty
> > stub on !IOMMU_SUPPORT) to fix it."
> > 

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

* Re: [PATCH RESEND] ACPI/IORT: Fix build error when IOMMU_SUPPORT disabled
@ 2019-05-15 16:41           ` Lorenzo Pieralisi
  0 siblings, 0 replies; 16+ messages in thread
From: Lorenzo Pieralisi @ 2019-05-15 16:41 UTC (permalink / raw)
  To: Robin Murphy
  Cc: Kefeng Wang, Hulk Robot, Jean-Philippe Brucker, joro,
	Will Deacon, linux-acpi, guohanjun, linux-arm-kernel

On Wed, May 15, 2019 at 01:46:28PM +0100, Robin Murphy wrote:
> On 15/05/2019 13:06, Lorenzo Pieralisi wrote:
> > [+Joerg, Robin]
> > 
> > On Wed, May 15, 2019 at 11:15:34AM +0100, Will Deacon wrote:
> > > On Wed, May 15, 2019 at 11:42:53AM +0800, Kefeng Wang wrote:
> > > > drivers/acpi/arm64/iort.c: In function iort_iommu_configure:
> > > > drivers/acpi/arm64/iort.c:1079:21: error: struct iommu_fwspec has no member named flags
> > > >      dev->iommu_fwspec->flags |= IOMMU_FWSPEC_PCI_RC_ATS;
> > > >                       ^~
> > > > drivers/acpi/arm64/iort.c:1079:32: error: IOMMU_FWSPEC_PCI_RC_ATS
> > > > undeclared (first use in this function)
> > > >      dev->iommu_fwspec->flags |= IOMMU_FWSPEC_PCI_RC_ATS;
> > > >                                  ^~~~~~~~~~~~~~~~~~~~~~~
> > > > drivers/acpi/arm64/iort.c:1079:32: note: each undeclared identifier is reported only once for each function it appears in
> > > > 
> > > > If IOMMU_SUPPORT not enabled, struct iommu_fwspec without members and
> > > > IOMMU_FWSPEC_PCI_RC_ATS not defined, add new iommu_fwspec_set_ats_flags()
> > > > to set IOMMU_FWSPEC_PCI_RC_ATS flags to solve build error.
> > > > 
> > > > Cc: Jean-Philippe Brucker <jean-philippe.brucker@arm.com>
> > > > Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> > > > Cc: Will Deacon <will.deacon@arm.com>
> > > > Reported-by: Hulk Robot <hulkci@huawei.com>
> > > 
> > > What's this "Hulk Robot"? Does it report things publicly?
> > 
> > AFAIK it is Huawei CI system, I had some doubts about leaving
> > that tag for other patches I dealt with, I am not sure it is
> > really useful (other than giving Hulk some credit).
> > 
> > > Anyway, I can pick this up if Lorenzo acks it.
> > 
> > Actually I think we should compile out iort_iommu_configure() for
> > !IOMMU_SUPPORT unless I am missing something, so that we are
> > removing this source of errors.
> 
> Indeed, much as I like the compile coverage of not having things #ifdefed
> out in general, this particular case seems like a fairly atypical
> configuration so I'm not sure all the extra fluff of struct accessors is
> really worth it.

Ok, I will send a patch shortly to address this issue, if Kefeng
does not object I will drop the CI bot as reporter and add him
instead.

Thanks,
Lorenzo

> 
> Robin.
> 
> > If that does not cut it, for this patch:
> > 
> > iommu_fwspec_set_ats_flags() should be iommu_fwspec_set_ats_flag()
> > 
> > The commit log should be fixed (it is pretty weird to start with the
> > build error and then explain it):
> > 
> > "If IOMMU_SUPPORT is not enabled, struct iommu_fwspec is an empty
> > struct and IOMMU_FWSPEC_PCI_RC_ATS is not defined, resulting in
> > the following build error:
> > 
> > drivers/acpi/arm64/iort.c: In function iort_iommu_configure:
> > drivers/acpi/arm64/iort.c:1079:21: error: struct iommu_fwspec has no member named flags
> >      dev->iommu_fwspec->flags |= IOMMU_FWSPEC_PCI_RC_ATS;
> >                       ^~
> > drivers/acpi/arm64/iort.c:1079:32: error: IOMMU_FWSPEC_PCI_RC_ATS
> > undeclared (first use in this function)
> >      dev->iommu_fwspec->flags |= IOMMU_FWSPEC_PCI_RC_ATS;
> >                                  ^~~~~~~~~~~~~~~~~~~~~~~
> > drivers/acpi/arm64/iort.c:1079:32: note: each undeclared identifier is reported only once for each function it appears in
> > 
> > Add a iommu_fwspec_set_ats_flag() helper function (that is an empty
> > stub on !IOMMU_SUPPORT) to fix it."
> > 

_______________________________________________
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] 16+ messages in thread

* Re: [PATCH RESEND] ACPI/IORT: Fix build error when IOMMU_SUPPORT disabled
  2019-05-15 16:41           ` Lorenzo Pieralisi
@ 2019-05-16  1:39             ` Kefeng Wang
  -1 siblings, 0 replies; 16+ messages in thread
From: Kefeng Wang @ 2019-05-16  1:39 UTC (permalink / raw)
  To: Lorenzo Pieralisi, Robin Murphy
  Cc: Will Deacon, linux-acpi, linux-arm-kernel, guohanjun,
	Jean-Philippe Brucker, Hulk Robot, joro


On 2019/5/16 0:41, Lorenzo Pieralisi wrote:
> On Wed, May 15, 2019 at 01:46:28PM +0100, Robin Murphy wrote:
>> On 15/05/2019 13:06, Lorenzo Pieralisi wrote:
>>> [+Joerg, Robin]
>>>
>>> On Wed, May 15, 2019 at 11:15:34AM +0100, Will Deacon wrote:
>>>> On Wed, May 15, 2019 at 11:42:53AM +0800, Kefeng Wang wrote:
>>>>> drivers/acpi/arm64/iort.c: In function iort_iommu_configure:
>>>>> drivers/acpi/arm64/iort.c:1079:21: error: struct iommu_fwspec has no member named flags
>>>>>      dev->iommu_fwspec->flags |= IOMMU_FWSPEC_PCI_RC_ATS;
>>>>>                       ^~
>>>>> drivers/acpi/arm64/iort.c:1079:32: error: IOMMU_FWSPEC_PCI_RC_ATS
>>>>> undeclared (first use in this function)
>>>>>      dev->iommu_fwspec->flags |= IOMMU_FWSPEC_PCI_RC_ATS;
>>>>>                                  ^~~~~~~~~~~~~~~~~~~~~~~
>>>>> drivers/acpi/arm64/iort.c:1079:32: note: each undeclared identifier is reported only once for each function it appears in
>>>>>
>>>>> If IOMMU_SUPPORT not enabled, struct iommu_fwspec without members and
>>>>> IOMMU_FWSPEC_PCI_RC_ATS not defined, add new iommu_fwspec_set_ats_flags()
>>>>> to set IOMMU_FWSPEC_PCI_RC_ATS flags to solve build error.
>>>>>
>>>>> Cc: Jean-Philippe Brucker <jean-philippe.brucker@arm.com>
>>>>> Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
>>>>> Cc: Will Deacon <will.deacon@arm.com>
>>>>> Reported-by: Hulk Robot <hulkci@huawei.com>
>>>> What's this "Hulk Robot"? Does it report things publicly?
>>> AFAIK it is Huawei CI system, I had some doubts about leaving
>>> that tag for other patches I dealt with, I am not sure it is
>>> really useful (other than giving Hulk some credit).

As Lorenzo said, it is Huawei CI system to improve the robustness of

our inner Linux kernel version, we also use it to test the latest Linux kernel.

The system is still being developed, and  still need to enhance and improve.

>>>
>>>> Anyway, I can pick this up if Lorenzo acks it.
>>> Actually I think we should compile out iort_iommu_configure() for
>>> !IOMMU_SUPPORT unless I am missing something, so that we are
>>> removing this source of errors.
>> Indeed, much as I like the compile coverage of not having things #ifdefed
>> out in general, this particular case seems like a fairly atypical
>> configuration so I'm not sure all the extra fluff of struct accessors is
>> really worth it.
This is founded by randconfig built, it seems that no one use this kind of configuration
> Ok, I will send a patch shortly to address this issue, if Kefeng
> does not object I will drop the CI bot as reporter and add him
> instead.
Either way is ok, thanks.
>
> Thanks,
> Lorenzo
>
>> Robin.
>>
>>> If that does not cut it, for this patch:
>>>
>>> iommu_fwspec_set_ats_flags() should be iommu_fwspec_set_ats_flag()
>>>
>>> The commit log should be fixed (it is pretty weird to start with the
>>> build error and then explain it):
>>>
>>> "If IOMMU_SUPPORT is not enabled, struct iommu_fwspec is an empty
>>> struct and IOMMU_FWSPEC_PCI_RC_ATS is not defined, resulting in
>>> the following build error:
>>>
>>> drivers/acpi/arm64/iort.c: In function iort_iommu_configure:
>>> drivers/acpi/arm64/iort.c:1079:21: error: struct iommu_fwspec has no member named flags
>>>      dev->iommu_fwspec->flags |= IOMMU_FWSPEC_PCI_RC_ATS;
>>>                       ^~
>>> drivers/acpi/arm64/iort.c:1079:32: error: IOMMU_FWSPEC_PCI_RC_ATS
>>> undeclared (first use in this function)
>>>      dev->iommu_fwspec->flags |= IOMMU_FWSPEC_PCI_RC_ATS;
>>>                                  ^~~~~~~~~~~~~~~~~~~~~~~
>>> drivers/acpi/arm64/iort.c:1079:32: note: each undeclared identifier is reported only once for each function it appears in
>>>
>>> Add a iommu_fwspec_set_ats_flag() helper function (that is an empty
>>> stub on !IOMMU_SUPPORT) to fix it."
>>>
> .
>


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

* Re: [PATCH RESEND] ACPI/IORT: Fix build error when IOMMU_SUPPORT disabled
@ 2019-05-16  1:39             ` Kefeng Wang
  0 siblings, 0 replies; 16+ messages in thread
From: Kefeng Wang @ 2019-05-16  1:39 UTC (permalink / raw)
  To: Lorenzo Pieralisi, Robin Murphy
  Cc: Hulk Robot, Jean-Philippe Brucker, joro, Will Deacon, linux-acpi,
	guohanjun, linux-arm-kernel


On 2019/5/16 0:41, Lorenzo Pieralisi wrote:
> On Wed, May 15, 2019 at 01:46:28PM +0100, Robin Murphy wrote:
>> On 15/05/2019 13:06, Lorenzo Pieralisi wrote:
>>> [+Joerg, Robin]
>>>
>>> On Wed, May 15, 2019 at 11:15:34AM +0100, Will Deacon wrote:
>>>> On Wed, May 15, 2019 at 11:42:53AM +0800, Kefeng Wang wrote:
>>>>> drivers/acpi/arm64/iort.c: In function iort_iommu_configure:
>>>>> drivers/acpi/arm64/iort.c:1079:21: error: struct iommu_fwspec has no member named flags
>>>>>      dev->iommu_fwspec->flags |= IOMMU_FWSPEC_PCI_RC_ATS;
>>>>>                       ^~
>>>>> drivers/acpi/arm64/iort.c:1079:32: error: IOMMU_FWSPEC_PCI_RC_ATS
>>>>> undeclared (first use in this function)
>>>>>      dev->iommu_fwspec->flags |= IOMMU_FWSPEC_PCI_RC_ATS;
>>>>>                                  ^~~~~~~~~~~~~~~~~~~~~~~
>>>>> drivers/acpi/arm64/iort.c:1079:32: note: each undeclared identifier is reported only once for each function it appears in
>>>>>
>>>>> If IOMMU_SUPPORT not enabled, struct iommu_fwspec without members and
>>>>> IOMMU_FWSPEC_PCI_RC_ATS not defined, add new iommu_fwspec_set_ats_flags()
>>>>> to set IOMMU_FWSPEC_PCI_RC_ATS flags to solve build error.
>>>>>
>>>>> Cc: Jean-Philippe Brucker <jean-philippe.brucker@arm.com>
>>>>> Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
>>>>> Cc: Will Deacon <will.deacon@arm.com>
>>>>> Reported-by: Hulk Robot <hulkci@huawei.com>
>>>> What's this "Hulk Robot"? Does it report things publicly?
>>> AFAIK it is Huawei CI system, I had some doubts about leaving
>>> that tag for other patches I dealt with, I am not sure it is
>>> really useful (other than giving Hulk some credit).

As Lorenzo said, it is Huawei CI system to improve the robustness of

our inner Linux kernel version, we also use it to test the latest Linux kernel.

The system is still being developed, and  still need to enhance and improve.

>>>
>>>> Anyway, I can pick this up if Lorenzo acks it.
>>> Actually I think we should compile out iort_iommu_configure() for
>>> !IOMMU_SUPPORT unless I am missing something, so that we are
>>> removing this source of errors.
>> Indeed, much as I like the compile coverage of not having things #ifdefed
>> out in general, this particular case seems like a fairly atypical
>> configuration so I'm not sure all the extra fluff of struct accessors is
>> really worth it.
This is founded by randconfig built, it seems that no one use this kind of configuration
> Ok, I will send a patch shortly to address this issue, if Kefeng
> does not object I will drop the CI bot as reporter and add him
> instead.
Either way is ok, thanks.
>
> Thanks,
> Lorenzo
>
>> Robin.
>>
>>> If that does not cut it, for this patch:
>>>
>>> iommu_fwspec_set_ats_flags() should be iommu_fwspec_set_ats_flag()
>>>
>>> The commit log should be fixed (it is pretty weird to start with the
>>> build error and then explain it):
>>>
>>> "If IOMMU_SUPPORT is not enabled, struct iommu_fwspec is an empty
>>> struct and IOMMU_FWSPEC_PCI_RC_ATS is not defined, resulting in
>>> the following build error:
>>>
>>> drivers/acpi/arm64/iort.c: In function iort_iommu_configure:
>>> drivers/acpi/arm64/iort.c:1079:21: error: struct iommu_fwspec has no member named flags
>>>      dev->iommu_fwspec->flags |= IOMMU_FWSPEC_PCI_RC_ATS;
>>>                       ^~
>>> drivers/acpi/arm64/iort.c:1079:32: error: IOMMU_FWSPEC_PCI_RC_ATS
>>> undeclared (first use in this function)
>>>      dev->iommu_fwspec->flags |= IOMMU_FWSPEC_PCI_RC_ATS;
>>>                                  ^~~~~~~~~~~~~~~~~~~~~~~
>>> drivers/acpi/arm64/iort.c:1079:32: note: each undeclared identifier is reported only once for each function it appears in
>>>
>>> Add a iommu_fwspec_set_ats_flag() helper function (that is an empty
>>> stub on !IOMMU_SUPPORT) to fix it."
>>>
> .
>


_______________________________________________
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] 16+ messages in thread

* [PATCH v2] ACPI/IORT: Fix build error when IOMMU_SUPPORT is disabled
  2019-05-15  3:42   ` Kefeng Wang
@ 2019-05-16 15:52     ` Lorenzo Pieralisi
  -1 siblings, 0 replies; 16+ messages in thread
From: Lorenzo Pieralisi @ 2019-05-16 15:52 UTC (permalink / raw)
  To: linux-acpi, linux-arm-kernel
  Cc: Lorenzo Pieralisi, Kefeng Wang, Jean-Philippe Brucker,
	Will Deacon, Robin Murphy

If IOMMU_SUPPORT is not enabled (and therefore IOMMU_API is not
selected), struct iommu_fwspec is an empty struct and
IOMMU_FWSPEC_PCI_RC_ATS is not defined, resulting in the following
compilation errors:

drivers/acpi/arm64/iort.c: In function iort_iommu_configure:
drivers/acpi/arm64/iort.c:1079:21: error: struct iommu_fwspec has no member named flag:
    dev->iommu_fwspec->flags |= IOMMU_FWSPEC_PCI_RC_ATS;
                     ^~
drivers/acpi/arm64/iort.c:1079:32: error: IOMMU_FWSPEC_PCI_RC_ATS
undeclared (first use in this function)
    dev->iommu_fwspec->flags |= IOMMU_FWSPEC_PCI_RC_ATS;
                                ^~~~~~~~~~~~~~~~~~~~~~~
drivers/acpi/arm64/iort.c:1079:32: note: each undeclared identifier is reported only once for each function it appears in

Move iort_iommu_configure() (and the helpers functions it relies on)
into CONFIG_IOMMU_API preprocessor guarded code so that when
CONFIG_IOMMU_SUPPORT is not enabled we prevent compiling code that is
basically equivalent to no-OP, fixing the build errors.

Link: https://lore.kernel.org/linux-arm-kernel/20190515034253.79348-1-wangkefeng.wang@huawei.com/
Reported-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Fixes: 5702ee24182f ("ACPI/IORT: Check ATS capability in root complex nodes")
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: Jean-Philippe Brucker <jean-philippe.brucker@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Robin Murphy <robin.murphy@arm.com>
Cc: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 drivers/acpi/arm64/iort.c | 238 +++++++++++++++++++-------------------
 1 file changed, 120 insertions(+), 118 deletions(-)

diff --git a/drivers/acpi/arm64/iort.c b/drivers/acpi/arm64/iort.c
index 9058cb084b91..b5390b4c9ade 100644
--- a/drivers/acpi/arm64/iort.c
+++ b/drivers/acpi/arm64/iort.c
@@ -753,31 +753,6 @@ static int __maybe_unused __get_pci_rid(struct pci_dev *pdev, u16 alias,
 	return 0;
 }
 
-static int arm_smmu_iort_xlate(struct device *dev, u32 streamid,
-			       struct fwnode_handle *fwnode,
-			       const struct iommu_ops *ops)
-{
-	int ret = iommu_fwspec_init(dev, fwnode, ops);
-
-	if (!ret)
-		ret = iommu_fwspec_add_ids(dev, &streamid, 1);
-
-	return ret;
-}
-
-static inline bool iort_iommu_driver_enabled(u8 type)
-{
-	switch (type) {
-	case ACPI_IORT_NODE_SMMU_V3:
-		return IS_BUILTIN(CONFIG_ARM_SMMU_V3);
-	case ACPI_IORT_NODE_SMMU:
-		return IS_BUILTIN(CONFIG_ARM_SMMU);
-	default:
-		pr_warn("IORT node type %u does not describe an SMMU\n", type);
-		return false;
-	}
-}
-
 #ifdef CONFIG_IOMMU_API
 static struct acpi_iort_node *iort_get_msi_resv_iommu(struct device *dev)
 {
@@ -878,15 +853,39 @@ int iort_iommu_msi_get_resv_regions(struct device *dev, struct list_head *head)
 
 	return (resv == its->its_count) ? resv : -ENODEV;
 }
-#else
-static inline const struct iommu_ops *iort_fwspec_iommu_ops(struct device *dev)
-{ return NULL; }
-static inline int iort_add_device_replay(const struct iommu_ops *ops,
-					 struct device *dev)
-{ return 0; }
-int iort_iommu_msi_get_resv_regions(struct device *dev, struct list_head *head)
-{ return 0; }
-#endif
+
+static inline bool iort_iommu_driver_enabled(u8 type)
+{
+	switch (type) {
+	case ACPI_IORT_NODE_SMMU_V3:
+		return IS_BUILTIN(CONFIG_ARM_SMMU_V3);
+	case ACPI_IORT_NODE_SMMU:
+		return IS_BUILTIN(CONFIG_ARM_SMMU);
+	default:
+		pr_warn("IORT node type %u does not describe an SMMU\n", type);
+		return false;
+	}
+}
+
+static int arm_smmu_iort_xlate(struct device *dev, u32 streamid,
+			       struct fwnode_handle *fwnode,
+			       const struct iommu_ops *ops)
+{
+	int ret = iommu_fwspec_init(dev, fwnode, ops);
+
+	if (!ret)
+		ret = iommu_fwspec_add_ids(dev, &streamid, 1);
+
+	return ret;
+}
+
+static bool iort_pci_rc_supports_ats(struct acpi_iort_node *node)
+{
+	struct acpi_iort_root_complex *pci_rc;
+
+	pci_rc = (struct acpi_iort_root_complex *)node->node_data;
+	return pci_rc->ats_attribute & ACPI_IORT_ATS_SUPPORTED;
+}
 
 static int iort_iommu_xlate(struct device *dev, struct acpi_iort_node *node,
 			    u32 streamid)
@@ -933,6 +932,93 @@ static int iort_pci_iommu_init(struct pci_dev *pdev, u16 alias, void *data)
 	return iort_iommu_xlate(info->dev, parent, streamid);
 }
 
+/**
+ * iort_iommu_configure - Set-up IOMMU configuration for a device.
+ *
+ * @dev: device to configure
+ *
+ * Returns: iommu_ops pointer on configuration success
+ *          NULL on configuration failure
+ */
+const struct iommu_ops *iort_iommu_configure(struct device *dev)
+{
+	struct acpi_iort_node *node, *parent;
+	const struct iommu_ops *ops;
+	u32 streamid = 0;
+	int err = -ENODEV;
+
+	/*
+	 * If we already translated the fwspec there
+	 * is nothing left to do, return the iommu_ops.
+	 */
+	ops = iort_fwspec_iommu_ops(dev);
+	if (ops)
+		return ops;
+
+	if (dev_is_pci(dev)) {
+		struct pci_bus *bus = to_pci_dev(dev)->bus;
+		struct iort_pci_alias_info info = { .dev = dev };
+
+		node = iort_scan_node(ACPI_IORT_NODE_PCI_ROOT_COMPLEX,
+				      iort_match_node_callback, &bus->dev);
+		if (!node)
+			return NULL;
+
+		info.node = node;
+		err = pci_for_each_dma_alias(to_pci_dev(dev),
+					     iort_pci_iommu_init, &info);
+
+		if (!err && iort_pci_rc_supports_ats(node))
+			dev->iommu_fwspec->flags |= IOMMU_FWSPEC_PCI_RC_ATS;
+	} else {
+		int i = 0;
+
+		node = iort_scan_node(ACPI_IORT_NODE_NAMED_COMPONENT,
+				      iort_match_node_callback, dev);
+		if (!node)
+			return NULL;
+
+		do {
+			parent = iort_node_map_platform_id(node, &streamid,
+							   IORT_IOMMU_TYPE,
+							   i++);
+
+			if (parent)
+				err = iort_iommu_xlate(dev, parent, streamid);
+		} while (parent && !err);
+	}
+
+	/*
+	 * If we have reason to believe the IOMMU driver missed the initial
+	 * add_device callback for dev, replay it to get things in order.
+	 */
+	if (!err) {
+		ops = iort_fwspec_iommu_ops(dev);
+		err = iort_add_device_replay(ops, dev);
+	}
+
+	/* Ignore all other errors apart from EPROBE_DEFER */
+	if (err == -EPROBE_DEFER) {
+		ops = ERR_PTR(err);
+	} else if (err) {
+		dev_dbg(dev, "Adding to IOMMU failed: %d\n", err);
+		ops = NULL;
+	}
+
+	return ops;
+}
+#else
+static inline const struct iommu_ops *iort_fwspec_iommu_ops(struct device *dev)
+{ return NULL; }
+static inline int iort_add_device_replay(const struct iommu_ops *ops,
+					 struct device *dev)
+{ return 0; }
+int iort_iommu_msi_get_resv_regions(struct device *dev, struct list_head *head)
+{ return 0; }
+const struct iommu_ops *iort_iommu_configure(struct device *dev)
+{ return NULL; }
+#endif
+
 static int nc_dma_get_range(struct device *dev, u64 *size)
 {
 	struct acpi_iort_node *node;
@@ -1031,90 +1117,6 @@ void iort_dma_setup(struct device *dev, u64 *dma_addr, u64 *dma_size)
 	dev_dbg(dev, "dma_pfn_offset(%#08llx)\n", offset);
 }
 
-static bool iort_pci_rc_supports_ats(struct acpi_iort_node *node)
-{
-	struct acpi_iort_root_complex *pci_rc;
-
-	pci_rc = (struct acpi_iort_root_complex *)node->node_data;
-	return pci_rc->ats_attribute & ACPI_IORT_ATS_SUPPORTED;
-}
-
-/**
- * iort_iommu_configure - Set-up IOMMU configuration for a device.
- *
- * @dev: device to configure
- *
- * Returns: iommu_ops pointer on configuration success
- *          NULL on configuration failure
- */
-const struct iommu_ops *iort_iommu_configure(struct device *dev)
-{
-	struct acpi_iort_node *node, *parent;
-	const struct iommu_ops *ops;
-	u32 streamid = 0;
-	int err = -ENODEV;
-
-	/*
-	 * If we already translated the fwspec there
-	 * is nothing left to do, return the iommu_ops.
-	 */
-	ops = iort_fwspec_iommu_ops(dev);
-	if (ops)
-		return ops;
-
-	if (dev_is_pci(dev)) {
-		struct pci_bus *bus = to_pci_dev(dev)->bus;
-		struct iort_pci_alias_info info = { .dev = dev };
-
-		node = iort_scan_node(ACPI_IORT_NODE_PCI_ROOT_COMPLEX,
-				      iort_match_node_callback, &bus->dev);
-		if (!node)
-			return NULL;
-
-		info.node = node;
-		err = pci_for_each_dma_alias(to_pci_dev(dev),
-					     iort_pci_iommu_init, &info);
-
-		if (!err && iort_pci_rc_supports_ats(node))
-			dev->iommu_fwspec->flags |= IOMMU_FWSPEC_PCI_RC_ATS;
-	} else {
-		int i = 0;
-
-		node = iort_scan_node(ACPI_IORT_NODE_NAMED_COMPONENT,
-				      iort_match_node_callback, dev);
-		if (!node)
-			return NULL;
-
-		do {
-			parent = iort_node_map_platform_id(node, &streamid,
-							   IORT_IOMMU_TYPE,
-							   i++);
-
-			if (parent)
-				err = iort_iommu_xlate(dev, parent, streamid);
-		} while (parent && !err);
-	}
-
-	/*
-	 * If we have reason to believe the IOMMU driver missed the initial
-	 * add_device callback for dev, replay it to get things in order.
-	 */
-	if (!err) {
-		ops = iort_fwspec_iommu_ops(dev);
-		err = iort_add_device_replay(ops, dev);
-	}
-
-	/* Ignore all other errors apart from EPROBE_DEFER */
-	if (err == -EPROBE_DEFER) {
-		ops = ERR_PTR(err);
-	} else if (err) {
-		dev_dbg(dev, "Adding to IOMMU failed: %d\n", err);
-		ops = NULL;
-	}
-
-	return ops;
-}
-
 static void __init acpi_iort_register_irq(int hwirq, const char *name,
 					  int trigger,
 					  struct resource *res)
-- 
2.21.0


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

* [PATCH v2] ACPI/IORT: Fix build error when IOMMU_SUPPORT is disabled
@ 2019-05-16 15:52     ` Lorenzo Pieralisi
  0 siblings, 0 replies; 16+ messages in thread
From: Lorenzo Pieralisi @ 2019-05-16 15:52 UTC (permalink / raw)
  To: linux-acpi, linux-arm-kernel
  Cc: Jean-Philippe Brucker, Robin Murphy, Kefeng Wang,
	Lorenzo Pieralisi, Will Deacon

If IOMMU_SUPPORT is not enabled (and therefore IOMMU_API is not
selected), struct iommu_fwspec is an empty struct and
IOMMU_FWSPEC_PCI_RC_ATS is not defined, resulting in the following
compilation errors:

drivers/acpi/arm64/iort.c: In function iort_iommu_configure:
drivers/acpi/arm64/iort.c:1079:21: error: struct iommu_fwspec has no member named flag:
    dev->iommu_fwspec->flags |= IOMMU_FWSPEC_PCI_RC_ATS;
                     ^~
drivers/acpi/arm64/iort.c:1079:32: error: IOMMU_FWSPEC_PCI_RC_ATS
undeclared (first use in this function)
    dev->iommu_fwspec->flags |= IOMMU_FWSPEC_PCI_RC_ATS;
                                ^~~~~~~~~~~~~~~~~~~~~~~
drivers/acpi/arm64/iort.c:1079:32: note: each undeclared identifier is reported only once for each function it appears in

Move iort_iommu_configure() (and the helpers functions it relies on)
into CONFIG_IOMMU_API preprocessor guarded code so that when
CONFIG_IOMMU_SUPPORT is not enabled we prevent compiling code that is
basically equivalent to no-OP, fixing the build errors.

Link: https://lore.kernel.org/linux-arm-kernel/20190515034253.79348-1-wangkefeng.wang@huawei.com/
Reported-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Fixes: 5702ee24182f ("ACPI/IORT: Check ATS capability in root complex nodes")
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: Jean-Philippe Brucker <jean-philippe.brucker@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Robin Murphy <robin.murphy@arm.com>
Cc: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 drivers/acpi/arm64/iort.c | 238 +++++++++++++++++++-------------------
 1 file changed, 120 insertions(+), 118 deletions(-)

diff --git a/drivers/acpi/arm64/iort.c b/drivers/acpi/arm64/iort.c
index 9058cb084b91..b5390b4c9ade 100644
--- a/drivers/acpi/arm64/iort.c
+++ b/drivers/acpi/arm64/iort.c
@@ -753,31 +753,6 @@ static int __maybe_unused __get_pci_rid(struct pci_dev *pdev, u16 alias,
 	return 0;
 }
 
-static int arm_smmu_iort_xlate(struct device *dev, u32 streamid,
-			       struct fwnode_handle *fwnode,
-			       const struct iommu_ops *ops)
-{
-	int ret = iommu_fwspec_init(dev, fwnode, ops);
-
-	if (!ret)
-		ret = iommu_fwspec_add_ids(dev, &streamid, 1);
-
-	return ret;
-}
-
-static inline bool iort_iommu_driver_enabled(u8 type)
-{
-	switch (type) {
-	case ACPI_IORT_NODE_SMMU_V3:
-		return IS_BUILTIN(CONFIG_ARM_SMMU_V3);
-	case ACPI_IORT_NODE_SMMU:
-		return IS_BUILTIN(CONFIG_ARM_SMMU);
-	default:
-		pr_warn("IORT node type %u does not describe an SMMU\n", type);
-		return false;
-	}
-}
-
 #ifdef CONFIG_IOMMU_API
 static struct acpi_iort_node *iort_get_msi_resv_iommu(struct device *dev)
 {
@@ -878,15 +853,39 @@ int iort_iommu_msi_get_resv_regions(struct device *dev, struct list_head *head)
 
 	return (resv == its->its_count) ? resv : -ENODEV;
 }
-#else
-static inline const struct iommu_ops *iort_fwspec_iommu_ops(struct device *dev)
-{ return NULL; }
-static inline int iort_add_device_replay(const struct iommu_ops *ops,
-					 struct device *dev)
-{ return 0; }
-int iort_iommu_msi_get_resv_regions(struct device *dev, struct list_head *head)
-{ return 0; }
-#endif
+
+static inline bool iort_iommu_driver_enabled(u8 type)
+{
+	switch (type) {
+	case ACPI_IORT_NODE_SMMU_V3:
+		return IS_BUILTIN(CONFIG_ARM_SMMU_V3);
+	case ACPI_IORT_NODE_SMMU:
+		return IS_BUILTIN(CONFIG_ARM_SMMU);
+	default:
+		pr_warn("IORT node type %u does not describe an SMMU\n", type);
+		return false;
+	}
+}
+
+static int arm_smmu_iort_xlate(struct device *dev, u32 streamid,
+			       struct fwnode_handle *fwnode,
+			       const struct iommu_ops *ops)
+{
+	int ret = iommu_fwspec_init(dev, fwnode, ops);
+
+	if (!ret)
+		ret = iommu_fwspec_add_ids(dev, &streamid, 1);
+
+	return ret;
+}
+
+static bool iort_pci_rc_supports_ats(struct acpi_iort_node *node)
+{
+	struct acpi_iort_root_complex *pci_rc;
+
+	pci_rc = (struct acpi_iort_root_complex *)node->node_data;
+	return pci_rc->ats_attribute & ACPI_IORT_ATS_SUPPORTED;
+}
 
 static int iort_iommu_xlate(struct device *dev, struct acpi_iort_node *node,
 			    u32 streamid)
@@ -933,6 +932,93 @@ static int iort_pci_iommu_init(struct pci_dev *pdev, u16 alias, void *data)
 	return iort_iommu_xlate(info->dev, parent, streamid);
 }
 
+/**
+ * iort_iommu_configure - Set-up IOMMU configuration for a device.
+ *
+ * @dev: device to configure
+ *
+ * Returns: iommu_ops pointer on configuration success
+ *          NULL on configuration failure
+ */
+const struct iommu_ops *iort_iommu_configure(struct device *dev)
+{
+	struct acpi_iort_node *node, *parent;
+	const struct iommu_ops *ops;
+	u32 streamid = 0;
+	int err = -ENODEV;
+
+	/*
+	 * If we already translated the fwspec there
+	 * is nothing left to do, return the iommu_ops.
+	 */
+	ops = iort_fwspec_iommu_ops(dev);
+	if (ops)
+		return ops;
+
+	if (dev_is_pci(dev)) {
+		struct pci_bus *bus = to_pci_dev(dev)->bus;
+		struct iort_pci_alias_info info = { .dev = dev };
+
+		node = iort_scan_node(ACPI_IORT_NODE_PCI_ROOT_COMPLEX,
+				      iort_match_node_callback, &bus->dev);
+		if (!node)
+			return NULL;
+
+		info.node = node;
+		err = pci_for_each_dma_alias(to_pci_dev(dev),
+					     iort_pci_iommu_init, &info);
+
+		if (!err && iort_pci_rc_supports_ats(node))
+			dev->iommu_fwspec->flags |= IOMMU_FWSPEC_PCI_RC_ATS;
+	} else {
+		int i = 0;
+
+		node = iort_scan_node(ACPI_IORT_NODE_NAMED_COMPONENT,
+				      iort_match_node_callback, dev);
+		if (!node)
+			return NULL;
+
+		do {
+			parent = iort_node_map_platform_id(node, &streamid,
+							   IORT_IOMMU_TYPE,
+							   i++);
+
+			if (parent)
+				err = iort_iommu_xlate(dev, parent, streamid);
+		} while (parent && !err);
+	}
+
+	/*
+	 * If we have reason to believe the IOMMU driver missed the initial
+	 * add_device callback for dev, replay it to get things in order.
+	 */
+	if (!err) {
+		ops = iort_fwspec_iommu_ops(dev);
+		err = iort_add_device_replay(ops, dev);
+	}
+
+	/* Ignore all other errors apart from EPROBE_DEFER */
+	if (err == -EPROBE_DEFER) {
+		ops = ERR_PTR(err);
+	} else if (err) {
+		dev_dbg(dev, "Adding to IOMMU failed: %d\n", err);
+		ops = NULL;
+	}
+
+	return ops;
+}
+#else
+static inline const struct iommu_ops *iort_fwspec_iommu_ops(struct device *dev)
+{ return NULL; }
+static inline int iort_add_device_replay(const struct iommu_ops *ops,
+					 struct device *dev)
+{ return 0; }
+int iort_iommu_msi_get_resv_regions(struct device *dev, struct list_head *head)
+{ return 0; }
+const struct iommu_ops *iort_iommu_configure(struct device *dev)
+{ return NULL; }
+#endif
+
 static int nc_dma_get_range(struct device *dev, u64 *size)
 {
 	struct acpi_iort_node *node;
@@ -1031,90 +1117,6 @@ void iort_dma_setup(struct device *dev, u64 *dma_addr, u64 *dma_size)
 	dev_dbg(dev, "dma_pfn_offset(%#08llx)\n", offset);
 }
 
-static bool iort_pci_rc_supports_ats(struct acpi_iort_node *node)
-{
-	struct acpi_iort_root_complex *pci_rc;
-
-	pci_rc = (struct acpi_iort_root_complex *)node->node_data;
-	return pci_rc->ats_attribute & ACPI_IORT_ATS_SUPPORTED;
-}
-
-/**
- * iort_iommu_configure - Set-up IOMMU configuration for a device.
- *
- * @dev: device to configure
- *
- * Returns: iommu_ops pointer on configuration success
- *          NULL on configuration failure
- */
-const struct iommu_ops *iort_iommu_configure(struct device *dev)
-{
-	struct acpi_iort_node *node, *parent;
-	const struct iommu_ops *ops;
-	u32 streamid = 0;
-	int err = -ENODEV;
-
-	/*
-	 * If we already translated the fwspec there
-	 * is nothing left to do, return the iommu_ops.
-	 */
-	ops = iort_fwspec_iommu_ops(dev);
-	if (ops)
-		return ops;
-
-	if (dev_is_pci(dev)) {
-		struct pci_bus *bus = to_pci_dev(dev)->bus;
-		struct iort_pci_alias_info info = { .dev = dev };
-
-		node = iort_scan_node(ACPI_IORT_NODE_PCI_ROOT_COMPLEX,
-				      iort_match_node_callback, &bus->dev);
-		if (!node)
-			return NULL;
-
-		info.node = node;
-		err = pci_for_each_dma_alias(to_pci_dev(dev),
-					     iort_pci_iommu_init, &info);
-
-		if (!err && iort_pci_rc_supports_ats(node))
-			dev->iommu_fwspec->flags |= IOMMU_FWSPEC_PCI_RC_ATS;
-	} else {
-		int i = 0;
-
-		node = iort_scan_node(ACPI_IORT_NODE_NAMED_COMPONENT,
-				      iort_match_node_callback, dev);
-		if (!node)
-			return NULL;
-
-		do {
-			parent = iort_node_map_platform_id(node, &streamid,
-							   IORT_IOMMU_TYPE,
-							   i++);
-
-			if (parent)
-				err = iort_iommu_xlate(dev, parent, streamid);
-		} while (parent && !err);
-	}
-
-	/*
-	 * If we have reason to believe the IOMMU driver missed the initial
-	 * add_device callback for dev, replay it to get things in order.
-	 */
-	if (!err) {
-		ops = iort_fwspec_iommu_ops(dev);
-		err = iort_add_device_replay(ops, dev);
-	}
-
-	/* Ignore all other errors apart from EPROBE_DEFER */
-	if (err == -EPROBE_DEFER) {
-		ops = ERR_PTR(err);
-	} else if (err) {
-		dev_dbg(dev, "Adding to IOMMU failed: %d\n", err);
-		ops = NULL;
-	}
-
-	return ops;
-}
-
 static void __init acpi_iort_register_irq(int hwirq, const char *name,
 					  int trigger,
 					  struct resource *res)
-- 
2.21.0


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

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

end of thread, other threads:[~2019-05-16 15:53 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-15  3:34 [PATCH] ACPI/IORT: Fix build error when IOMMU_SUPPORT disabled Kefeng Wang
2019-05-15  3:34 ` Kefeng Wang
2019-05-15  3:42 ` [PATCH RESEND] " Kefeng Wang
2019-05-15  3:42   ` Kefeng Wang
2019-05-15 10:15   ` Will Deacon
2019-05-15 10:15     ` Will Deacon
2019-05-15 12:06     ` Lorenzo Pieralisi
2019-05-15 12:06       ` Lorenzo Pieralisi
2019-05-15 12:46       ` Robin Murphy
2019-05-15 12:46         ` Robin Murphy
2019-05-15 16:41         ` Lorenzo Pieralisi
2019-05-15 16:41           ` Lorenzo Pieralisi
2019-05-16  1:39           ` Kefeng Wang
2019-05-16  1:39             ` Kefeng Wang
2019-05-16 15:52   ` [PATCH v2] ACPI/IORT: Fix build error when IOMMU_SUPPORT is disabled Lorenzo Pieralisi
2019-05-16 15:52     ` Lorenzo Pieralisi

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.