Linux IOMMU Development
 help / color / mirror / Atom feed
From: Vasant Hegde <vasant.hegde@amd.com>
To: kernel test robot <lkp@intel.com>
Cc: oe-kbuild-all@lists.linux.dev, iommu@lists.linux.dev,
	Joerg Roedel <jroedel@suse.de>, Jason Gunthorpe <jgg@nvidia.com>,
	Jerry Snitselaar <jsnitsel@redhat.com>
Subject: Re: [joro-iommu:x86/amd 16/19] drivers/iommu/amd/iommu.c:829:21: warning: variable 'entry' set but not used
Date: Thu, 12 Oct 2023 10:56:27 +0530	[thread overview]
Message-ID: <f8163afc-858e-7830-d6dc-79c6b60d7c2d@amd.com> (raw)
In-Reply-To: <202310071103.BYatoc0b-lkp@intel.com>

Hi,


On 10/7/2023 8:50 AM, kernel test robot wrote:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu.git x86/amd
> head:   189116d5ad54eee2bab82c5f12e837912fc0b4c4
> commit: d55b0d2e075ad32d560cdd35a2016973fda52ed6 [16/19] iommu/amd: Remove PPR support
> config: x86_64-randconfig-003-20231007 (https://download.01.org/0day-ci/archive/20231007/202310071103.BYatoc0b-lkp@intel.com/config)
> compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231007/202310071103.BYatoc0b-lkp@intel.com/reproduce)
> 
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@intel.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202310071103.BYatoc0b-lkp@intel.com/
> 
> All warnings (new ones prefixed by >>):
> 
>    drivers/iommu/amd/iommu.c: In function 'iommu_poll_ppr_log':
>>> drivers/iommu/amd/iommu.c:829:21: warning: variable 'entry' set but not used [-Wunused-but-set-variable]
>      829 |                 u64 entry[2];
>          |                     ^~~~~


Commit d55b0d2e075 (iommu/next branch), removed PPR support. Hence this become
unused variable. But soon we will be adding PPR support for SVA [1]. Hence I
just added comment and left it as is (instead of removing and adding it back again).

[1]
https://lore.kernel.org/linux-iommu/20230911121046.1025732-1-vasant.hegde@amd.com/T/#u


-Vasant


> 
> 
> vim +/entry +829 drivers/iommu/amd/iommu.c
> 
> 90008ee4b811c9 arch/x86/kernel/amd_iommu.c Joerg Roedel 2008-09-09  816  
> 72e1dcc4192288 drivers/iommu/amd_iommu.c   Joerg Roedel 2011-11-10  817  static void iommu_poll_ppr_log(struct amd_iommu *iommu)
> 72e1dcc4192288 drivers/iommu/amd_iommu.c   Joerg Roedel 2011-11-10  818  {
> 72e1dcc4192288 drivers/iommu/amd_iommu.c   Joerg Roedel 2011-11-10  819  	u32 head, tail;
> 72e1dcc4192288 drivers/iommu/amd_iommu.c   Joerg Roedel 2011-11-10  820  
> 72e1dcc4192288 drivers/iommu/amd_iommu.c   Joerg Roedel 2011-11-10  821  	if (iommu->ppr_log == NULL)
> 72e1dcc4192288 drivers/iommu/amd_iommu.c   Joerg Roedel 2011-11-10  822  		return;
> 72e1dcc4192288 drivers/iommu/amd_iommu.c   Joerg Roedel 2011-11-10  823  
> 72e1dcc4192288 drivers/iommu/amd_iommu.c   Joerg Roedel 2011-11-10  824  	head = readl(iommu->mmio_base + MMIO_PPR_HEAD_OFFSET);
> 72e1dcc4192288 drivers/iommu/amd_iommu.c   Joerg Roedel 2011-11-10  825  	tail = readl(iommu->mmio_base + MMIO_PPR_TAIL_OFFSET);
> 72e1dcc4192288 drivers/iommu/amd_iommu.c   Joerg Roedel 2011-11-10  826  
> 72e1dcc4192288 drivers/iommu/amd_iommu.c   Joerg Roedel 2011-11-10  827  	while (head != tail) {
> eee53537c476c9 drivers/iommu/amd_iommu.c   Joerg Roedel 2012-06-01  828  		volatile u64 *raw;
> eee53537c476c9 drivers/iommu/amd_iommu.c   Joerg Roedel 2012-06-01 @829  		u64 entry[2];
> eee53537c476c9 drivers/iommu/amd_iommu.c   Joerg Roedel 2012-06-01  830  		int i;
> 72e1dcc4192288 drivers/iommu/amd_iommu.c   Joerg Roedel 2011-11-10  831  
> eee53537c476c9 drivers/iommu/amd_iommu.c   Joerg Roedel 2012-06-01  832  		raw = (u64 *)(iommu->ppr_log + head);
> 72e1dcc4192288 drivers/iommu/amd_iommu.c   Joerg Roedel 2011-11-10  833  
> eee53537c476c9 drivers/iommu/amd_iommu.c   Joerg Roedel 2012-06-01  834  		/*
> eee53537c476c9 drivers/iommu/amd_iommu.c   Joerg Roedel 2012-06-01  835  		 * Hardware bug: Interrupt may arrive before the entry is
> eee53537c476c9 drivers/iommu/amd_iommu.c   Joerg Roedel 2012-06-01  836  		 * written to memory. If this happens we need to wait for the
> eee53537c476c9 drivers/iommu/amd_iommu.c   Joerg Roedel 2012-06-01  837  		 * entry to arrive.
> eee53537c476c9 drivers/iommu/amd_iommu.c   Joerg Roedel 2012-06-01  838  		 */
> eee53537c476c9 drivers/iommu/amd_iommu.c   Joerg Roedel 2012-06-01  839  		for (i = 0; i < LOOP_TIMEOUT; ++i) {
> eee53537c476c9 drivers/iommu/amd_iommu.c   Joerg Roedel 2012-06-01  840  			if (PPR_REQ_TYPE(raw[0]) != 0)
> eee53537c476c9 drivers/iommu/amd_iommu.c   Joerg Roedel 2012-06-01  841  				break;
> eee53537c476c9 drivers/iommu/amd_iommu.c   Joerg Roedel 2012-06-01  842  			udelay(1);
> eee53537c476c9 drivers/iommu/amd_iommu.c   Joerg Roedel 2012-06-01  843  		}
> eee53537c476c9 drivers/iommu/amd_iommu.c   Joerg Roedel 2012-06-01  844  
> eee53537c476c9 drivers/iommu/amd_iommu.c   Joerg Roedel 2012-06-01  845  		/* Avoid memcpy function-call overhead */
> eee53537c476c9 drivers/iommu/amd_iommu.c   Joerg Roedel 2012-06-01  846  		entry[0] = raw[0];
> eee53537c476c9 drivers/iommu/amd_iommu.c   Joerg Roedel 2012-06-01  847  		entry[1] = raw[1];
> eee53537c476c9 drivers/iommu/amd_iommu.c   Joerg Roedel 2012-06-01  848  
> eee53537c476c9 drivers/iommu/amd_iommu.c   Joerg Roedel 2012-06-01  849  		/*
> 05d227efbd8d3c drivers/iommu/amd/iommu.c   Tom Lendacky 2023-01-17  850  		 * To detect the hardware errata 733 we need to clear the
> 05d227efbd8d3c drivers/iommu/amd/iommu.c   Tom Lendacky 2023-01-17  851  		 * entry back to zero. This issue does not exist on SNP
> 05d227efbd8d3c drivers/iommu/amd/iommu.c   Tom Lendacky 2023-01-17  852  		 * enabled system. Also this buffer is not writeable on
> 05d227efbd8d3c drivers/iommu/amd/iommu.c   Tom Lendacky 2023-01-17  853  		 * SNP enabled system.
> eee53537c476c9 drivers/iommu/amd_iommu.c   Joerg Roedel 2012-06-01  854  		 */
> 05d227efbd8d3c drivers/iommu/amd/iommu.c   Tom Lendacky 2023-01-17  855  		if (!amd_iommu_snp_en)
> eee53537c476c9 drivers/iommu/amd_iommu.c   Joerg Roedel 2012-06-01  856  			raw[0] = raw[1] = 0UL;
> eee53537c476c9 drivers/iommu/amd_iommu.c   Joerg Roedel 2012-06-01  857  
> eee53537c476c9 drivers/iommu/amd_iommu.c   Joerg Roedel 2012-06-01  858  		/* Update head pointer of hardware ring-buffer */
> 72e1dcc4192288 drivers/iommu/amd_iommu.c   Joerg Roedel 2011-11-10  859  		head = (head + PPR_ENTRY_SIZE) % PPR_LOG_SIZE;
> 72e1dcc4192288 drivers/iommu/amd_iommu.c   Joerg Roedel 2011-11-10  860  		writel(head, iommu->mmio_base + MMIO_PPR_HEAD_OFFSET);
> eee53537c476c9 drivers/iommu/amd_iommu.c   Joerg Roedel 2012-06-01  861  
> d55b0d2e075ad3 drivers/iommu/amd/iommu.c   Vasant Hegde 2023-10-06  862  		/* TODO: PPR Handler will be added when we add IOPF support */
> eee53537c476c9 drivers/iommu/amd_iommu.c   Joerg Roedel 2012-06-01  863  
> eee53537c476c9 drivers/iommu/amd_iommu.c   Joerg Roedel 2012-06-01  864  		/* Refresh ring-buffer information */
> eee53537c476c9 drivers/iommu/amd_iommu.c   Joerg Roedel 2012-06-01  865  		head = readl(iommu->mmio_base + MMIO_PPR_HEAD_OFFSET);
> 72e1dcc4192288 drivers/iommu/amd_iommu.c   Joerg Roedel 2011-11-10  866  		tail = readl(iommu->mmio_base + MMIO_PPR_TAIL_OFFSET);
> 72e1dcc4192288 drivers/iommu/amd_iommu.c   Joerg Roedel 2011-11-10  867  	}
> 72e1dcc4192288 drivers/iommu/amd_iommu.c   Joerg Roedel 2011-11-10  868  }
> 72e1dcc4192288 drivers/iommu/amd_iommu.c   Joerg Roedel 2011-11-10  869  
> 
> :::::: The code at line 829 was first introduced by commit
> :::::: eee53537c476c947bf7faa1c916d2f5a0ae8ec93 iommu/amd: Fix deadlock in ppr-handling error path
> 
> :::::: TO: Joerg Roedel <joerg.roedel@amd.com>
> :::::: CC: Joerg Roedel <joerg.roedel@amd.com>
> 

  reply	other threads:[~2023-10-12  5:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-07  3:20 [joro-iommu:x86/amd 16/19] drivers/iommu/amd/iommu.c:829:21: warning: variable 'entry' set but not used kernel test robot
2023-10-12  5:26 ` Vasant Hegde [this message]
2023-10-12 13:21   ` Jason Gunthorpe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f8163afc-858e-7830-d6dc-79c6b60d7c2d@amd.com \
    --to=vasant.hegde@amd.com \
    --cc=iommu@lists.linux.dev \
    --cc=jgg@nvidia.com \
    --cc=jroedel@suse.de \
    --cc=jsnitsel@redhat.com \
    --cc=lkp@intel.com \
    --cc=oe-kbuild-all@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox