2019-09-02 08:16:40

by Stephen Rothwell

[permalink] [raw]
Subject: linux-next: build failure after merge of the iommu tree

Hi all,

After merging the iommu tree, today's linux-next build (arm
multi_v7_defconfig) failed like this:

drivers/iommu/iommu.c: In function 'iommu_subsys_init':
drivers/iommu/iommu.c:123:38: error: implicit declaration of function 'sme_active'; did you mean 'cpu_active'? [-Werror=implicit-function-declaration]
123 | if (iommu_default_passthrough() && sme_active()) {
| ^~~~~~~~~~
| cpu_active

Caused by commit

2cc13bb4f59f ("iommu: Disable passthrough mode when SME is active")

sme_active() seems to be only relevant to X86.

I have reverted that commit for today.

--
Cheers,
Stephen Rothwell


Attachments:
(No filename) (499.00 B)
OpenPGP digital signature

2019-09-02 14:06:36

by Joerg Roedel

[permalink] [raw]
Subject: Re: linux-next: build failure after merge of the iommu tree

Hi,

tl;dr: And IOMMU commit introduces a new user for sme_active() in
generic code, and commit

284e21fab2cf x86, s390/mm: Move sme_active() and sme_me_mask to x86-specific header

breaks the build of drivers/iommu/ for all architectures not
implementing sme_active().

On Mon, Sep 02, 2019 at 04:39:51PM +1000, Stephen Rothwell wrote:
> drivers/iommu/iommu.c: In function 'iommu_subsys_init':
> drivers/iommu/iommu.c:123:38: error: implicit declaration of function 'sme_active'; did you mean 'cpu_active'? [-Werror=implicit-function-declaration]
> 123 | if (iommu_default_passthrough() && sme_active()) {
> | ^~~~~~~~~~
> | cpu_active
>
> Caused by commit
>
> 2cc13bb4f59f ("iommu: Disable passthrough mode when SME is active")


Actually it is caused by:

commit 284e21fab2cfcf90dacce565e0b12f29e5df00c1
Author: Thiago Jung Bauermann <[email protected]>
Date: Tue Aug 6 01:49:17 2019 -0300

x86, s390/mm: Move sme_active() and sme_me_mask to x86-specific header

which removes the sme_active prototype from the generic headers. The
iommu commit is in next already for a couple of days and didn't cause
problems before.

> sme_active() seems to be only relevant to X86.

It has an implementation on x86 and s390.

> I have reverted that commit for today.

Thanks, but I suggest reverting above commit instead.


Regards,

Joerg

2019-09-02 14:28:02

by Tom Lendacky

[permalink] [raw]
Subject: Re: linux-next: build failure after merge of the iommu tree

On 9/2/19 9:03 AM, Joerg Roedel wrote:
> Hi,
>
> tl;dr: And IOMMU commit introduces a new user for sme_active() in
> generic code, and commit
>
> 284e21fab2cf x86, s390/mm: Move sme_active() and sme_me_mask to x86-specific header
>
> breaks the build of drivers/iommu/ for all architectures not
> implementing sme_active().
>
> On Mon, Sep 02, 2019 at 04:39:51PM +1000, Stephen Rothwell wrote:
>> drivers/iommu/iommu.c: In function 'iommu_subsys_init':
>> drivers/iommu/iommu.c:123:38: error: implicit declaration of function 'sme_active'; did you mean 'cpu_active'? [-Werror=implicit-function-declaration]
>> 123 | if (iommu_default_passthrough() && sme_active()) {

Maybe we should make this mem_encrypt_active(), since this will probably
be needed if/when an IOMMU device is eventually added to a guest, and the
referenced commit below doesn't remove that call.

Thanks,
Tom

>> | ^~~~~~~~~~
>> | cpu_active
>>
>> Caused by commit
>>
>> 2cc13bb4f59f ("iommu: Disable passthrough mode when SME is active")
>
>
> Actually it is caused by:
>
> commit 284e21fab2cfcf90dacce565e0b12f29e5df00c1
> Author: Thiago Jung Bauermann <[email protected]>
> Date: Tue Aug 6 01:49:17 2019 -0300
>
> x86, s390/mm: Move sme_active() and sme_me_mask to x86-specific header
>
> which removes the sme_active prototype from the generic headers. The
> iommu commit is in next already for a couple of days and didn't cause
> problems before.
>
>> sme_active() seems to be only relevant to X86.
>
> It has an implementation on x86 and s390.
>
>> I have reverted that commit for today.
>
> Thanks, but I suggest reverting above commit instead.
>
>
> Regards,
>
> Joerg
>

2019-09-03 05:29:56

by Stephen Rothwell

[permalink] [raw]
Subject: Re: linux-next: build failure after merge of the iommu tree

Hi all,

On Mon, 2 Sep 2019 14:26:40 +0000 "Lendacky, Thomas" <[email protected]> wrote:
>
> On 9/2/19 9:03 AM, Joerg Roedel wrote:
> >
> > tl;dr: And IOMMU commit introduces a new user for sme_active() in
> > generic code, and commit
> >
> > 284e21fab2cf x86, s390/mm: Move sme_active() and sme_me_mask to x86-specific header
> >
> > breaks the build of drivers/iommu/ for all architectures not
> > implementing sme_active().
> >
> > On Mon, Sep 02, 2019 at 04:39:51PM +1000, Stephen Rothwell wrote:
> >> drivers/iommu/iommu.c: In function 'iommu_subsys_init':
> >> drivers/iommu/iommu.c:123:38: error: implicit declaration of function 'sme_active'; did you mean 'cpu_active'? [-Werror=implicit-function-declaration]
> >> 123 | if (iommu_default_passthrough() && sme_active()) {
>
> Maybe we should make this mem_encrypt_active(), since this will probably
> be needed if/when an IOMMU device is eventually added to a guest, and the
> referenced commit below doesn't remove that call.

I have done that for today:

From: Stephen Rothwell <[email protected]>
Date: Tue, 3 Sep 2019 15:19:34 +1000
Subject: [PATCH] iommu: use mem_encrypt_active() instead of sme_active()

Signed-off-by: Stephen Rothwell <[email protected]>
---
drivers/iommu/iommu.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index 66cfacaa483d..b870044ecd49 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -120,7 +120,7 @@ static int __init iommu_subsys_init(void)
else
iommu_set_default_translated(false);

- if (iommu_default_passthrough() && sme_active()) {
+ if (iommu_default_passthrough() && mem_encrypt_active()) {
pr_info("SME detected - Disabling default IOMMU Passthrough\n");
iommu_set_default_translated(false);
}
--
2.23.0.rc1

--
Cheers,
Stephen Rothwell


Attachments:
(No filename) (499.00 B)
OpenPGP digital signature

2019-09-03 13:21:50

by Joerg Roedel

[permalink] [raw]
Subject: [PATCH] iommu: Don't use sme_active() in generic code

On Tue, Sep 03, 2019 at 03:28:49PM +1000, Stephen Rothwell wrote:
> Hi all,
>
> On Mon, 2 Sep 2019 14:26:40 +0000 "Lendacky, Thomas" <[email protected]> wrote:
> > Maybe we should make this mem_encrypt_active(), since this will probably
> > be needed if/when an IOMMU device is eventually added to a guest, and the
> > referenced commit below doesn't remove that call.
>
> I have done that for today:

Thanks Stephen and Tom. I queued the attached patch into the iommu tree
to fix the problem.

From 2896ba40d0becdb72b45f096cad70633abc014f6 Mon Sep 17 00:00:00 2001
From: Joerg Roedel <[email protected]>
Date: Tue, 3 Sep 2019 15:15:44 +0200
Subject: [PATCH] iommu: Don't use sme_active() in generic code

Switch to the generic function mem_encrypt_active() because
sme_active() is x86 specific and can't be called from
generic code on other platforms than x86.

Fixes: 2cc13bb4f59f ("iommu: Disable passthrough mode when SME is active")
Signed-off-by: Joerg Roedel <[email protected]>
---
drivers/iommu/iommu.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index 66cfacaa483d..d658c7c6a2ab 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -120,8 +120,8 @@ static int __init iommu_subsys_init(void)
else
iommu_set_default_translated(false);

- if (iommu_default_passthrough() && sme_active()) {
- pr_info("SME detected - Disabling default IOMMU Passthrough\n");
+ if (iommu_default_passthrough() && mem_encrypt_active()) {
+ pr_info("Memory encryption detected - Disabling default IOMMU Passthrough\n");
iommu_set_default_translated(false);
}
}
--
2.16.4

2019-09-03 16:05:28

by Thiago Jung Bauermann

[permalink] [raw]
Subject: Re: [PATCH] iommu: Don't use sme_active() in generic code


Joerg Roedel <[email protected]> writes:

> On Tue, Sep 03, 2019 at 03:28:49PM +1000, Stephen Rothwell wrote:
>> Hi all,
>>
>> On Mon, 2 Sep 2019 14:26:40 +0000 "Lendacky, Thomas" <[email protected]> wrote:
>> > Maybe we should make this mem_encrypt_active(), since this will probably
>> > be needed if/when an IOMMU device is eventually added to a guest, and the
>> > referenced commit below doesn't remove that call.
>>
>> I have done that for today:
>
> Thanks Stephen and Tom. I queued the attached patch into the iommu tree
> to fix the problem.
>
> From 2896ba40d0becdb72b45f096cad70633abc014f6 Mon Sep 17 00:00:00 2001
> From: Joerg Roedel <[email protected]>
> Date: Tue, 3 Sep 2019 15:15:44 +0200
> Subject: [PATCH] iommu: Don't use sme_active() in generic code
>
> Switch to the generic function mem_encrypt_active() because
> sme_active() is x86 specific and can't be called from
> generic code on other platforms than x86.
>
> Fixes: 2cc13bb4f59f ("iommu: Disable passthrough mode when SME is active")
> Signed-off-by: Joerg Roedel <[email protected]>

Thank you!

--
Thiago Jung Bauermann
IBM Linux Technology Center