Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2391013pxb; Tue, 9 Mar 2021 01:00:39 -0800 (PST) X-Google-Smtp-Source: ABdhPJyDDhy/IGC7S44bNSp+PgwtvtDrqF9adsL+De4smrfMidlGMckDFmqC2bd48unZL2+bpIVj X-Received: by 2002:a05:6402:38d:: with SMTP id o13mr2785033edv.337.1615280439207; Tue, 09 Mar 2021 01:00:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615280439; cv=none; d=google.com; s=arc-20160816; b=A4ys1afQ7y8Mpsz2jTVl55bfUCxtxKCbnONEOTwaSr2tlvbOsnmfnfz1xPEBv0VLiS TsfTHT5UDu2XKq17M4J+8e1SCjnkY8t+IF2hBZmbmJuOLOe5QltfiwvoaWVdBBf298Y8 Evk6BCvnQmFPvIJPO9yzEA0lyspx2bJooYUBxJt8DifxwsYYnKaXWlC2XK+K8GtoXyMV svY8vUbje0WxfFp7Xa9IayeV26i0PY/O1R+gaqJdBAaku3b5R2U1aZx4k1xmokpOWTcg mcbEkvAQMYTXpc5YkwZHiOtAr3cLab8Z0azr32klh1FdEFTpe/El4bNwqshYfESkaRn+ ciWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=jGK/dgnckM0iL/FWDT0OvLSiCZ13x5A2GXjqOceFb0s=; b=pN2aZaxHkjTrGYe097YOMJFsOpvh72k6vR+749YKGt9CPOl/52ErYuVEkCUd4DSI+8 QovolpUiPDxyOTWE1Fak+Clxe+FufEMte/+Elp0M4fzMEeMhKyjkOCUO3egkjRRMawcO jZp6qGezmLyG7968p5/d5yzcTtrcLzlMR7vTiunekj3JOS48WWfWE/TE80Q9vFylcbIU fvUDnjesI/I1cyPX18M4Ja9Vr2+ce9pKIUC4TaGFyIyfMPZ1aTXC5c7wYj9TgcLZ0wH+ wFXkCNLUQFUi4R3v6fP1I67rkem3q7oRClJZ9KKjUklnNUzhx4XehLFDJ1+gXEzGwiOh 8mgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=MDRPXWtV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p9si9110340edm.322.2021.03.09.01.00.15; Tue, 09 Mar 2021 01:00:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=MDRPXWtV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229639AbhCII7H (ORCPT + 99 others); Tue, 9 Mar 2021 03:59:07 -0500 Received: from mail.kernel.org ([198.145.29.99]:45340 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229480AbhCII6y (ORCPT ); Tue, 9 Mar 2021 03:58:54 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4BBD764ED9 for ; Tue, 9 Mar 2021 08:58:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1615280334; bh=bGrgYHxt1zWRljmNWdTWF89KwQPE/WC7bjxroFUZJHs=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=MDRPXWtVs3yMMI2osLWEdRXy9xiKGo9kAp4Cdr1VTzeHhbW/HPaPLJLaeX4AuzpZo zAc5ZHRcWCHSVB1NPZOowwzzf2l7TZ7yILtMOO44xoq3OSCSiQGv5XBjtqEu7XOtpa R11yFXYTUKGXauoGArGgeBKSPTEHU+mG0b1dyDTGqRRGjD12JLZW24sYpgULzT3x9X yfxFvPRwtbz6TAd/snAQtmYm5WNPDougT6CuJYx9K++8A9Q+7tw6b6EL4GZBzKG9oq i/7crnr+2//TOewdvwSDZxPApDyeCmEMil4R16x7Z7X0NUOVIO2BZMM7pp5neNQfBa mgoSQmGX1TDAw== Received: by mail-oi1-f175.google.com with SMTP id x135so9670276oia.9 for ; Tue, 09 Mar 2021 00:58:54 -0800 (PST) X-Gm-Message-State: AOAM533C6yW7e+7OVpt5DkJhlsnTF5hoWx93wde5QdcGJx7+PGv2/Qca iR7RcH9fIv4fVpo6pA/8/gwCDGhl+PeDWPWW8g8= X-Received: by 2002:aca:bf44:: with SMTP id p65mr1097765oif.11.1615280333519; Tue, 09 Mar 2021 00:58:53 -0800 (PST) MIME-Version: 1.0 References: <4c692eff-9d57-278e-8da4-36bc2c293506@amd.com> <20210309032356.20800-1-Felix.Kuehling@amd.com> In-Reply-To: <20210309032356.20800-1-Felix.Kuehling@amd.com> From: Arnd Bergmann Date: Tue, 9 Mar 2021 09:58:37 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 1/1] drm/amdkfd: fix build error with AMD_IOMMU_V2=m To: Felix Kuehling Cc: Alex Deucher , =?UTF-8?Q?Christian_K=C3=B6nig?= , David Airlie , "linux-kernel@vger.kernel.org" , amd-gfx list , dri-devel , "open list:IOMMU DRIVERS" , Joerg Roedel , Will Deacon Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 9, 2021 at 4:23 AM Felix Kuehling wrote: > > Using 'imply AMD_IOMMU_V2' does not guarantee that the driver can link > against the exported functions. If the GPU driver is built-in but the > IOMMU driver is a loadable module, the kfd_iommu.c file is indeed > built but does not work: > > x86_64-linux-ld: drivers/gpu/drm/amd/amdkfd/kfd_iommu.o: in function `kfd_iommu_bind_process_to_device': > kfd_iommu.c:(.text+0x516): undefined reference to `amd_iommu_bind_pasid' > x86_64-linux-ld: drivers/gpu/drm/amd/amdkfd/kfd_iommu.o: in function `kfd_iommu_unbind_process': > kfd_iommu.c:(.text+0x691): undefined reference to `amd_iommu_unbind_pasid' > x86_64-linux-ld: drivers/gpu/drm/amd/amdkfd/kfd_iommu.o: in function `kfd_iommu_suspend': > kfd_iommu.c:(.text+0x966): undefined reference to `amd_iommu_set_invalidate_ctx_cb' > x86_64-linux-ld: kfd_iommu.c:(.text+0x97f): undefined reference to `amd_iommu_set_invalid_ppr_cb' > x86_64-linux-ld: kfd_iommu.c:(.text+0x9a4): undefined reference to `amd_iommu_free_device' > x86_64-linux-ld: drivers/gpu/drm/amd/amdkfd/kfd_iommu.o: in function `kfd_iommu_resume': > kfd_iommu.c:(.text+0xa9a): undefined reference to `amd_iommu_init_device' > x86_64-linux-ld: kfd_iommu.c:(.text+0xadc): undefined reference to `amd_iommu_set_invalidate_ctx_cb' > x86_64-linux-ld: kfd_iommu.c:(.text+0xaff): undefined reference to `amd_iommu_set_invalid_ppr_cb' > x86_64-linux-ld: kfd_iommu.c:(.text+0xc72): undefined reference to `amd_iommu_bind_pasid' > x86_64-linux-ld: kfd_iommu.c:(.text+0xe08): undefined reference to `amd_iommu_set_invalidate_ctx_cb' > x86_64-linux-ld: kfd_iommu.c:(.text+0xe26): undefined reference to `amd_iommu_set_invalid_ppr_cb' > x86_64-linux-ld: kfd_iommu.c:(.text+0xe42): undefined reference to `amd_iommu_free_device' > > Use IS_REACHABLE to only build IOMMU-V2 support if the amd_iommu symbols > are reachable by the amdkfd driver. Output a warning if they are not, > because that may not be what the user was expecting. This would fix the compile-time failure, but it still fails my CI because you introduce a compile-time warning. Can you change it into a runtime warning instead? Neither type of warning is likely to actually reach the person trying to debug the problem, so you still end up with machines that don't do what they should, but I can live with the runtime warning as long as the build doesn't break. I think the proper fix would be to not rely on custom hooks into a particular IOMMU driver, but to instead ensure that the amdgpu driver can do everything it needs through the regular linux/iommu.h interfaces. I realize this is more work, but I wonder if you've tried that, and why it didn't work out. Arnd