[PATCH v4 1/2] create SMAF module

kbuild test robot lkp at intel.com
Mon Oct 5 15:02:32 PDT 2015


Hi Benjamin,

[auto build test ERROR on v4.3-rc4 -- if it's inappropriate base, please ignore]

config: s390-allmodconfig (attached as .config)
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=s390 

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

   In file included from arch/s390/include/asm/elf.h:130:0,
                    from include/linux/elf.h:4,
                    from include/linux/module.h:15,
                    from drivers/smaf/smaf-core.c:16:
   drivers/smaf/smaf-core.c: In function 'smaf_unsecure_handle':
>> arch/s390/include/asm/mmu_context.h:33:41: error: expected identifier before 'do'
    #define destroy_context(mm)             do { } while (0)
                                            ^
>> drivers/smaf/smaf-core.c:136:23: note: in expansion of macro 'destroy_context'
     if (smaf_dev.secure->destroy_context(handle->secure_ctx))
                          ^

vim +/destroy_context +136 drivers/smaf/smaf-core.c

    10	#include <linux/dma-buf.h>
    11	#include <linux/dma-mapping.h>
    12	#include <linux/fs.h>
    13	#include <linux/ioctl.h>
    14	#include <linux/list_sort.h>
    15	#include <linux/miscdevice.h>
  > 16	#include <linux/module.h>
    17	#include <linux/slab.h>
    18	#include <linux/smaf.h>
    19	#include <linux/smaf-allocator.h>
    20	#include <linux/smaf-secure.h>
    21	#include <linux/uaccess.h>
    22	
    23	struct smaf_handle {
    24		struct dma_buf *dmabuf;
    25		struct smaf_allocator *allocator;
    26		struct dma_buf *db_alloc;
    27		size_t length;
    28		unsigned int flags;
    29		int fd;
    30		bool is_secure;
    31		void *secure_ctx;
    32	};
    33	
    34	/**
    35	 * struct smaf_device - smaf device node private data
    36	 * @misc_dev:	the misc device
    37	 * @head:	list of allocator
    38	 * @lock:	list and secure pointer mutex
    39	 * @secure:	pointer to secure functions helpers
    40	 */
    41	struct smaf_device {
    42		struct miscdevice misc_dev;
    43		struct list_head head;
    44		/* list and secure pointer lock*/
    45		struct mutex lock;
    46		struct smaf_secure *secure;
    47	};
    48	
    49	static struct smaf_device smaf_dev;
    50	
    51	/**
    52	 * smaf_allow_cpu_access return true if CPU can access to memory
    53	 * if their is no secure module associated to SMAF assume that CPU can get
    54	 * access to the memory.
    55	 */
    56	static bool smaf_allow_cpu_access(struct smaf_handle *handle,
    57					  unsigned long flags)
    58	{
    59		if (!handle->is_secure)
    60			return true;
    61	
    62		if (!smaf_dev.secure)
    63			return true;
    64	
    65		if (!smaf_dev.secure->allow_cpu_access)
    66			return true;
    67	
    68		return smaf_dev.secure->allow_cpu_access(handle->secure_ctx, flags);
    69	}
    70	
    71	static int smaf_grant_access(struct smaf_handle *handle, struct device *dev,
    72				     dma_addr_t addr, size_t size,
    73				     enum dma_data_direction dir)
    74	{
    75		if (!handle->is_secure)
    76			return 0;
    77	
    78		if (!smaf_dev.secure)
    79			return -EINVAL;
    80	
    81		if (!smaf_dev.secure->grant_access)
    82			return -EINVAL;
    83	
    84		return smaf_dev.secure->grant_access(handle->secure_ctx,
    85						     dev, addr, size, dir);
    86	}
    87	
    88	static void smaf_revoke_access(struct smaf_handle *handle, struct device *dev,
    89				       dma_addr_t addr, size_t size,
    90				       enum dma_data_direction dir)
    91	{
    92		if (!handle->is_secure)
    93			return;
    94	
    95		if (!smaf_dev.secure)
    96			return;
    97	
    98		if (!smaf_dev.secure->revoke_access)
    99			return;
   100	
   101		smaf_dev.secure->revoke_access(handle->secure_ctx,
   102					       dev, addr, size, dir);
   103	}
   104	
   105	static int smaf_secure_handle(struct smaf_handle *handle)
   106	{
   107		if (handle->is_secure)
   108			return 0;
   109	
   110		if (!smaf_dev.secure)
   111			return -EINVAL;
   112	
   113		if (!smaf_dev.secure->create_context)
   114			return -EINVAL;
   115	
   116		handle->secure_ctx = smaf_dev.secure->create_context();
   117	
   118		if (!handle->secure_ctx)
   119			return -EINVAL;
   120	
   121		handle->is_secure = true;
   122		return 0;
   123	}
   124	
   125	static int smaf_unsecure_handle(struct smaf_handle *handle)
   126	{
   127		if (!handle->is_secure)
   128			return 0;
   129	
   130		if (!smaf_dev.secure)
   131			return -EINVAL;
   132	
   133		if (!smaf_dev.secure->destroy_context)
   134			return -EINVAL;
   135	
 > 136		if (smaf_dev.secure->destroy_context(handle->secure_ctx))
   137			return -EINVAL;
   138	
   139		handle->secure_ctx = NULL;

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/octet-stream
Size: 38491 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/dri-devel/attachments/20151006/ccebfb1e/attachment-0001.obj>


More information about the dri-devel mailing list