Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2010744pxb; Mon, 8 Mar 2021 11:37:51 -0800 (PST) X-Google-Smtp-Source: ABdhPJzXvVd4ym5wa72hjzPadr666UidRX6PFwIoSvRs3tReAOjAOTiWvhbVlCjtU+O0eb9QJJAq X-Received: by 2002:aa7:d74d:: with SMTP id a13mr170291eds.199.1615232271222; Mon, 08 Mar 2021 11:37:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615232271; cv=none; d=google.com; s=arc-20160816; b=sg0tkm+f3AB02kbJe058QY/XIf3+8Ic7iwtUk2tpjBwDM+O1sU0n89viuA9J78V+AL jn/steQ177FN4+aKpYZKihYFXPa73KwxIHha+Alcn077sJICz25Dvvf8ayp5txV2sXnR p3UVnE+R90oDUAkgZdnd1PyeI7VwTYt5WC6D3izPJsW8Xaxyp6G4Pzgn5l+YCEk/iBzq C7yJU40b127S/cz293RLAx1feBWIvLXvQOQIHLLkX7NdB9gJtaPdITj63vaZ1giOlpnl RYTDsespL4hNDLd1L302ZnYpeUMDD6kOC9auL7Bx7azVA80jB3DFq0n1e79pTvsBe5Eu xL0A== 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=m4YJmYB2+Z9lq9j60tDmgLmSgg7LcaNeT9Lsyzo2ZFg=; b=v+7Qs2ClACbPdk22XF4B7LotZYWwIZZTOTKjXMFb/wj3uIR40ZJiVdSMPY0iTD3iK2 //fgSQLVxYL08vVex39OrkIqU3X/Nxna+G+kEmL370kbN5bg24Ya7o49Yz3TvzPcKbeX 2puh4Dz/zeHgzqZbGD53yXUbpnaHbftNjJIdqYsv947XinOQT06mw3tZVHS6nWV/dXzR 5Qstg1TUCtiOx8FQYa8Kp6q/iNLONxk7hSpjRC+j5v2yOPcU+D4fQOYy+8HiLrL1SCoD 9MxXDbsrweX85oG8z0hNs/R8/VnldZCddSbusy6n0Ho7PZ7+CGe4QXluLdTOXQ1NIoeW LoGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="KDRj/mXQ"; 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 k5si7323680ejj.483.2021.03.08.11.37.28; Mon, 08 Mar 2021 11:37:51 -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="KDRj/mXQ"; 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 S230250AbhCHTeH (ORCPT + 99 others); Mon, 8 Mar 2021 14:34:07 -0500 Received: from mail.kernel.org ([198.145.29.99]:50056 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230075AbhCHTdw (ORCPT ); Mon, 8 Mar 2021 14:33:52 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id BEC1165287 for ; Mon, 8 Mar 2021 19:33:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1615232031; bh=DM0rKDaLb7B/JShd7XPcETbrdwDndqNLTREc2OMkJWo=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=KDRj/mXQmuAt4KfsI9B52LLS2Kp5PIsmOyUCzyzXEON6+rFu9lKtul/CmcHloxTtB A+7dZYUsagSvQUE1TBI4rMBXZ27zBbv0rDH/tU0MQzf/LZlVUivtqtVSTc2ixqKh8d IXhfMObEfuvpwDxUiTyY2pBj2uBePEDOBiQMurZ09BYMIndseWmYtyTeV9Dy1vwHoD Rxnl2zgKB5UU33zye7TQBpXg7HZY4txRhC1bs4tE5Cbcglt1UkVsazPFfUoBRvOUXV Q9Eqlr9g3ruRYcr9vPC6Z6Ly7d+wjTh80RaxG0z97BJOGGFmQC0C+SR1bLbNJHE7MT hI4quyeUkAKLg== Received: by mail-ot1-f48.google.com with SMTP id j8so10419586otc.0 for ; Mon, 08 Mar 2021 11:33:51 -0800 (PST) X-Gm-Message-State: AOAM532b4fzqdP3rOaMxrn/CMeLa2T9NqM5Z5BGmD8a/wq1hbWZp45Wx PCSe9spqsOS3QU6igqy72mxmRxNkGzKzJBJMRP8= X-Received: by 2002:a05:6830:148c:: with SMTP id s12mr3450789otq.251.1615232031118; Mon, 08 Mar 2021 11:33:51 -0800 (PST) MIME-Version: 1.0 References: <20210308153359.2513446-1-arnd@kernel.org> <176cae4d-33bc-1d51-a7d7-58eeeea5180e@amd.com> <92a6c999-c20a-2311-4e31-209a2d9229ed@amd.com> In-Reply-To: <92a6c999-c20a-2311-4e31-209a2d9229ed@amd.com> From: Arnd Bergmann Date: Mon, 8 Mar 2021 20:33:34 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] drm/amdkfd: fix build error with missing AMD_IOMMU_V2 To: Felix Kuehling Cc: Alex Deucher , =?UTF-8?Q?Christian_K=C3=B6nig?= , David Airlie , Daniel Vetter , Oded Gabbay , Colin Ian King , Philip Yang , amd-gfx list , dri-devel , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 8, 2021 at 8:11 PM Felix Kuehling wrote: > > Am 2021-03-08 um 2:05 p.m. schrieb Arnd Bergmann: > > On Mon, Mar 8, 2021 at 5:24 PM Felix Kuehling wrote: > >> The driver build should work without IOMMUv2. In amdkfd/Makefile, we > >> have this condition: > >> > >> ifneq ($(CONFIG_AMD_IOMMU_V2),) > >> AMDKFD_FILES += $(AMDKFD_PATH)/kfd_iommu.o > >> endif > >> > >> In amdkfd/kfd_iommu.h we define inline stubs of the functions that are > >> causing your link-failures if IOMMU_V2 is not enabled: > >> > >> #if defined(CONFIG_AMD_IOMMU_V2_MODULE) || defined(CONFIG_AMD_IOMMU_V2) > >> ... function declarations ... > >> #else > >> ... stubs ... > >> #endif > > Right, that is the problem I tried to explain in my patch description. > > > > Should we just drop the 'imply' then and add a proper dependency like this? > > > > depends on DRM_AMDGPU && (X86_64 || ARM64 || PPC64) > > depends on AMD_IOMMU_V2=y || DRM_AMDGPU=m > > > > I can send a v2 after some testing if you prefer this version. > > No. My point is, there should not be a hard dependency. The build should > work without CONFIG_AMD_IOMMU_V2. I don't understand why it's not > working for you. It looks like you're building kfd_iommu.o, which should > not be happening when AMD_IOMMU_V2 is not enabled. The condition in > amdkfd/Makefile should make sure that kfd_iommu.o doesn't get built with > your kernel config. Again, as I explained in the changelog text, AMD_IOMMU_V2 configured as a loadable module, while AMDGPU is configured as built-in. The causes a link failure for the vmlinux file, because the linker cannot resolve addresses of loadable modules at compile time -- they have not been loaded yet. Arnd