Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3689824imm; Tue, 29 May 2018 11:40:15 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpvEApmOZ+9D33M3PnNATvvLQwNr15N9YNr+Xp+mTBly9cuuB0z4fi87bYhERWxQc+SqBL8 X-Received: by 2002:a63:7145:: with SMTP id b5-v6mr14863512pgn.45.1527619215874; Tue, 29 May 2018 11:40:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527619215; cv=none; d=google.com; s=arc-20160816; b=mfoTB8gDofc6TiR48l7wD0v9dQPuJVHctp3ULaOEN3woqp1qzx/pyJQyvs5qg6cZTZ wA5H7ptGn6hnlWX6twRSCKfMneN0AZvStKP78U/LdlLpRF0xRrXpHk3Ef4RhWyg8Ov7d KBUzAuM4DstYn8irG44S+wOjN66Af6GhO10B5hz9zw9W6Dy20ps+Ofs31QO6sXiyQ6DI p/a2F1P69e2L9VYfZ6XoWVwKoV1nktfJDsJ+Vc+O5wZwLEFsuNwGq9p5ZWuk5Kq3qihC xL5g2MAMXDBhED78VyoBVfRkSwGKnbuFxOjC/ytlrWiZLPOMWOpIqY40ypoHevKHwHm3 EmYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=iCiiuwRwX3l6NbynZHLJFSweG7SIxY7HSnYngQWEuBo=; b=eC+iFXQjXVJdguXLVQcySTMVIzFAp8BUq1Lvn7TvYvhYmSnDwvU0VDE0xfHX/bY60Z dVQTEVF0vOgKeTxglxu7A6QnreAgVMSrx4D+yG0E5tV5BjTJXD+P7ifY0+mQm374rnTk VAiMcZbmGdKfQ/liAxR9hkDsbbziToU0NY8M3K8AELsNiW0fwJLAlyeZa/ZaR7bduVpO eW4IALJe+/yZTVkyuzPcdHCZLDgF3p8glX+0ZVGBfAof/RJghA6sAFikkh918dXfLYKV I7WHQL1LKOEPNBS1qRwJdffeVpU/GjWiQlnytgZQjzI+7fKnTq2SU0DmqC6GsEjrDKgD sJRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=WhRQ54Ia; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a6-v6si12702913plz.351.2018.05.29.11.40.01; Tue, 29 May 2018 11:40:15 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=WhRQ54Ia; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936974AbeE2Sji (ORCPT + 99 others); Tue, 29 May 2018 14:39:38 -0400 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:42425 "EHLO out1-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754671AbeE2Sjh (ORCPT ); Tue, 29 May 2018 14:39:37 -0400 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 3110B21D23; Tue, 29 May 2018 14:39:37 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Tue, 29 May 2018 14:39:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=fm2; bh=iCiiuwRwX3l6NbynZHLJFSweG7SIx Y7HSnYngQWEuBo=; b=WhRQ54IaagseB305iaul5/Ez735TaN6CK3CLfP90DrY18 DhRa9DRjTRqJobE89ZZfIbvYvIp3WbXOwkc7Ai/Z3we5Xfp9YAXM0V9Pf+i7DkZg 6lSfwOyUjUKCcleZYnozE19baavZrqOhkZS+b7b29V8i29LAR1GNFMnZZBFWsOAj nrwwchzLZVqyCcoVe1SRvUb02UGG5KaCXA17rpJGH8zf7WHEqSyxrrwJOm1AZPQA gIMFF2Swy3Om5WslcS6+8PsVPIV3jhlT5AmeuqGMbMa4A5EEXw9lV2xCMstFKq9j uKfQTUX6FvY3JyTph5A7I3oaSjZ9KJip78pw5E7dQ== X-ME-Proxy: X-ME-Proxy: X-ME-Proxy: X-ME-Proxy: X-ME-Proxy: X-ME-Proxy: X-ME-Sender: Received: from localhost (lfbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.messagingengine.com (Postfix) with ESMTPA id 9779BE5036; Tue, 29 May 2018 14:39:36 -0400 (EDT) Date: Tue, 29 May 2018 20:39:17 +0200 From: Greg KH To: Gary R Hook Cc: iommu@lists.linux-foundation.org, joro@8bytes.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v8 2/2] iommu/amd: Add basic debugfs infrastructure for AMD IOMMU Message-ID: <20180529183917.GA10618@kroah.com> References: <152761784341.2654.8609366076331539902.stgit@sosgrh1.amd.com> <152761820371.2654.4551405686504157036.stgit@sosgrh1.amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <152761820371.2654.4551405686504157036.stgit@sosgrh1.amd.com> User-Agent: Mutt/1.10.0 (2018-05-17) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 29, 2018 at 01:23:23PM -0500, Gary R Hook wrote: > Implement a skeleton framework for debugfs support in the > AMD IOMMU. Add a hidden boolean to Kconfig that is defined > for the AMD IOMMU when general IOMMY DebugFS support is > enabled. > > Signed-off-by: Gary R Hook > --- > drivers/iommu/Kconfig | 4 ++++ > drivers/iommu/Makefile | 1 + > drivers/iommu/amd_iommu_debugfs.c | 39 +++++++++++++++++++++++++++++++++++++ > drivers/iommu/amd_iommu_init.c | 6 ++++-- > drivers/iommu/amd_iommu_proto.h | 6 ++++++ > drivers/iommu/amd_iommu_types.h | 5 +++++ > 6 files changed, 59 insertions(+), 2 deletions(-) > create mode 100644 drivers/iommu/amd_iommu_debugfs.c > > diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig > index f9af25ac409f..ec223f6f4ad4 100644 > --- a/drivers/iommu/Kconfig > +++ b/drivers/iommu/Kconfig > @@ -137,6 +137,10 @@ config AMD_IOMMU > your BIOS for an option to enable it or if you have an IVRS ACPI > table. > > +config AMD_IOMMU_DEBUGFS > + def_bool y Why default y? Can you not boot a box without this? If not, it should not be Y. > + depends on AMD_IOMMU && IOMMU_DEBUGFS > + > config AMD_IOMMU_V2 > tristate "AMD IOMMU Version 2 driver" > depends on AMD_IOMMU > diff --git a/drivers/iommu/Makefile b/drivers/iommu/Makefile > index 74cfbc392862..47fd6ea9de2d 100644 > --- a/drivers/iommu/Makefile > +++ b/drivers/iommu/Makefile > @@ -11,6 +11,7 @@ obj-$(CONFIG_IOMMU_IOVA) += iova.o > obj-$(CONFIG_OF_IOMMU) += of_iommu.o > obj-$(CONFIG_MSM_IOMMU) += msm_iommu.o > obj-$(CONFIG_AMD_IOMMU) += amd_iommu.o amd_iommu_init.o > +obj-$(CONFIG_AMD_IOMMU_DEBUGFS) += amd_iommu_debugfs.o > obj-$(CONFIG_AMD_IOMMU_V2) += amd_iommu_v2.o > obj-$(CONFIG_ARM_SMMU) += arm-smmu.o > obj-$(CONFIG_ARM_SMMU_V3) += arm-smmu-v3.o > diff --git a/drivers/iommu/amd_iommu_debugfs.c b/drivers/iommu/amd_iommu_debugfs.c > new file mode 100644 > index 000000000000..6dff98552969 > --- /dev/null > +++ b/drivers/iommu/amd_iommu_debugfs.c > @@ -0,0 +1,39 @@ > +// SPDX-License-Identifier: GPL-2.0 > +/* > + * AMD IOMMU driver > + * > + * Copyright (C) 2018 Advanced Micro Devices, Inc. > + * > + * Author: Gary R Hook > + */ > + > +#include > +#include > +#include > +#include "amd_iommu_proto.h" > +#include "amd_iommu_types.h" > + > +static struct dentry *amd_iommu_debugfs; > +static DEFINE_MUTEX(amd_iommu_debugfs_lock); > + > +#define MAX_NAME_LEN 20 > + > +void amd_iommu_debugfs_setup(struct amd_iommu *iommu) > +{ > + char name[MAX_NAME_LEN + 1]; > + > + mutex_lock(&amd_iommu_debugfs_lock); > + if (!amd_iommu_debugfs) > + amd_iommu_debugfs = iommu_debugfs_new_driver_dir("amd"); > + mutex_unlock(&amd_iommu_debugfs_lock); > + > + if (amd_iommu_debugfs) { Do not test this. > + snprintf(name, MAX_NAME_LEN, "iommu%02d", iommu->index); > + iommu->debugfs = debugfs_create_dir(name, > + amd_iommu_debugfs); > + if (!iommu->debugfs) { No, you don't care about the return value of any debugfs call. Just save the directory and move on. If it's not correct, find, nothing is wrong, just keep going. thanks, greg k-h