lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Mon, 4 Feb 2019 17:31:53 +0800
From:   kbuild test robot <lkp@...el.com>
To:     lantianyu1986@...il.com
Cc:     kbuild-all@...org, Lan Tianyu <Tianyu.Lan@...rosoft.com>,
        joro@...tes.org, mchehab+samsung@...nel.org, davem@...emloft.net,
        gregkh@...uxfoundation.org, akpm@...ux-foundation.org,
        nicolas.ferre@...rochip.com, arnd@...db.de,
        linux-kernel@...r.kernel.org, iommu@...ts.linux-foundation.org,
        michael.h.kelley@...rosoft.com, kys@...rosoft.com,
        vkuznets@...hat.com, alex.williamson@...hat.com, sashal@...nel.org,
        dan.carpenter@...cle.com
Subject: Re: [PATCH V2 2/3] HYPERV/IOMMU: Add Hyper-V stub IOMMU driver

Hi Lan,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on iommu/next]
[also build test ERROR on v5.0-rc4]
[cannot apply to next-20190204]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/lantianyu1986-gmail-com/x86-Hyper-V-IOMMU-Add-Hyper-V-IOMMU-driver-to-support-x2apic-mode/20190204-132009
base:   https://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu.git next
config: i386-allmodconfig (attached as .config)
compiler: gcc-8 (Debian 8.2.0-14) 8.2.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All error/warnings (new ones prefixed by >>):

   drivers/iommu/hyperv-iommu.c: In function 'hyperv_prepare_irq_remapping':
>> drivers/iommu/hyperv-iommu.c:149:31: error: implicit declaration of function 'arch_get_ir_parent_domain'; did you mean 'arch_init_msi_domain'? [-Werror=implicit-function-declaration]
      irq_domain_create_hierarchy(arch_get_ir_parent_domain(),
                                  ^~~~~~~~~~~~~~~~~~~~~~~~~
                                  arch_init_msi_domain
>> drivers/iommu/hyperv-iommu.c:149:31: warning: passing argument 1 of 'irq_domain_create_hierarchy' makes pointer from integer without a cast [-Wint-conversion]
      irq_domain_create_hierarchy(arch_get_ir_parent_domain(),
                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   In file included from arch/x86/include/asm/irqdomain.h:5,
                    from arch/x86/include/asm/irq_remapping.h:25,
                    from drivers/iommu/hyperv-iommu.c:19:
   include/linux/irqdomain.h:434:27: note: expected 'struct irq_domain *' but argument is of type 'int'
    extern struct irq_domain *irq_domain_create_hierarchy(struct irq_domain *parent,
                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/iommu/hyperv-iommu.c: At top level:
>> drivers/iommu/hyperv-iommu.c:189:8: error: variable 'hyperv_irq_remap_ops' has initializer but incomplete type
    struct irq_remap_ops hyperv_irq_remap_ops = {
           ^~~~~~~~~~~~~
>> drivers/iommu/hyperv-iommu.c:190:3: error: 'struct irq_remap_ops' has no member named 'prepare'
     .prepare  = hyperv_prepare_irq_remapping,
      ^~~~~~~
>> drivers/iommu/hyperv-iommu.c:190:14: warning: excess elements in struct initializer
     .prepare  = hyperv_prepare_irq_remapping,
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/iommu/hyperv-iommu.c:190:14: note: (near initialization for 'hyperv_irq_remap_ops')
>> drivers/iommu/hyperv-iommu.c:191:3: error: 'struct irq_remap_ops' has no member named 'enable'
     .enable   = hyperv_enable_irq_remapping,
      ^~~~~~
   drivers/iommu/hyperv-iommu.c:191:14: warning: excess elements in struct initializer
     .enable   = hyperv_enable_irq_remapping,
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/iommu/hyperv-iommu.c:191:14: note: (near initialization for 'hyperv_irq_remap_ops')
>> drivers/iommu/hyperv-iommu.c:192:3: error: 'struct irq_remap_ops' has no member named 'get_ir_irq_domain'
     .get_ir_irq_domain = hyperv_get_ir_irq_domain,
      ^~~~~~~~~~~~~~~~~
   drivers/iommu/hyperv-iommu.c:192:23: warning: excess elements in struct initializer
     .get_ir_irq_domain = hyperv_get_ir_irq_domain,
                          ^~~~~~~~~~~~~~~~~~~~~~~~
   drivers/iommu/hyperv-iommu.c:192:23: note: (near initialization for 'hyperv_irq_remap_ops')
>> drivers/iommu/hyperv-iommu.c:189:22: error: storage size of 'hyperv_irq_remap_ops' isn't known
    struct irq_remap_ops hyperv_irq_remap_ops = {
                         ^~~~~~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors

vim +149 drivers/iommu/hyperv-iommu.c

    16	
    17	#include <asm/hw_irq.h>
    18	#include <asm/io_apic.h>
  > 19	#include <asm/irq_remapping.h>
    20	#include <asm/hypervisor.h>
    21	
    22	#include "irq_remapping.h"
    23	
    24	/*
    25	 * According 82093AA IO-APIC spec , IO APIC has a 24-entry Interrupt
    26	 * Redirection Table.
    27	 */
    28	#define IOAPIC_REMAPPING_ENTRY 24
    29	
    30	static cpumask_t ioapic_max_cpumask = { CPU_BITS_NONE };
    31	static struct irq_domain *ioapic_ir_domain;
    32	
    33	static int hyperv_ir_set_affinity(struct irq_data *data,
    34			const struct cpumask *mask, bool force)
    35	{
    36		struct irq_data *parent = data->parent_data;
    37		struct irq_cfg *cfg = irqd_cfg(data);
    38		struct IO_APIC_route_entry *entry;
    39		cpumask_t cpumask;
    40		int ret;
    41	
    42		cpumask_andnot(&cpumask, mask, &ioapic_max_cpumask);
    43	
    44		/* Return error If new irq affinity is out of ioapic_max_cpumask. */
    45		if (!cpumask_empty(&cpumask))
    46			return -EINVAL;
    47	
    48		ret = parent->chip->irq_set_affinity(parent, mask, force);
    49		if (ret < 0 || ret == IRQ_SET_MASK_OK_DONE)
    50			return ret;
    51	
    52		entry = data->chip_data;
    53		entry->dest = cfg->dest_apicid;
    54		entry->vector = cfg->vector;
    55		send_cleanup_vector(cfg);
    56	
    57		return 0;
    58	}
    59	
    60	static struct irq_chip hyperv_ir_chip = {
    61		.name			= "HYPERV-IR",
    62		.irq_ack		= apic_ack_irq,
    63		.irq_set_affinity	= hyperv_ir_set_affinity,
    64	};
    65	
    66	static int hyperv_irq_remapping_alloc(struct irq_domain *domain,
    67					     unsigned int virq, unsigned int nr_irqs,
    68					     void *arg)
    69	{
    70		struct irq_alloc_info *info = arg;
    71		struct irq_data *irq_data;
    72		struct irq_desc *desc;
    73		int ret = 0;
    74	
    75		if (!info || info->type != X86_IRQ_ALLOC_TYPE_IOAPIC || nr_irqs > 1)
    76			return -EINVAL;
    77	
    78		ret = irq_domain_alloc_irqs_parent(domain, virq, nr_irqs, arg);
    79		if (ret < 0)
    80			return ret;
    81	
    82		irq_data = irq_domain_get_irq_data(domain, virq);
    83		if (!irq_data) {
    84			irq_domain_free_irqs_common(domain, virq, nr_irqs);
    85			return -EINVAL;
    86		}
    87	
    88		irq_data->chip = &hyperv_ir_chip;
    89	
    90		/*
    91		 * IOAPIC entry pointer is saved in chip_data to allow
    92		 * hyperv_irq_remappng_activate()/hyperv_ir_set_affinity() to set
    93		 * vector and dest_apicid. cfg->vector and cfg->dest_apicid are
    94		 * ignorred when IRQ remapping is enabled. See ioapic_configure_entry().
    95		 */
    96		irq_data->chip_data = info->ioapic_entry;
    97	
    98		/*
    99		 * Hypver-V IO APIC irq affinity should be in the scope of
   100		 * ioapic_max_cpumask because no irq remapping support.
   101		 */
   102		desc = irq_data_to_desc(irq_data);
   103		cpumask_and(desc->irq_common_data.affinity,
   104				desc->irq_common_data.affinity,
   105				&ioapic_max_cpumask);
   106	
   107		return 0;
   108	}
   109	
   110	static void hyperv_irq_remapping_free(struct irq_domain *domain,
   111					 unsigned int virq, unsigned int nr_irqs)
   112	{
   113		irq_domain_free_irqs_common(domain, virq, nr_irqs);
   114	}
   115	
   116	static int hyperv_irq_remappng_activate(struct irq_domain *domain,
   117				  struct irq_data *irq_data, bool reserve)
   118	{
   119		struct irq_cfg *cfg = irqd_cfg(irq_data);
   120		struct IO_APIC_route_entry *entry = irq_data->chip_data;
   121	
   122		entry->dest = cfg->dest_apicid;
   123		entry->vector = cfg->vector;
   124	
   125		return 0;
   126	}
   127	
   128	static struct irq_domain_ops hyperv_ir_domain_ops = {
   129		.alloc = hyperv_irq_remapping_alloc,
   130		.free = hyperv_irq_remapping_free,
   131		.activate = hyperv_irq_remappng_activate,
   132	};
   133	
   134	static int __init hyperv_prepare_irq_remapping(void)
   135	{
   136		struct fwnode_handle *fn;
   137		u32 apic_id;
   138		int i;
   139	
   140		if (x86_hyper_type != X86_HYPER_MS_HYPERV ||
   141		    !x2apic_supported())
   142			return -ENODEV;
   143	
   144		fn = irq_domain_alloc_named_id_fwnode("HYPERV-IR", 0);
   145		if (!fn)
   146			return -ENOMEM;
   147	
   148		ioapic_ir_domain =
 > 149			irq_domain_create_hierarchy(arch_get_ir_parent_domain(),
   150					0, IOAPIC_REMAPPING_ENTRY, fn,
   151					&hyperv_ir_domain_ops, NULL);
   152	
   153		irq_domain_free_fwnode(fn);
   154	
   155		/*
   156		 * Hyper-V doesn't provide irq remapping function for
   157		 * IO-APIC and so IO-APIC only accepts 8-bit APIC ID.
   158		 * Cpu's APIC ID is read from ACPI MADT table and APIC IDs
   159		 * in the MADT table on Hyper-v are sorted monotonic increasingly.
   160		 * APIC ID reflects cpu topology. There maybe some APIC ID
   161		 * gaps when cpu number in a socket is not power of two. Prepare
   162		 * max cpu affinity for IOAPIC irqs. Scan cpu 0-255 and set cpu
   163		 * into ioapic_max_cpumask if its APIC ID is less than 256.
   164		 */
   165		for (i = 0; i < 256; i++) {
   166			apic_id = cpu_physical_id(i);
   167			if (apic_id > 255)
   168				continue;
   169	
   170			cpumask_set_cpu(i, &ioapic_max_cpumask);
   171		}
   172	
   173		return 0;
   174	}
   175	
   176	static int __init hyperv_enable_irq_remapping(void)
   177	{
   178		return IRQ_REMAP_X2APIC_MODE;
   179	}
   180	
   181	static struct irq_domain *hyperv_get_ir_irq_domain(struct irq_alloc_info *info)
   182	{
   183		if (info->type == X86_IRQ_ALLOC_TYPE_IOAPIC)
   184			return ioapic_ir_domain;
   185		else
   186			return NULL;
   187	}
   188	
 > 189	struct irq_remap_ops hyperv_irq_remap_ops = {
 > 190		.prepare		= hyperv_prepare_irq_remapping,
 > 191		.enable			= hyperv_enable_irq_remapping,
 > 192		.get_ir_irq_domain	= hyperv_get_ir_irq_domain,

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

Download attachment ".config.gz" of type "application/gzip" (66583 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ