Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp1411319imj; Fri, 8 Feb 2019 00:43:18 -0800 (PST) X-Google-Smtp-Source: AHgI3IaUxQIdP20ysL+D3XKIGkkLMxeWFdnsbaAMSHtobd56yBad3968JkOYVJ4MF4/L9A06ucRi X-Received: by 2002:a17:902:8e8b:: with SMTP id bg11mr21781219plb.332.1549615398333; Fri, 08 Feb 2019 00:43:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549615398; cv=none; d=google.com; s=arc-20160816; b=MDmjYWjvvqgUQsa5hCeaIT9PiswmKHrLBBOJAbde3LRgAAWJucYv+jmwcd9kq2icOG /JlZrbWXjCsEeJFfH/0XaKKy9lULvL2xm25Cy5qI2VV+5WCYvL6ztUc5hcpZZPG0L3y5 7lz8VA8HD2PWV6G9OlKOI5FbKhvdK8MKbkovHQqaHv28w/ALozb2l8hdCJcKXYMSp9BY BBkbm8HWIIJ6GCFj1itx5gSauaRUO7NAX3AS2FR9q3MkBv7pShmgUfnzqvwJxyphjH7J Df72gwFJIUYnakRdByEY1DcYx5Psqskb/QQ7TUKwe7q9t3SPtWCueB9TMlZ8m5SeNzxH 0WbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=hzLk3pA5m0FRC+O6xpqCUVXVlCSW5c5FvN0fHaj4BeA=; b=TJvbI+JZu4JE70P1NKcTmdb06RKDk0jtxgTk+dukSuRAaLDOaS6PXPTC+uDQUtbGbn 4GtQuy7B72Ft+oUp/k6EWfnWrVsTcpG2Q56e909zJ9/O28V3jqsRXWDPJ6rqq1nsa5cY 1OshYrvGUcPsq9MktX1HJmf2eypmKn7Hk+xlWai3I1lQN0OXe8ZX3sfeiuTLes5WODd+ fLiBepv6SDfgrNz/cjYSXIwKGWTIoyfxWvn/RhJq25VVbzgd8DiUa10jOl2RuEUDPPXk FI/mfqcTF7gzTiPysGpGHTd0OZ3bUSHGUImNUXTAioYMWZVlE7rDvkRPIU0uKQs1gZPz 5Kag== ARC-Authentication-Results: i=1; mx.google.com; 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 g26si1559183pfi.184.2019.02.08.00.43.01; Fri, 08 Feb 2019 00:43:18 -0800 (PST) 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; 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 S1727338AbfBHIlY (ORCPT + 99 others); Fri, 8 Feb 2019 03:41:24 -0500 Received: from lhrrgout.huawei.com ([185.176.76.210]:32889 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726115AbfBHIlY (ORCPT ); Fri, 8 Feb 2019 03:41:24 -0500 Received: from LHREML711-CAH.china.huawei.com (unknown [172.18.7.106]) by Forcepoint Email with ESMTP id 81009B602239E5229CBF; Fri, 8 Feb 2019 08:41:22 +0000 (GMT) Received: from [10.204.65.155] (10.204.65.155) by smtpsuk.huawei.com (10.201.108.34) with Microsoft SMTP Server (TLS) id 14.3.408.0; Fri, 8 Feb 2019 08:41:15 +0000 Subject: Re: [PATCH v10, RESEND 4/6] tpm: move tpm_chip definition to include/linux/tpm.h To: Nathan Chancellor CC: , , , , , , , , , , References: <20190206162452.7749-1-roberto.sassu@huawei.com> <20190206162452.7749-5-roberto.sassu@huawei.com> <20190208042411.GA4822@archlinux-ryzen> From: Roberto Sassu Message-ID: Date: Fri, 8 Feb 2019 09:41:14 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.3.0 MIME-Version: 1.0 In-Reply-To: <20190208042411.GA4822@archlinux-ryzen> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.204.65.155] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2/8/2019 5:24 AM, Nathan Chancellor wrote: >> diff --git a/include/linux/tpm.h b/include/linux/tpm.h >> index afd022fc9d3d..816e686a73ac 100644 >> --- a/include/linux/tpm.h >> +++ b/include/linux/tpm.h >> @@ -22,6 +22,10 @@ >> #ifndef __LINUX_TPM_H__ >> #define __LINUX_TPM_H__ >> >> +#include >> +#include Hi Nathan I think the error comes from the line above. security/integrity/ima/ima.h includes , which now includes , which includes , which includes (for the arm64 architecture only). Both ima.h and efi.h define 'NONE'. The solution would be to rename one of them. I'm not familiar with the EFI part. Renaming 'NONE' in IMA should be easy as it is not used anywhere. Thanks Roberto >> +#include >> +#include >> #include >> >> #define TPM_DIGEST_SIZE 20 /* Max TPM v1.2 PCR size */ >> @@ -75,6 +79,93 @@ struct tpm_class_ops { >> void (*clk_enable)(struct tpm_chip *chip, bool value); >> }; >> >> +#define TPM_NUM_EVENT_LOG_FILES 3 >> + >> +/* Indexes the duration array */ >> +enum tpm_duration { >> + TPM_SHORT = 0, >> + TPM_MEDIUM = 1, >> + TPM_LONG = 2, >> + TPM_LONG_LONG = 3, >> + TPM_UNDEFINED, >> + TPM_NUM_DURATIONS = TPM_UNDEFINED, >> +}; >> + >> +#define TPM_PPI_VERSION_LEN 3 >> + >> +struct tpm_space { >> + u32 context_tbl[3]; >> + u8 *context_buf; >> + u32 session_tbl[3]; >> + u8 *session_buf; >> +}; >> + >> +struct tpm_bios_log { >> + void *bios_event_log; >> + void *bios_event_log_end; >> +}; >> + >> +struct tpm_chip_seqops { >> + struct tpm_chip *chip; >> + const struct seq_operations *seqops; >> +}; >> + >> +struct tpm_chip { >> + struct device dev; >> + struct device devs; >> + struct cdev cdev; >> + struct cdev cdevs; >> + >> + /* A driver callback under ops cannot be run unless ops_sem is held >> + * (sometimes implicitly, eg for the sysfs code). ops becomes null >> + * when the driver is unregistered, see tpm_try_get_ops. >> + */ >> + struct rw_semaphore ops_sem; >> + const struct tpm_class_ops *ops; >> + >> + struct tpm_bios_log log; >> + struct tpm_chip_seqops bin_log_seqops; >> + struct tpm_chip_seqops ascii_log_seqops; >> + >> + unsigned int flags; >> + >> + int dev_num; /* /dev/tpm# */ >> + unsigned long is_open; /* only one allowed */ >> + >> + char hwrng_name[64]; >> + struct hwrng hwrng; >> + >> + struct mutex tpm_mutex; /* tpm is processing */ >> + >> + unsigned long timeout_a; /* jiffies */ >> + unsigned long timeout_b; /* jiffies */ >> + unsigned long timeout_c; /* jiffies */ >> + unsigned long timeout_d; /* jiffies */ >> + bool timeout_adjusted; >> + unsigned long duration[TPM_NUM_DURATIONS]; /* jiffies */ >> + bool duration_adjusted; >> + >> + struct dentry *bios_dir[TPM_NUM_EVENT_LOG_FILES]; >> + >> + const struct attribute_group *groups[3]; >> + unsigned int groups_cnt; >> + >> + u32 nr_allocated_banks; >> + struct tpm_bank_info *allocated_banks; >> +#ifdef CONFIG_ACPI >> + acpi_handle acpi_dev_handle; >> + char ppi_version[TPM_PPI_VERSION_LEN + 1]; >> +#endif /* CONFIG_ACPI */ >> + >> + struct tpm_space work_space; >> + u32 last_cc; >> + u32 nr_commands; >> + u32 *cc_attrs_tbl; >> + >> + /* active locality */ >> + int locality; >> +}; >> + >> #if defined(CONFIG_TCG_TPM) || defined(CONFIG_TCG_TPM_MODULE) >> >> extern int tpm_is_tpm2(struct tpm_chip *chip); >> -- >> 2.17.1 >> > > Hi Robert, > > This patch causes a build error with Clang (bisected on next-20190207): > > security/integrity/ima/ima.h:191:2: error: redefinition of enumerator 'NONE' > __ima_hooks(__ima_hook_enumify) > ^ > security/integrity/ima/ima.h:176:7: note: expanded from macro '__ima_hooks' > hook(NONE) \ > ^ > include/linux/efi.h:1709:2: note: previous definition is here > NONE, > ^ > 1 error generated. > > I am not sure how to reconcile this otherwise I would have sent a patch. > > Thanks, > Nathan > -- HUAWEI TECHNOLOGIES Duesseldorf GmbH, HRB 56063 Managing Director: Bo PENG, Jian LI, Yanli SHI