All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Wei Liu <wei.liu@kernel.org>,
	Linux on Hyper-V List <linux-hyperv@vger.kernel.org>
Cc: kbuild-all@lists.01.org,
	virtualization@lists.linux-foundation.org,
	Linux Kernel List <linux-kernel@vger.kernel.org>,
	Michael Kelley <mikelley@microsoft.com>,
	Vineeth Pillai <viremana@linux.microsoft.com>,
	Sunil Muthuswamy <sunilmut@microsoft.com>,
	Nuno Das Neves <nunodasneves@linux.microsoft.com>,
	Wei Liu <wei.liu@kernel.org>,
	"K. Y. Srinivasan" <kys@microsoft.com>,
	Haiyang Zhang <haiyangz@microsoft.com>
Subject: Re: [PATCH v3 15/17] x86/hyperv: implement an MSI domain for root partition
Date: Wed, 25 Nov 2020 04:10:47 +0800	[thread overview]
Message-ID: <202011250426.fl5pKYqO-lkp@intel.com> (raw)
In-Reply-To: <20201124170744.112180-16-wei.liu@kernel.org>

[-- Attachment #1: Type: text/plain, Size: 16230 bytes --]

Hi Wei,

I love your patch! Perhaps something to improve:

[auto build test WARNING on tip/x86/core]
[also build test WARNING on asm-generic/master iommu/next tip/timers/core pci/next linus/master v5.10-rc5]
[cannot apply to next-20201124]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Wei-Liu/Introducing-Linux-root-partition-support-for-Microsoft-Hypervisor/20201125-011026
base:   https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git 238c91115cd05c71447ea071624a4c9fe661f970
config: i386-randconfig-a015-20201124 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce (this is a W=1 build):
        # https://github.com/0day-ci/linux/commit/ae7533bcd9667c0f23b545d941d3c68460f91ea2
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Wei-Liu/Introducing-Linux-root-partition-support-for-Microsoft-Hypervisor/20201125-011026
        git checkout ae7533bcd9667c0f23b545d941d3c68460f91ea2
        # save the attached .config to linux build tree
        make W=1 ARCH=i386 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   arch/x86/hyperv/irqdomain.c: In function 'hv_irq_compose_msi_msg':
   arch/x86/hyperv/irqdomain.c:146:8: error: implicit declaration of function 'msi_desc_to_pci_dev'; did you mean 'msi_desc_to_dev'? [-Werror=implicit-function-declaration]
     146 |  dev = msi_desc_to_pci_dev(msidesc);
         |        ^~~~~~~~~~~~~~~~~~~
         |        msi_desc_to_dev
>> arch/x86/hyperv/irqdomain.c:146:6: warning: assignment to 'struct pci_dev *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     146 |  dev = msi_desc_to_pci_dev(msidesc);
         |      ^
   arch/x86/hyperv/irqdomain.c: In function 'hv_msi_domain_free_irqs':
   arch/x86/hyperv/irqdomain.c:277:2: error: implicit declaration of function 'for_each_pci_msi_entry'; did you mean 'for_each_msi_entry'? [-Werror=implicit-function-declaration]
     277 |  for_each_pci_msi_entry(entry, pdev) {
         |  ^~~~~~~~~~~~~~~~~~~~~~
         |  for_each_msi_entry
   arch/x86/hyperv/irqdomain.c:277:37: error: expected ';' before '{' token
     277 |  for_each_pci_msi_entry(entry, pdev) {
         |                                     ^~
         |                                     ;
   arch/x86/hyperv/irqdomain.c:268:6: warning: unused variable 'i' [-Wunused-variable]
     268 |  int i;
         |      ^
   arch/x86/hyperv/irqdomain.c: At top level:
   arch/x86/hyperv/irqdomain.c:298:22: error: 'msi_domain_set_affinity' undeclared here (not in a function); did you mean 'irq_can_set_affinity'?
     298 |  .irq_set_affinity = msi_domain_set_affinity,
         |                      ^~~~~~~~~~~~~~~~~~~~~~~
         |                      irq_can_set_affinity
   arch/x86/hyperv/irqdomain.c:302:15: error: variable 'pci_msi_domain_ops' has initializer but incomplete type
     302 | static struct msi_domain_ops pci_msi_domain_ops = {
         |               ^~~~~~~~~~~~~~
   arch/x86/hyperv/irqdomain.c:303:3: error: 'struct msi_domain_ops' has no member named 'domain_free_irqs'
     303 |  .domain_free_irqs = hv_msi_domain_free_irqs,
         |   ^~~~~~~~~~~~~~~~
>> arch/x86/hyperv/irqdomain.c:303:22: warning: excess elements in struct initializer
     303 |  .domain_free_irqs = hv_msi_domain_free_irqs,
         |                      ^~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/hyperv/irqdomain.c:303:22: note: (near initialization for 'pci_msi_domain_ops')
   arch/x86/hyperv/irqdomain.c:304:3: error: 'struct msi_domain_ops' has no member named 'msi_prepare'
     304 |  .msi_prepare  = pci_msi_prepare,
         |   ^~~~~~~~~~~
   arch/x86/hyperv/irqdomain.c:304:18: error: 'pci_msi_prepare' undeclared here (not in a function)
     304 |  .msi_prepare  = pci_msi_prepare,
         |                  ^~~~~~~~~~~~~~~
   arch/x86/hyperv/irqdomain.c:304:18: warning: excess elements in struct initializer
   arch/x86/hyperv/irqdomain.c:304:18: note: (near initialization for 'pci_msi_domain_ops')
   arch/x86/hyperv/irqdomain.c:307:15: error: variable 'hv_pci_msi_domain_info' has initializer but incomplete type
     307 | static struct msi_domain_info hv_pci_msi_domain_info = {
         |               ^~~~~~~~~~~~~~~
   arch/x86/hyperv/irqdomain.c:308:3: error: 'struct msi_domain_info' has no member named 'flags'
     308 |  .flags  = MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS |
         |   ^~~~~
   arch/x86/hyperv/irqdomain.c:308:12: error: 'MSI_FLAG_USE_DEF_DOM_OPS' undeclared here (not in a function)
     308 |  .flags  = MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS |
         |            ^~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/hyperv/irqdomain.c:308:39: error: 'MSI_FLAG_USE_DEF_CHIP_OPS' undeclared here (not in a function)
     308 |  .flags  = MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS |
         |                                       ^~~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/hyperv/irqdomain.c:309:6: error: 'MSI_FLAG_PCI_MSIX' undeclared here (not in a function)
     309 |      MSI_FLAG_PCI_MSIX,
         |      ^~~~~~~~~~~~~~~~~
   arch/x86/hyperv/irqdomain.c:308:12: warning: excess elements in struct initializer
     308 |  .flags  = MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS |
         |            ^~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/hyperv/irqdomain.c:308:12: note: (near initialization for 'hv_pci_msi_domain_info')
   arch/x86/hyperv/irqdomain.c:310:3: error: 'struct msi_domain_info' has no member named 'ops'
     310 |  .ops  = &pci_msi_domain_ops,
         |   ^~~
   arch/x86/hyperv/irqdomain.c:310:10: warning: excess elements in struct initializer
     310 |  .ops  = &pci_msi_domain_ops,
         |          ^
   arch/x86/hyperv/irqdomain.c:310:10: note: (near initialization for 'hv_pci_msi_domain_info')
   arch/x86/hyperv/irqdomain.c:311:3: error: 'struct msi_domain_info' has no member named 'chip'
     311 |  .chip  = &hv_pci_msi_controller,
         |   ^~~~
   arch/x86/hyperv/irqdomain.c:311:11: warning: excess elements in struct initializer
     311 |  .chip  = &hv_pci_msi_controller,
         |           ^
   arch/x86/hyperv/irqdomain.c:311:11: note: (near initialization for 'hv_pci_msi_domain_info')
   arch/x86/hyperv/irqdomain.c:312:3: error: 'struct msi_domain_info' has no member named 'handler'
     312 |  .handler = handle_edge_irq,
         |   ^~~~~~~
   arch/x86/hyperv/irqdomain.c:312:13: warning: excess elements in struct initializer
     312 |  .handler = handle_edge_irq,
         |             ^~~~~~~~~~~~~~~
   arch/x86/hyperv/irqdomain.c:312:13: note: (near initialization for 'hv_pci_msi_domain_info')
   arch/x86/hyperv/irqdomain.c:313:3: error: 'struct msi_domain_info' has no member named 'handler_name'
     313 |  .handler_name = "edge",
         |   ^~~~~~~~~~~~
   arch/x86/hyperv/irqdomain.c:313:18: warning: excess elements in struct initializer
     313 |  .handler_name = "edge",
         |                  ^~~~~~
   arch/x86/hyperv/irqdomain.c:313:18: note: (near initialization for 'hv_pci_msi_domain_info')
>> arch/x86/hyperv/irqdomain.c:316:28: warning: no previous prototype for 'hv_create_pci_msi_domain' [-Wmissing-prototypes]
     316 | struct irq_domain * __init hv_create_pci_msi_domain(void)
         |                            ^~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/hyperv/irqdomain.c: In function 'hv_create_pci_msi_domain':
   arch/x86/hyperv/irqdomain.c:321:7: error: implicit declaration of function 'irq_domain_alloc_named_fwnode' [-Werror=implicit-function-declaration]
     321 |  fn = irq_domain_alloc_named_fwnode("HV-PCI-MSI");
         |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> arch/x86/hyperv/irqdomain.c:321:5: warning: assignment to 'struct fwnode_handle *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     321 |  fn = irq_domain_alloc_named_fwnode("HV-PCI-MSI");
         |     ^
   arch/x86/hyperv/irqdomain.c:323:7: error: implicit declaration of function 'pci_msi_create_irq_domain'; did you mean 'pci_msi_get_device_domain'? [-Werror=implicit-function-declaration]
     323 |   d = pci_msi_create_irq_domain(fn, &hv_pci_msi_domain_info, x86_vector_domain);
         |       ^~~~~~~~~~~~~~~~~~~~~~~~~
         |       pci_msi_get_device_domain
   arch/x86/hyperv/irqdomain.c:323:62: error: 'x86_vector_domain' undeclared (first use in this function)
     323 |   d = pci_msi_create_irq_domain(fn, &hv_pci_msi_domain_info, x86_vector_domain);
         |                                                              ^~~~~~~~~~~~~~~~~
   arch/x86/hyperv/irqdomain.c:323:62: note: each undeclared identifier is reported only once for each function it appears in
   arch/x86/hyperv/irqdomain.c: At top level:
   arch/x86/hyperv/irqdomain.c:302:30: error: storage size of 'pci_msi_domain_ops' isn't known
     302 | static struct msi_domain_ops pci_msi_domain_ops = {
         |                              ^~~~~~~~~~~~~~~~~~
   arch/x86/hyperv/irqdomain.c:307:31: error: storage size of 'hv_pci_msi_domain_info' isn't known
     307 | static struct msi_domain_info hv_pci_msi_domain_info = {
         |                               ^~~~~~~~~~~~~~~~~~~~~~
   arch/x86/hyperv/irqdomain.c:227:13: warning: 'hv_teardown_msi_irq_common' defined but not used [-Wunused-function]
     227 | static void hv_teardown_msi_irq_common(struct pci_dev *dev, struct msi_desc *msidesc, int irq)
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors

vim +146 arch/x86/hyperv/irqdomain.c

   133	
   134	static int hv_unmap_msi_interrupt(struct pci_dev *dev, struct hv_interrupt_entry *old_entry);
   135	static void hv_irq_compose_msi_msg(struct irq_data *data, struct msi_msg *msg)
   136	{
   137		struct msi_desc *msidesc;
   138		struct pci_dev *dev;
   139		struct hv_interrupt_entry out_entry, *stored_entry;
   140		struct irq_cfg *cfg = irqd_cfg(data);
   141		struct cpumask *affinity;
   142		int cpu, vcpu;
   143		u16 status;
   144	
   145		msidesc = irq_data_get_msi_desc(data);
 > 146		dev = msi_desc_to_pci_dev(msidesc);
   147	
   148		if (!cfg) {
   149			pr_debug("%s: cfg is NULL", __func__);
   150			return;
   151		}
   152	
   153		affinity = irq_data_get_effective_affinity_mask(data);
   154		cpu = cpumask_first_and(affinity, cpu_online_mask);
   155		vcpu = hv_cpu_number_to_vp_number(cpu);
   156	
   157		if (data->chip_data) {
   158			/*
   159			 * This interrupt is already mapped. Let's unmap first.
   160			 *
   161			 * We don't use retarget interrupt hypercalls here because
   162			 * Microsoft Hypervisor doens't allow root to change the vector
   163			 * or specify VPs outside of the set that is initially used
   164			 * during mapping.
   165			 */
   166			stored_entry = data->chip_data;
   167			data->chip_data = NULL;
   168	
   169			status = hv_unmap_msi_interrupt(dev, stored_entry);
   170	
   171			kfree(stored_entry);
   172	
   173			if (status != HV_STATUS_SUCCESS) {
   174				pr_debug("%s: failed to unmap, status %d", __func__, status);
   175				return;
   176			}
   177		}
   178	
   179		stored_entry = kzalloc(sizeof(*stored_entry), GFP_ATOMIC);
   180		if (!stored_entry) {
   181			pr_debug("%s: failed to allocate chip data\n", __func__);
   182			return;
   183		}
   184	
   185		status = hv_map_msi_interrupt(dev, vcpu, cfg->vector, &out_entry);
   186		if (status != HV_STATUS_SUCCESS) {
   187			kfree(stored_entry);
   188			return;
   189		}
   190	
   191		*stored_entry = out_entry;
   192		data->chip_data = stored_entry;
   193		entry_to_msi_msg(&out_entry, msg);
   194	
   195		return;
   196	}
   197	
   198	static int hv_unmap_interrupt(u64 id, struct hv_interrupt_entry *old_entry)
   199	{
   200		unsigned long flags;
   201		struct hv_input_unmap_device_interrupt *input;
   202		struct hv_interrupt_entry *intr_entry;
   203		u16 status;
   204	
   205		local_irq_save(flags);
   206		input = *this_cpu_ptr(hyperv_pcpu_input_arg);
   207	
   208		memset(input, 0, sizeof(*input));
   209		intr_entry = &input->interrupt_entry;
   210		input->partition_id = hv_current_partition_id;
   211		input->device_id = id;
   212		*intr_entry = *old_entry;
   213	
   214		status = hv_do_rep_hypercall(HVCALL_UNMAP_DEVICE_INTERRUPT, 0, 0, input, NULL) &
   215				 HV_HYPERCALL_RESULT_MASK;
   216		local_irq_restore(flags);
   217	
   218		return status;
   219	}
   220	
   221	static int hv_unmap_msi_interrupt(struct pci_dev *dev, struct hv_interrupt_entry *old_entry)
   222	{
   223		return hv_unmap_interrupt(hv_build_pci_dev_id(dev).as_uint64, old_entry)
   224			& HV_HYPERCALL_RESULT_MASK;
   225	}
   226	
   227	static void hv_teardown_msi_irq_common(struct pci_dev *dev, struct msi_desc *msidesc, int irq)
   228	{
   229		u16 status;
   230		struct hv_interrupt_entry old_entry;
   231		struct irq_desc *desc;
   232		struct irq_data *data;
   233		struct msi_msg msg;
   234	
   235		desc = irq_to_desc(irq);
   236		if (!desc) {
   237			pr_debug("%s: no irq desc\n", __func__);
   238			return;
   239		}
   240	
   241		data = &desc->irq_data;
   242		if (!data) {
   243			pr_debug("%s: no irq data\n", __func__);
   244			return;
   245		}
   246	
   247		if (!data->chip_data) {
   248			pr_debug("%s: no chip data\n!", __func__);
   249			return;
   250		}
   251	
   252		old_entry = *(struct hv_interrupt_entry *)data->chip_data;
   253		entry_to_msi_msg(&old_entry, &msg);
   254	
   255		kfree(data->chip_data);
   256		data->chip_data = NULL;
   257	
   258		status = hv_unmap_msi_interrupt(dev, &old_entry);
   259	
   260		if (status != HV_STATUS_SUCCESS) {
   261			pr_err("%s: hypercall failed, status %d\n", __func__, status);
   262			return;
   263		}
   264	}
   265	
   266	static void hv_msi_domain_free_irqs(struct irq_domain *domain, struct device *dev)
   267	{
   268		int i;
   269		struct msi_desc *entry;
   270		struct pci_dev *pdev;
   271	
   272		if (WARN_ON_ONCE(!dev_is_pci(dev)))
   273			return;
   274	
   275		pdev = to_pci_dev(dev);
   276	
   277		for_each_pci_msi_entry(entry, pdev) {
   278			if (entry->irq) {
   279				for (i = 0; i < entry->nvec_used; i++) {
   280					hv_teardown_msi_irq_common(pdev, entry, entry->irq + i);
   281					irq_domain_free_irqs(entry->irq + i, 1);
   282				}
   283			}
   284		}
   285	}
   286	
   287	/*
   288	 * IRQ Chip for MSI PCI/PCI-X/PCI-Express Devices,
   289	 * which implement the MSI or MSI-X Capability Structure.
   290	 */
   291	static struct irq_chip hv_pci_msi_controller = {
   292		.name			= "HV-PCI-MSI",
   293		.irq_unmask		= pci_msi_unmask_irq,
   294		.irq_mask		= pci_msi_mask_irq,
   295		.irq_ack		= irq_chip_ack_parent,
   296		.irq_retrigger		= irq_chip_retrigger_hierarchy,
   297		.irq_compose_msi_msg	= hv_irq_compose_msi_msg,
   298		.irq_set_affinity	= msi_domain_set_affinity,
   299		.flags			= IRQCHIP_SKIP_SET_WAKE,
   300	};
   301	
   302	static struct msi_domain_ops pci_msi_domain_ops = {
 > 303		.domain_free_irqs	= hv_msi_domain_free_irqs,
   304		.msi_prepare		= pci_msi_prepare,
   305	};
   306	
   307	static struct msi_domain_info hv_pci_msi_domain_info = {
   308		.flags		= MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS |
   309				  MSI_FLAG_PCI_MSIX,
   310		.ops		= &pci_msi_domain_ops,
   311		.chip		= &hv_pci_msi_controller,
   312		.handler	= handle_edge_irq,
   313		.handler_name	= "edge",
   314	};
   315	
 > 316	struct irq_domain * __init hv_create_pci_msi_domain(void)
   317	{
   318		struct irq_domain *d = NULL;
   319		struct fwnode_handle *fn;
   320	
 > 321		fn = irq_domain_alloc_named_fwnode("HV-PCI-MSI");
   322		if (fn)
   323			d = pci_msi_create_irq_domain(fn, &hv_pci_msi_domain_info, x86_vector_domain);
   324	
   325		/* No point in going further if we can't get an irq domain */
   326		BUG_ON(!d);
   327	
   328		return d;
   329	}
   330	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 33882 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: kernel test robot <lkp@intel.com>
To: Wei Liu <wei.liu@kernel.org>,
	Linux on Hyper-V List <linux-hyperv@vger.kernel.org>
Cc: Wei Liu <wei.liu@kernel.org>,
	kbuild-all@lists.01.org, Haiyang Zhang <haiyangz@microsoft.com>,
	Linux Kernel List <linux-kernel@vger.kernel.org>,
	Michael Kelley <mikelley@microsoft.com>,
	Nuno Das Neves <nunodasneves@linux.microsoft.com>,
	Sunil Muthuswamy <sunilmut@microsoft.com>,
	virtualization@lists.linux-foundation.org,
	Vineeth Pillai <viremana@linux.microsoft.com>
Subject: Re: [PATCH v3 15/17] x86/hyperv: implement an MSI domain for root partition
Date: Wed, 25 Nov 2020 04:10:47 +0800	[thread overview]
Message-ID: <202011250426.fl5pKYqO-lkp@intel.com> (raw)
In-Reply-To: <20201124170744.112180-16-wei.liu@kernel.org>

[-- Attachment #1: Type: text/plain, Size: 16230 bytes --]

Hi Wei,

I love your patch! Perhaps something to improve:

[auto build test WARNING on tip/x86/core]
[also build test WARNING on asm-generic/master iommu/next tip/timers/core pci/next linus/master v5.10-rc5]
[cannot apply to next-20201124]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Wei-Liu/Introducing-Linux-root-partition-support-for-Microsoft-Hypervisor/20201125-011026
base:   https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git 238c91115cd05c71447ea071624a4c9fe661f970
config: i386-randconfig-a015-20201124 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce (this is a W=1 build):
        # https://github.com/0day-ci/linux/commit/ae7533bcd9667c0f23b545d941d3c68460f91ea2
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Wei-Liu/Introducing-Linux-root-partition-support-for-Microsoft-Hypervisor/20201125-011026
        git checkout ae7533bcd9667c0f23b545d941d3c68460f91ea2
        # save the attached .config to linux build tree
        make W=1 ARCH=i386 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   arch/x86/hyperv/irqdomain.c: In function 'hv_irq_compose_msi_msg':
   arch/x86/hyperv/irqdomain.c:146:8: error: implicit declaration of function 'msi_desc_to_pci_dev'; did you mean 'msi_desc_to_dev'? [-Werror=implicit-function-declaration]
     146 |  dev = msi_desc_to_pci_dev(msidesc);
         |        ^~~~~~~~~~~~~~~~~~~
         |        msi_desc_to_dev
>> arch/x86/hyperv/irqdomain.c:146:6: warning: assignment to 'struct pci_dev *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     146 |  dev = msi_desc_to_pci_dev(msidesc);
         |      ^
   arch/x86/hyperv/irqdomain.c: In function 'hv_msi_domain_free_irqs':
   arch/x86/hyperv/irqdomain.c:277:2: error: implicit declaration of function 'for_each_pci_msi_entry'; did you mean 'for_each_msi_entry'? [-Werror=implicit-function-declaration]
     277 |  for_each_pci_msi_entry(entry, pdev) {
         |  ^~~~~~~~~~~~~~~~~~~~~~
         |  for_each_msi_entry
   arch/x86/hyperv/irqdomain.c:277:37: error: expected ';' before '{' token
     277 |  for_each_pci_msi_entry(entry, pdev) {
         |                                     ^~
         |                                     ;
   arch/x86/hyperv/irqdomain.c:268:6: warning: unused variable 'i' [-Wunused-variable]
     268 |  int i;
         |      ^
   arch/x86/hyperv/irqdomain.c: At top level:
   arch/x86/hyperv/irqdomain.c:298:22: error: 'msi_domain_set_affinity' undeclared here (not in a function); did you mean 'irq_can_set_affinity'?
     298 |  .irq_set_affinity = msi_domain_set_affinity,
         |                      ^~~~~~~~~~~~~~~~~~~~~~~
         |                      irq_can_set_affinity
   arch/x86/hyperv/irqdomain.c:302:15: error: variable 'pci_msi_domain_ops' has initializer but incomplete type
     302 | static struct msi_domain_ops pci_msi_domain_ops = {
         |               ^~~~~~~~~~~~~~
   arch/x86/hyperv/irqdomain.c:303:3: error: 'struct msi_domain_ops' has no member named 'domain_free_irqs'
     303 |  .domain_free_irqs = hv_msi_domain_free_irqs,
         |   ^~~~~~~~~~~~~~~~
>> arch/x86/hyperv/irqdomain.c:303:22: warning: excess elements in struct initializer
     303 |  .domain_free_irqs = hv_msi_domain_free_irqs,
         |                      ^~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/hyperv/irqdomain.c:303:22: note: (near initialization for 'pci_msi_domain_ops')
   arch/x86/hyperv/irqdomain.c:304:3: error: 'struct msi_domain_ops' has no member named 'msi_prepare'
     304 |  .msi_prepare  = pci_msi_prepare,
         |   ^~~~~~~~~~~
   arch/x86/hyperv/irqdomain.c:304:18: error: 'pci_msi_prepare' undeclared here (not in a function)
     304 |  .msi_prepare  = pci_msi_prepare,
         |                  ^~~~~~~~~~~~~~~
   arch/x86/hyperv/irqdomain.c:304:18: warning: excess elements in struct initializer
   arch/x86/hyperv/irqdomain.c:304:18: note: (near initialization for 'pci_msi_domain_ops')
   arch/x86/hyperv/irqdomain.c:307:15: error: variable 'hv_pci_msi_domain_info' has initializer but incomplete type
     307 | static struct msi_domain_info hv_pci_msi_domain_info = {
         |               ^~~~~~~~~~~~~~~
   arch/x86/hyperv/irqdomain.c:308:3: error: 'struct msi_domain_info' has no member named 'flags'
     308 |  .flags  = MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS |
         |   ^~~~~
   arch/x86/hyperv/irqdomain.c:308:12: error: 'MSI_FLAG_USE_DEF_DOM_OPS' undeclared here (not in a function)
     308 |  .flags  = MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS |
         |            ^~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/hyperv/irqdomain.c:308:39: error: 'MSI_FLAG_USE_DEF_CHIP_OPS' undeclared here (not in a function)
     308 |  .flags  = MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS |
         |                                       ^~~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/hyperv/irqdomain.c:309:6: error: 'MSI_FLAG_PCI_MSIX' undeclared here (not in a function)
     309 |      MSI_FLAG_PCI_MSIX,
         |      ^~~~~~~~~~~~~~~~~
   arch/x86/hyperv/irqdomain.c:308:12: warning: excess elements in struct initializer
     308 |  .flags  = MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS |
         |            ^~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/hyperv/irqdomain.c:308:12: note: (near initialization for 'hv_pci_msi_domain_info')
   arch/x86/hyperv/irqdomain.c:310:3: error: 'struct msi_domain_info' has no member named 'ops'
     310 |  .ops  = &pci_msi_domain_ops,
         |   ^~~
   arch/x86/hyperv/irqdomain.c:310:10: warning: excess elements in struct initializer
     310 |  .ops  = &pci_msi_domain_ops,
         |          ^
   arch/x86/hyperv/irqdomain.c:310:10: note: (near initialization for 'hv_pci_msi_domain_info')
   arch/x86/hyperv/irqdomain.c:311:3: error: 'struct msi_domain_info' has no member named 'chip'
     311 |  .chip  = &hv_pci_msi_controller,
         |   ^~~~
   arch/x86/hyperv/irqdomain.c:311:11: warning: excess elements in struct initializer
     311 |  .chip  = &hv_pci_msi_controller,
         |           ^
   arch/x86/hyperv/irqdomain.c:311:11: note: (near initialization for 'hv_pci_msi_domain_info')
   arch/x86/hyperv/irqdomain.c:312:3: error: 'struct msi_domain_info' has no member named 'handler'
     312 |  .handler = handle_edge_irq,
         |   ^~~~~~~
   arch/x86/hyperv/irqdomain.c:312:13: warning: excess elements in struct initializer
     312 |  .handler = handle_edge_irq,
         |             ^~~~~~~~~~~~~~~
   arch/x86/hyperv/irqdomain.c:312:13: note: (near initialization for 'hv_pci_msi_domain_info')
   arch/x86/hyperv/irqdomain.c:313:3: error: 'struct msi_domain_info' has no member named 'handler_name'
     313 |  .handler_name = "edge",
         |   ^~~~~~~~~~~~
   arch/x86/hyperv/irqdomain.c:313:18: warning: excess elements in struct initializer
     313 |  .handler_name = "edge",
         |                  ^~~~~~
   arch/x86/hyperv/irqdomain.c:313:18: note: (near initialization for 'hv_pci_msi_domain_info')
>> arch/x86/hyperv/irqdomain.c:316:28: warning: no previous prototype for 'hv_create_pci_msi_domain' [-Wmissing-prototypes]
     316 | struct irq_domain * __init hv_create_pci_msi_domain(void)
         |                            ^~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/hyperv/irqdomain.c: In function 'hv_create_pci_msi_domain':
   arch/x86/hyperv/irqdomain.c:321:7: error: implicit declaration of function 'irq_domain_alloc_named_fwnode' [-Werror=implicit-function-declaration]
     321 |  fn = irq_domain_alloc_named_fwnode("HV-PCI-MSI");
         |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> arch/x86/hyperv/irqdomain.c:321:5: warning: assignment to 'struct fwnode_handle *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     321 |  fn = irq_domain_alloc_named_fwnode("HV-PCI-MSI");
         |     ^
   arch/x86/hyperv/irqdomain.c:323:7: error: implicit declaration of function 'pci_msi_create_irq_domain'; did you mean 'pci_msi_get_device_domain'? [-Werror=implicit-function-declaration]
     323 |   d = pci_msi_create_irq_domain(fn, &hv_pci_msi_domain_info, x86_vector_domain);
         |       ^~~~~~~~~~~~~~~~~~~~~~~~~
         |       pci_msi_get_device_domain
   arch/x86/hyperv/irqdomain.c:323:62: error: 'x86_vector_domain' undeclared (first use in this function)
     323 |   d = pci_msi_create_irq_domain(fn, &hv_pci_msi_domain_info, x86_vector_domain);
         |                                                              ^~~~~~~~~~~~~~~~~
   arch/x86/hyperv/irqdomain.c:323:62: note: each undeclared identifier is reported only once for each function it appears in
   arch/x86/hyperv/irqdomain.c: At top level:
   arch/x86/hyperv/irqdomain.c:302:30: error: storage size of 'pci_msi_domain_ops' isn't known
     302 | static struct msi_domain_ops pci_msi_domain_ops = {
         |                              ^~~~~~~~~~~~~~~~~~
   arch/x86/hyperv/irqdomain.c:307:31: error: storage size of 'hv_pci_msi_domain_info' isn't known
     307 | static struct msi_domain_info hv_pci_msi_domain_info = {
         |                               ^~~~~~~~~~~~~~~~~~~~~~
   arch/x86/hyperv/irqdomain.c:227:13: warning: 'hv_teardown_msi_irq_common' defined but not used [-Wunused-function]
     227 | static void hv_teardown_msi_irq_common(struct pci_dev *dev, struct msi_desc *msidesc, int irq)
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors

vim +146 arch/x86/hyperv/irqdomain.c

   133	
   134	static int hv_unmap_msi_interrupt(struct pci_dev *dev, struct hv_interrupt_entry *old_entry);
   135	static void hv_irq_compose_msi_msg(struct irq_data *data, struct msi_msg *msg)
   136	{
   137		struct msi_desc *msidesc;
   138		struct pci_dev *dev;
   139		struct hv_interrupt_entry out_entry, *stored_entry;
   140		struct irq_cfg *cfg = irqd_cfg(data);
   141		struct cpumask *affinity;
   142		int cpu, vcpu;
   143		u16 status;
   144	
   145		msidesc = irq_data_get_msi_desc(data);
 > 146		dev = msi_desc_to_pci_dev(msidesc);
   147	
   148		if (!cfg) {
   149			pr_debug("%s: cfg is NULL", __func__);
   150			return;
   151		}
   152	
   153		affinity = irq_data_get_effective_affinity_mask(data);
   154		cpu = cpumask_first_and(affinity, cpu_online_mask);
   155		vcpu = hv_cpu_number_to_vp_number(cpu);
   156	
   157		if (data->chip_data) {
   158			/*
   159			 * This interrupt is already mapped. Let's unmap first.
   160			 *
   161			 * We don't use retarget interrupt hypercalls here because
   162			 * Microsoft Hypervisor doens't allow root to change the vector
   163			 * or specify VPs outside of the set that is initially used
   164			 * during mapping.
   165			 */
   166			stored_entry = data->chip_data;
   167			data->chip_data = NULL;
   168	
   169			status = hv_unmap_msi_interrupt(dev, stored_entry);
   170	
   171			kfree(stored_entry);
   172	
   173			if (status != HV_STATUS_SUCCESS) {
   174				pr_debug("%s: failed to unmap, status %d", __func__, status);
   175				return;
   176			}
   177		}
   178	
   179		stored_entry = kzalloc(sizeof(*stored_entry), GFP_ATOMIC);
   180		if (!stored_entry) {
   181			pr_debug("%s: failed to allocate chip data\n", __func__);
   182			return;
   183		}
   184	
   185		status = hv_map_msi_interrupt(dev, vcpu, cfg->vector, &out_entry);
   186		if (status != HV_STATUS_SUCCESS) {
   187			kfree(stored_entry);
   188			return;
   189		}
   190	
   191		*stored_entry = out_entry;
   192		data->chip_data = stored_entry;
   193		entry_to_msi_msg(&out_entry, msg);
   194	
   195		return;
   196	}
   197	
   198	static int hv_unmap_interrupt(u64 id, struct hv_interrupt_entry *old_entry)
   199	{
   200		unsigned long flags;
   201		struct hv_input_unmap_device_interrupt *input;
   202		struct hv_interrupt_entry *intr_entry;
   203		u16 status;
   204	
   205		local_irq_save(flags);
   206		input = *this_cpu_ptr(hyperv_pcpu_input_arg);
   207	
   208		memset(input, 0, sizeof(*input));
   209		intr_entry = &input->interrupt_entry;
   210		input->partition_id = hv_current_partition_id;
   211		input->device_id = id;
   212		*intr_entry = *old_entry;
   213	
   214		status = hv_do_rep_hypercall(HVCALL_UNMAP_DEVICE_INTERRUPT, 0, 0, input, NULL) &
   215				 HV_HYPERCALL_RESULT_MASK;
   216		local_irq_restore(flags);
   217	
   218		return status;
   219	}
   220	
   221	static int hv_unmap_msi_interrupt(struct pci_dev *dev, struct hv_interrupt_entry *old_entry)
   222	{
   223		return hv_unmap_interrupt(hv_build_pci_dev_id(dev).as_uint64, old_entry)
   224			& HV_HYPERCALL_RESULT_MASK;
   225	}
   226	
   227	static void hv_teardown_msi_irq_common(struct pci_dev *dev, struct msi_desc *msidesc, int irq)
   228	{
   229		u16 status;
   230		struct hv_interrupt_entry old_entry;
   231		struct irq_desc *desc;
   232		struct irq_data *data;
   233		struct msi_msg msg;
   234	
   235		desc = irq_to_desc(irq);
   236		if (!desc) {
   237			pr_debug("%s: no irq desc\n", __func__);
   238			return;
   239		}
   240	
   241		data = &desc->irq_data;
   242		if (!data) {
   243			pr_debug("%s: no irq data\n", __func__);
   244			return;
   245		}
   246	
   247		if (!data->chip_data) {
   248			pr_debug("%s: no chip data\n!", __func__);
   249			return;
   250		}
   251	
   252		old_entry = *(struct hv_interrupt_entry *)data->chip_data;
   253		entry_to_msi_msg(&old_entry, &msg);
   254	
   255		kfree(data->chip_data);
   256		data->chip_data = NULL;
   257	
   258		status = hv_unmap_msi_interrupt(dev, &old_entry);
   259	
   260		if (status != HV_STATUS_SUCCESS) {
   261			pr_err("%s: hypercall failed, status %d\n", __func__, status);
   262			return;
   263		}
   264	}
   265	
   266	static void hv_msi_domain_free_irqs(struct irq_domain *domain, struct device *dev)
   267	{
   268		int i;
   269		struct msi_desc *entry;
   270		struct pci_dev *pdev;
   271	
   272		if (WARN_ON_ONCE(!dev_is_pci(dev)))
   273			return;
   274	
   275		pdev = to_pci_dev(dev);
   276	
   277		for_each_pci_msi_entry(entry, pdev) {
   278			if (entry->irq) {
   279				for (i = 0; i < entry->nvec_used; i++) {
   280					hv_teardown_msi_irq_common(pdev, entry, entry->irq + i);
   281					irq_domain_free_irqs(entry->irq + i, 1);
   282				}
   283			}
   284		}
   285	}
   286	
   287	/*
   288	 * IRQ Chip for MSI PCI/PCI-X/PCI-Express Devices,
   289	 * which implement the MSI or MSI-X Capability Structure.
   290	 */
   291	static struct irq_chip hv_pci_msi_controller = {
   292		.name			= "HV-PCI-MSI",
   293		.irq_unmask		= pci_msi_unmask_irq,
   294		.irq_mask		= pci_msi_mask_irq,
   295		.irq_ack		= irq_chip_ack_parent,
   296		.irq_retrigger		= irq_chip_retrigger_hierarchy,
   297		.irq_compose_msi_msg	= hv_irq_compose_msi_msg,
   298		.irq_set_affinity	= msi_domain_set_affinity,
   299		.flags			= IRQCHIP_SKIP_SET_WAKE,
   300	};
   301	
   302	static struct msi_domain_ops pci_msi_domain_ops = {
 > 303		.domain_free_irqs	= hv_msi_domain_free_irqs,
   304		.msi_prepare		= pci_msi_prepare,
   305	};
   306	
   307	static struct msi_domain_info hv_pci_msi_domain_info = {
   308		.flags		= MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS |
   309				  MSI_FLAG_PCI_MSIX,
   310		.ops		= &pci_msi_domain_ops,
   311		.chip		= &hv_pci_msi_controller,
   312		.handler	= handle_edge_irq,
   313		.handler_name	= "edge",
   314	};
   315	
 > 316	struct irq_domain * __init hv_create_pci_msi_domain(void)
   317	{
   318		struct irq_domain *d = NULL;
   319		struct fwnode_handle *fn;
   320	
 > 321		fn = irq_domain_alloc_named_fwnode("HV-PCI-MSI");
   322		if (fn)
   323			d = pci_msi_create_irq_domain(fn, &hv_pci_msi_domain_info, x86_vector_domain);
   324	
   325		/* No point in going further if we can't get an irq domain */
   326		BUG_ON(!d);
   327	
   328		return d;
   329	}
   330	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 33882 bytes --]

[-- Attachment #3: Type: text/plain, Size: 183 bytes --]

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

WARNING: multiple messages have this Message-ID (diff)
From: kernel test robot <lkp@intel.com>
To: kbuild-all@lists.01.org
Subject: Re: [PATCH v3 15/17] x86/hyperv: implement an MSI domain for root partition
Date: Wed, 25 Nov 2020 04:10:47 +0800	[thread overview]
Message-ID: <202011250426.fl5pKYqO-lkp@intel.com> (raw)
In-Reply-To: <20201124170744.112180-16-wei.liu@kernel.org>

[-- Attachment #1: Type: text/plain, Size: 16584 bytes --]

Hi Wei,

I love your patch! Perhaps something to improve:

[auto build test WARNING on tip/x86/core]
[also build test WARNING on asm-generic/master iommu/next tip/timers/core pci/next linus/master v5.10-rc5]
[cannot apply to next-20201124]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Wei-Liu/Introducing-Linux-root-partition-support-for-Microsoft-Hypervisor/20201125-011026
base:   https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git 238c91115cd05c71447ea071624a4c9fe661f970
config: i386-randconfig-a015-20201124 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce (this is a W=1 build):
        # https://github.com/0day-ci/linux/commit/ae7533bcd9667c0f23b545d941d3c68460f91ea2
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Wei-Liu/Introducing-Linux-root-partition-support-for-Microsoft-Hypervisor/20201125-011026
        git checkout ae7533bcd9667c0f23b545d941d3c68460f91ea2
        # save the attached .config to linux build tree
        make W=1 ARCH=i386 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   arch/x86/hyperv/irqdomain.c: In function 'hv_irq_compose_msi_msg':
   arch/x86/hyperv/irqdomain.c:146:8: error: implicit declaration of function 'msi_desc_to_pci_dev'; did you mean 'msi_desc_to_dev'? [-Werror=implicit-function-declaration]
     146 |  dev = msi_desc_to_pci_dev(msidesc);
         |        ^~~~~~~~~~~~~~~~~~~
         |        msi_desc_to_dev
>> arch/x86/hyperv/irqdomain.c:146:6: warning: assignment to 'struct pci_dev *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     146 |  dev = msi_desc_to_pci_dev(msidesc);
         |      ^
   arch/x86/hyperv/irqdomain.c: In function 'hv_msi_domain_free_irqs':
   arch/x86/hyperv/irqdomain.c:277:2: error: implicit declaration of function 'for_each_pci_msi_entry'; did you mean 'for_each_msi_entry'? [-Werror=implicit-function-declaration]
     277 |  for_each_pci_msi_entry(entry, pdev) {
         |  ^~~~~~~~~~~~~~~~~~~~~~
         |  for_each_msi_entry
   arch/x86/hyperv/irqdomain.c:277:37: error: expected ';' before '{' token
     277 |  for_each_pci_msi_entry(entry, pdev) {
         |                                     ^~
         |                                     ;
   arch/x86/hyperv/irqdomain.c:268:6: warning: unused variable 'i' [-Wunused-variable]
     268 |  int i;
         |      ^
   arch/x86/hyperv/irqdomain.c: At top level:
   arch/x86/hyperv/irqdomain.c:298:22: error: 'msi_domain_set_affinity' undeclared here (not in a function); did you mean 'irq_can_set_affinity'?
     298 |  .irq_set_affinity = msi_domain_set_affinity,
         |                      ^~~~~~~~~~~~~~~~~~~~~~~
         |                      irq_can_set_affinity
   arch/x86/hyperv/irqdomain.c:302:15: error: variable 'pci_msi_domain_ops' has initializer but incomplete type
     302 | static struct msi_domain_ops pci_msi_domain_ops = {
         |               ^~~~~~~~~~~~~~
   arch/x86/hyperv/irqdomain.c:303:3: error: 'struct msi_domain_ops' has no member named 'domain_free_irqs'
     303 |  .domain_free_irqs = hv_msi_domain_free_irqs,
         |   ^~~~~~~~~~~~~~~~
>> arch/x86/hyperv/irqdomain.c:303:22: warning: excess elements in struct initializer
     303 |  .domain_free_irqs = hv_msi_domain_free_irqs,
         |                      ^~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/hyperv/irqdomain.c:303:22: note: (near initialization for 'pci_msi_domain_ops')
   arch/x86/hyperv/irqdomain.c:304:3: error: 'struct msi_domain_ops' has no member named 'msi_prepare'
     304 |  .msi_prepare  = pci_msi_prepare,
         |   ^~~~~~~~~~~
   arch/x86/hyperv/irqdomain.c:304:18: error: 'pci_msi_prepare' undeclared here (not in a function)
     304 |  .msi_prepare  = pci_msi_prepare,
         |                  ^~~~~~~~~~~~~~~
   arch/x86/hyperv/irqdomain.c:304:18: warning: excess elements in struct initializer
   arch/x86/hyperv/irqdomain.c:304:18: note: (near initialization for 'pci_msi_domain_ops')
   arch/x86/hyperv/irqdomain.c:307:15: error: variable 'hv_pci_msi_domain_info' has initializer but incomplete type
     307 | static struct msi_domain_info hv_pci_msi_domain_info = {
         |               ^~~~~~~~~~~~~~~
   arch/x86/hyperv/irqdomain.c:308:3: error: 'struct msi_domain_info' has no member named 'flags'
     308 |  .flags  = MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS |
         |   ^~~~~
   arch/x86/hyperv/irqdomain.c:308:12: error: 'MSI_FLAG_USE_DEF_DOM_OPS' undeclared here (not in a function)
     308 |  .flags  = MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS |
         |            ^~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/hyperv/irqdomain.c:308:39: error: 'MSI_FLAG_USE_DEF_CHIP_OPS' undeclared here (not in a function)
     308 |  .flags  = MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS |
         |                                       ^~~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/hyperv/irqdomain.c:309:6: error: 'MSI_FLAG_PCI_MSIX' undeclared here (not in a function)
     309 |      MSI_FLAG_PCI_MSIX,
         |      ^~~~~~~~~~~~~~~~~
   arch/x86/hyperv/irqdomain.c:308:12: warning: excess elements in struct initializer
     308 |  .flags  = MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS |
         |            ^~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/hyperv/irqdomain.c:308:12: note: (near initialization for 'hv_pci_msi_domain_info')
   arch/x86/hyperv/irqdomain.c:310:3: error: 'struct msi_domain_info' has no member named 'ops'
     310 |  .ops  = &pci_msi_domain_ops,
         |   ^~~
   arch/x86/hyperv/irqdomain.c:310:10: warning: excess elements in struct initializer
     310 |  .ops  = &pci_msi_domain_ops,
         |          ^
   arch/x86/hyperv/irqdomain.c:310:10: note: (near initialization for 'hv_pci_msi_domain_info')
   arch/x86/hyperv/irqdomain.c:311:3: error: 'struct msi_domain_info' has no member named 'chip'
     311 |  .chip  = &hv_pci_msi_controller,
         |   ^~~~
   arch/x86/hyperv/irqdomain.c:311:11: warning: excess elements in struct initializer
     311 |  .chip  = &hv_pci_msi_controller,
         |           ^
   arch/x86/hyperv/irqdomain.c:311:11: note: (near initialization for 'hv_pci_msi_domain_info')
   arch/x86/hyperv/irqdomain.c:312:3: error: 'struct msi_domain_info' has no member named 'handler'
     312 |  .handler = handle_edge_irq,
         |   ^~~~~~~
   arch/x86/hyperv/irqdomain.c:312:13: warning: excess elements in struct initializer
     312 |  .handler = handle_edge_irq,
         |             ^~~~~~~~~~~~~~~
   arch/x86/hyperv/irqdomain.c:312:13: note: (near initialization for 'hv_pci_msi_domain_info')
   arch/x86/hyperv/irqdomain.c:313:3: error: 'struct msi_domain_info' has no member named 'handler_name'
     313 |  .handler_name = "edge",
         |   ^~~~~~~~~~~~
   arch/x86/hyperv/irqdomain.c:313:18: warning: excess elements in struct initializer
     313 |  .handler_name = "edge",
         |                  ^~~~~~
   arch/x86/hyperv/irqdomain.c:313:18: note: (near initialization for 'hv_pci_msi_domain_info')
>> arch/x86/hyperv/irqdomain.c:316:28: warning: no previous prototype for 'hv_create_pci_msi_domain' [-Wmissing-prototypes]
     316 | struct irq_domain * __init hv_create_pci_msi_domain(void)
         |                            ^~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/hyperv/irqdomain.c: In function 'hv_create_pci_msi_domain':
   arch/x86/hyperv/irqdomain.c:321:7: error: implicit declaration of function 'irq_domain_alloc_named_fwnode' [-Werror=implicit-function-declaration]
     321 |  fn = irq_domain_alloc_named_fwnode("HV-PCI-MSI");
         |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> arch/x86/hyperv/irqdomain.c:321:5: warning: assignment to 'struct fwnode_handle *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     321 |  fn = irq_domain_alloc_named_fwnode("HV-PCI-MSI");
         |     ^
   arch/x86/hyperv/irqdomain.c:323:7: error: implicit declaration of function 'pci_msi_create_irq_domain'; did you mean 'pci_msi_get_device_domain'? [-Werror=implicit-function-declaration]
     323 |   d = pci_msi_create_irq_domain(fn, &hv_pci_msi_domain_info, x86_vector_domain);
         |       ^~~~~~~~~~~~~~~~~~~~~~~~~
         |       pci_msi_get_device_domain
   arch/x86/hyperv/irqdomain.c:323:62: error: 'x86_vector_domain' undeclared (first use in this function)
     323 |   d = pci_msi_create_irq_domain(fn, &hv_pci_msi_domain_info, x86_vector_domain);
         |                                                              ^~~~~~~~~~~~~~~~~
   arch/x86/hyperv/irqdomain.c:323:62: note: each undeclared identifier is reported only once for each function it appears in
   arch/x86/hyperv/irqdomain.c: At top level:
   arch/x86/hyperv/irqdomain.c:302:30: error: storage size of 'pci_msi_domain_ops' isn't known
     302 | static struct msi_domain_ops pci_msi_domain_ops = {
         |                              ^~~~~~~~~~~~~~~~~~
   arch/x86/hyperv/irqdomain.c:307:31: error: storage size of 'hv_pci_msi_domain_info' isn't known
     307 | static struct msi_domain_info hv_pci_msi_domain_info = {
         |                               ^~~~~~~~~~~~~~~~~~~~~~
   arch/x86/hyperv/irqdomain.c:227:13: warning: 'hv_teardown_msi_irq_common' defined but not used [-Wunused-function]
     227 | static void hv_teardown_msi_irq_common(struct pci_dev *dev, struct msi_desc *msidesc, int irq)
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors

vim +146 arch/x86/hyperv/irqdomain.c

   133	
   134	static int hv_unmap_msi_interrupt(struct pci_dev *dev, struct hv_interrupt_entry *old_entry);
   135	static void hv_irq_compose_msi_msg(struct irq_data *data, struct msi_msg *msg)
   136	{
   137		struct msi_desc *msidesc;
   138		struct pci_dev *dev;
   139		struct hv_interrupt_entry out_entry, *stored_entry;
   140		struct irq_cfg *cfg = irqd_cfg(data);
   141		struct cpumask *affinity;
   142		int cpu, vcpu;
   143		u16 status;
   144	
   145		msidesc = irq_data_get_msi_desc(data);
 > 146		dev = msi_desc_to_pci_dev(msidesc);
   147	
   148		if (!cfg) {
   149			pr_debug("%s: cfg is NULL", __func__);
   150			return;
   151		}
   152	
   153		affinity = irq_data_get_effective_affinity_mask(data);
   154		cpu = cpumask_first_and(affinity, cpu_online_mask);
   155		vcpu = hv_cpu_number_to_vp_number(cpu);
   156	
   157		if (data->chip_data) {
   158			/*
   159			 * This interrupt is already mapped. Let's unmap first.
   160			 *
   161			 * We don't use retarget interrupt hypercalls here because
   162			 * Microsoft Hypervisor doens't allow root to change the vector
   163			 * or specify VPs outside of the set that is initially used
   164			 * during mapping.
   165			 */
   166			stored_entry = data->chip_data;
   167			data->chip_data = NULL;
   168	
   169			status = hv_unmap_msi_interrupt(dev, stored_entry);
   170	
   171			kfree(stored_entry);
   172	
   173			if (status != HV_STATUS_SUCCESS) {
   174				pr_debug("%s: failed to unmap, status %d", __func__, status);
   175				return;
   176			}
   177		}
   178	
   179		stored_entry = kzalloc(sizeof(*stored_entry), GFP_ATOMIC);
   180		if (!stored_entry) {
   181			pr_debug("%s: failed to allocate chip data\n", __func__);
   182			return;
   183		}
   184	
   185		status = hv_map_msi_interrupt(dev, vcpu, cfg->vector, &out_entry);
   186		if (status != HV_STATUS_SUCCESS) {
   187			kfree(stored_entry);
   188			return;
   189		}
   190	
   191		*stored_entry = out_entry;
   192		data->chip_data = stored_entry;
   193		entry_to_msi_msg(&out_entry, msg);
   194	
   195		return;
   196	}
   197	
   198	static int hv_unmap_interrupt(u64 id, struct hv_interrupt_entry *old_entry)
   199	{
   200		unsigned long flags;
   201		struct hv_input_unmap_device_interrupt *input;
   202		struct hv_interrupt_entry *intr_entry;
   203		u16 status;
   204	
   205		local_irq_save(flags);
   206		input = *this_cpu_ptr(hyperv_pcpu_input_arg);
   207	
   208		memset(input, 0, sizeof(*input));
   209		intr_entry = &input->interrupt_entry;
   210		input->partition_id = hv_current_partition_id;
   211		input->device_id = id;
   212		*intr_entry = *old_entry;
   213	
   214		status = hv_do_rep_hypercall(HVCALL_UNMAP_DEVICE_INTERRUPT, 0, 0, input, NULL) &
   215				 HV_HYPERCALL_RESULT_MASK;
   216		local_irq_restore(flags);
   217	
   218		return status;
   219	}
   220	
   221	static int hv_unmap_msi_interrupt(struct pci_dev *dev, struct hv_interrupt_entry *old_entry)
   222	{
   223		return hv_unmap_interrupt(hv_build_pci_dev_id(dev).as_uint64, old_entry)
   224			& HV_HYPERCALL_RESULT_MASK;
   225	}
   226	
   227	static void hv_teardown_msi_irq_common(struct pci_dev *dev, struct msi_desc *msidesc, int irq)
   228	{
   229		u16 status;
   230		struct hv_interrupt_entry old_entry;
   231		struct irq_desc *desc;
   232		struct irq_data *data;
   233		struct msi_msg msg;
   234	
   235		desc = irq_to_desc(irq);
   236		if (!desc) {
   237			pr_debug("%s: no irq desc\n", __func__);
   238			return;
   239		}
   240	
   241		data = &desc->irq_data;
   242		if (!data) {
   243			pr_debug("%s: no irq data\n", __func__);
   244			return;
   245		}
   246	
   247		if (!data->chip_data) {
   248			pr_debug("%s: no chip data\n!", __func__);
   249			return;
   250		}
   251	
   252		old_entry = *(struct hv_interrupt_entry *)data->chip_data;
   253		entry_to_msi_msg(&old_entry, &msg);
   254	
   255		kfree(data->chip_data);
   256		data->chip_data = NULL;
   257	
   258		status = hv_unmap_msi_interrupt(dev, &old_entry);
   259	
   260		if (status != HV_STATUS_SUCCESS) {
   261			pr_err("%s: hypercall failed, status %d\n", __func__, status);
   262			return;
   263		}
   264	}
   265	
   266	static void hv_msi_domain_free_irqs(struct irq_domain *domain, struct device *dev)
   267	{
   268		int i;
   269		struct msi_desc *entry;
   270		struct pci_dev *pdev;
   271	
   272		if (WARN_ON_ONCE(!dev_is_pci(dev)))
   273			return;
   274	
   275		pdev = to_pci_dev(dev);
   276	
   277		for_each_pci_msi_entry(entry, pdev) {
   278			if (entry->irq) {
   279				for (i = 0; i < entry->nvec_used; i++) {
   280					hv_teardown_msi_irq_common(pdev, entry, entry->irq + i);
   281					irq_domain_free_irqs(entry->irq + i, 1);
   282				}
   283			}
   284		}
   285	}
   286	
   287	/*
   288	 * IRQ Chip for MSI PCI/PCI-X/PCI-Express Devices,
   289	 * which implement the MSI or MSI-X Capability Structure.
   290	 */
   291	static struct irq_chip hv_pci_msi_controller = {
   292		.name			= "HV-PCI-MSI",
   293		.irq_unmask		= pci_msi_unmask_irq,
   294		.irq_mask		= pci_msi_mask_irq,
   295		.irq_ack		= irq_chip_ack_parent,
   296		.irq_retrigger		= irq_chip_retrigger_hierarchy,
   297		.irq_compose_msi_msg	= hv_irq_compose_msi_msg,
   298		.irq_set_affinity	= msi_domain_set_affinity,
   299		.flags			= IRQCHIP_SKIP_SET_WAKE,
   300	};
   301	
   302	static struct msi_domain_ops pci_msi_domain_ops = {
 > 303		.domain_free_irqs	= hv_msi_domain_free_irqs,
   304		.msi_prepare		= pci_msi_prepare,
   305	};
   306	
   307	static struct msi_domain_info hv_pci_msi_domain_info = {
   308		.flags		= MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS |
   309				  MSI_FLAG_PCI_MSIX,
   310		.ops		= &pci_msi_domain_ops,
   311		.chip		= &hv_pci_msi_controller,
   312		.handler	= handle_edge_irq,
   313		.handler_name	= "edge",
   314	};
   315	
 > 316	struct irq_domain * __init hv_create_pci_msi_domain(void)
   317	{
   318		struct irq_domain *d = NULL;
   319		struct fwnode_handle *fn;
   320	
 > 321		fn = irq_domain_alloc_named_fwnode("HV-PCI-MSI");
   322		if (fn)
   323			d = pci_msi_create_irq_domain(fn, &hv_pci_msi_domain_info, x86_vector_domain);
   324	
   325		/* No point in going further if we can't get an irq domain */
   326		BUG_ON(!d);
   327	
   328		return d;
   329	}
   330	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 33882 bytes --]

  reply	other threads:[~2020-11-24 20:11 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-24 17:07 [PATCH v3 00/17] Introducing Linux root partition support for Microsoft Hypervisor Wei Liu
2020-11-24 17:07 ` [PATCH v3 01/17] asm-generic/hyperv: change HV_CPU_POWER_MANAGEMENT to HV_CPU_MANAGEMENT Wei Liu
2021-01-06 15:45   ` Wei Liu
2020-11-24 17:07 ` [PATCH v3 02/17] x86/hyperv: detect if Linux is the root partition Wei Liu
2020-11-24 17:07 ` [PATCH v3 03/17] Drivers: hv: vmbus: skip VMBus initialization if Linux is root Wei Liu
2020-11-24 17:07 ` [PATCH v3 04/17] iommu/hyperv: don't setup IRQ remapping when running as root Wei Liu
2020-11-24 17:07   ` Wei Liu
2020-11-24 17:07 ` [PATCH v3 05/17] clocksource/hyperv: use MSR-based access if " Wei Liu
2020-11-24 17:07 ` [PATCH v3 06/17] x86/hyperv: allocate output arg pages if required Wei Liu
2020-11-24 17:07 ` [PATCH v3 07/17] x86/hyperv: extract partition ID from Microsoft Hypervisor if necessary Wei Liu
2020-11-24 17:07 ` [PATCH v3 08/17] x86/hyperv: handling hypercall page setup for root Wei Liu
2020-11-24 17:07 ` [PATCH v3 09/17] x86/hyperv: provide a bunch of helper functions Wei Liu
2020-11-24 17:07 ` [PATCH v3 10/17] x86/hyperv: implement and use hv_smp_prepare_cpus Wei Liu
2020-11-24 17:07 ` [PATCH v3 11/17] asm-generic/hyperv: update hv_msi_entry Wei Liu
2020-11-24 17:07 ` [PATCH v3 12/17] asm-generic/hyperv: update hv_interrupt_entry Wei Liu
2020-11-24 18:05   ` David Woodhouse
2020-11-24 18:05     ` David Woodhouse
2020-12-02 13:39     ` Wei Liu
2020-11-24 17:07 ` [PATCH v3 13/17] asm-generic/hyperv: introduce hv_device_id and auxiliary structures Wei Liu
2020-11-24 17:07 ` [PATCH v3 14/17] asm-generic/hyperv: import data structures for mapping device interrupts Wei Liu
2020-11-24 17:07 ` [PATCH v3 15/17] x86/hyperv: implement an MSI domain for root partition Wei Liu
2020-11-24 20:10   ` kernel test robot [this message]
2020-11-24 20:10     ` kernel test robot
2020-11-24 20:10     ` kernel test robot
2020-11-25  4:01   ` kernel test robot
2020-11-25  4:01     ` kernel test robot
2020-11-25  4:01     ` kernel test robot
2020-11-24 17:07 ` [PATCH v3 16/17] x86/ioapic: export a few functions and data structures via io_apic.h Wei Liu
2020-11-25 10:26   ` Andy Shevchenko
2020-11-25 10:26     ` Andy Shevchenko
2020-12-02 14:11     ` Wei Liu
2020-12-02 15:18       ` Andy Shevchenko
2020-12-02 15:18         ` Andy Shevchenko
2020-11-24 17:07 ` [PATCH v3 17/17] x86/hyperv: handle IO-APIC when running as root Wei Liu
2020-11-25  5:16   ` kernel test robot
2020-11-25  5:16     ` kernel test robot
2020-11-25  5:16     ` kernel test robot
2020-12-02 19:51 ` [PATCH v3 00/17] Introducing Linux root partition support for Microsoft Hypervisor Enrico Weigelt, metux IT consult
2020-12-02 23:22   ` Wei Liu
2020-12-15 15:25     ` Enrico Weigelt, metux IT consult
2020-12-15 16:42       ` Wei Liu
2021-02-02 10:40         ` David Woodhouse
2021-02-02 10:40           ` David Woodhouse
2021-02-02 12:16           ` Wei Liu

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=202011250426.fl5pKYqO-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=haiyangz@microsoft.com \
    --cc=kbuild-all@lists.01.org \
    --cc=kys@microsoft.com \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mikelley@microsoft.com \
    --cc=nunodasneves@linux.microsoft.com \
    --cc=sunilmut@microsoft.com \
    --cc=viremana@linux.microsoft.com \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=wei.liu@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.