From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 17949C742A7 for ; Sat, 13 Jul 2019 04:54:56 +0000 (UTC) Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E70EA208E4 for ; Sat, 13 Jul 2019 04:54:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E70EA208E4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.ibm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=iommu-bounces@lists.linux-foundation.org Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 9074C699E; Sat, 13 Jul 2019 04:54:55 +0000 (UTC) Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id B237B5C28 for ; Sat, 13 Jul 2019 04:46:16 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 12011CF for ; Sat, 13 Jul 2019 04:46:15 +0000 (UTC) Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x6D4fZIg086192 for ; Sat, 13 Jul 2019 00:46:15 -0400 Received: from e35.co.us.ibm.com (e35.co.us.ibm.com [32.97.110.153]) by mx0a-001b2d01.pphosted.com with ESMTP id 2tq7v61129-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sat, 13 Jul 2019 00:46:15 -0400 Received: from localhost by e35.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sat, 13 Jul 2019 05:46:14 +0100 Received: from b03cxnp08025.gho.boulder.ibm.com (9.17.130.17) by e35.co.us.ibm.com (192.168.1.135) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Sat, 13 Jul 2019 05:46:09 +0100 Received: from b03ledav005.gho.boulder.ibm.com (b03ledav005.gho.boulder.ibm.com [9.17.130.236]) by b03cxnp08025.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x6D4k80Q56164730 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 13 Jul 2019 04:46:08 GMT Received: from b03ledav005.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id F21D0BE051; Sat, 13 Jul 2019 04:46:07 +0000 (GMT) Received: from b03ledav005.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5B303BE04F; Sat, 13 Jul 2019 04:46:03 +0000 (GMT) Received: from morokweng.localdomain.com (unknown [9.85.135.203]) by b03ledav005.gho.boulder.ibm.com (Postfix) with ESMTP; Sat, 13 Jul 2019 04:46:03 +0000 (GMT) From: Thiago Jung Bauermann To: x86@kernel.org Subject: [PATCH 0/3] Remove x86-specific code from generic headers Date: Sat, 13 Jul 2019 01:45:51 -0300 X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 19071304-0012-0000-0000-0000174F2918 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00011418; HX=3.00000242; KW=3.00000007; PH=3.00000004; SC=3.00000286; SDB=6.01231409; UDB=6.00648690; IPR=6.01012701; MB=3.00027699; MTD=3.00000008; XFM=3.00000015; UTC=2019-07-13 04:46:14 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19071304-0013-0000-0000-0000580BA0F3 Message-Id: <20190713044554.28719-1-bauerman@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-07-13_01:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1907130055 Cc: linux-s390@vger.kernel.org, Konrad Rzeszutek Wilk , Robin Murphy , Mike Anderson , Ram Pai , linux-kernel@vger.kernel.org, Alexey Dobriyan , Halil Pasic , iommu@lists.linux-foundation.org, Ingo Molnar , Borislav Petkov , Thomas Lendacky , "H. Peter Anvin" , linux-fsdevel@vger.kernel.org, Thomas Gleixner , linuxppc-dev@lists.ozlabs.org, Christoph Hellwig X-BeenThere: iommu@lists.linux-foundation.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Development issues for Linux IOMMU support List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Sender: iommu-bounces@lists.linux-foundation.org Errors-To: iommu-bounces@lists.linux-foundation.org SGVsbG8sCgpUaGlzIHZlcnNpb24gbW9zdGx5IGNoYW5nZXMgcGF0Y2ggMi8zLCByZW1vdmluZyBk bWFfY2hlY2tfbWFzaygpIGZyb20Ka2V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A4IC0tLS0tLS0tCiBrZXJuZWwvZG1hL3N3 aW90bGIuYyAgICAgICAgICAgICAgICB8ICAzICstLQogMTEgZmlsZXMgY2hhbmdlZCwgNDAgaW5z ZXJ0aW9ucygrKSwgMzcgZGVsZXRpb25zKC0pCgpfX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fXwppb21tdSBtYWlsaW5nIGxpc3QKaW9tbXVAbGlzdHMubGludXgt Zm91bmRhdGlvbi5vcmcKaHR0cHM6Ly9saXN0cy5saW51eGZvdW5kYXRpb24ub3JnL21haWxtYW4v bGlzdGluZm8vaW9tbXU= From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:20540 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725916AbfGMEqQ (ORCPT ); Sat, 13 Jul 2019 00:46:16 -0400 Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x6D4fYCn114483 for ; Sat, 13 Jul 2019 00:46:15 -0400 Received: from e35.co.us.ibm.com (e35.co.us.ibm.com [32.97.110.153]) by mx0a-001b2d01.pphosted.com with ESMTP id 2tq0tvmnhp-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sat, 13 Jul 2019 00:46:15 -0400 Received: from localhost by e35.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sat, 13 Jul 2019 05:46:14 +0100 From: Thiago Jung Bauermann Subject: [PATCH 0/3] Remove x86-specific code from generic headers Date: Sat, 13 Jul 2019 01:45:51 -0300 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Message-Id: <20190713044554.28719-1-bauerman@linux.ibm.com> Sender: linux-s390-owner@vger.kernel.org List-ID: To: x86@kernel.org Cc: iommu@lists.linux-foundation.org, linux-fsdevel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Christoph Hellwig , Marek Szyprowski , Robin Murphy , Konrad Rzeszutek Wilk , Alexey Dobriyan , Thomas Lendacky , Halil Pasic , Mike Anderson , Ram Pai , Thiago Jung Bauermann Hello, This version mostly changes patch 2/3, removing dma_check_mask() from kernel/dma/mapping.c as suggested by Christoph Hellwig, and also adapting s390's . There's also a small change in patch 1/3 as mentioned in the changelog below. Patch 3/3 may or may not need to change s390 code depending on how Tom Lendacky's patch is fixed to avoid breaking that architecture, so I haven't made any changes for now. These patches are applied on top of today's master which at the time was at commit 9787aed57dd3 ("coresight: Make the coresight_device_fwnode_match declaration's fwnode parameter const"), plus a cherry-pick of commit e67a5ed1f86f ("dma-direct: Force unencrypted DMA under SME for certain DMA masks"), which is in dma-mapping/for-next and comes from this patch: https://lore.kernel.org/linux-iommu/10b83d9ff31bca88e94da2ff34e30619eb396078.1562785123.git.thomas.lendacky@amd.com/ I don't have a way to test SME, SEV, nor s390's PEF so the patches have only been build tested. Original cover letter below: Both powerpc¹ and s390² are adding headers. Currently, they have to supply definitions for functions and macros which only have a meaning on x86: sme_me_mask, sme_active() and sev_active(). Christoph Hellwig made a suggestion to "clean up the Kconfig and generic headers bits for memory encryption so that we don't need all this boilerplate code", and this is what this patch does. After this patch set, this is powerpc's : #ifndef _ASM_POWERPC_MEM_ENCRYPT_H #define _ASM_POWERPC_MEM_ENCRYPT_H #include static inline bool mem_encrypt_active(void) { return is_secure_guest(); } static inline bool force_dma_unencrypted(struct device *dev) { return is_secure_guest(); } int set_memory_encrypted(unsigned long addr, int numpages); int set_memory_decrypted(unsigned long addr, int numpages); #endif /* _ASM_POWERPC_MEM_ENCRYPT_H */ Changelog Since v1: - Patch "x86,s390: Move ARCH_HAS_MEM_ENCRYPT definition to arch/Kconfig" - Remove definition of ARCH_HAS_MEM_ENCRYPT from s390/Kconfig as well. - Reworded patch title and message a little bit. - Patch "DMA mapping: Move SME handling to x86-specific files" - Adapt s390's as well. - Remove dma_check_mask() from kernel/dma/mapping.c. Suggested by Christoph Hellwig. -- ¹ https://lore.kernel.org/linuxppc-dev/20190521044912.1375-12-bauerman@linux.ibm.com/ ² https://lore.kernel.org/kvm/20190612111236.99538-2-pasic@linux.ibm.com/ Thiago Jung Bauermann (3): x86,s390: Move ARCH_HAS_MEM_ENCRYPT definition to arch/Kconfig DMA mapping: Move SME handling to x86-specific files fs/core/vmcore: Move sev_active() reference to x86 arch code arch/Kconfig | 3 +++ arch/s390/Kconfig | 3 --- arch/s390/include/asm/mem_encrypt.h | 4 +--- arch/x86/Kconfig | 4 +--- arch/x86/include/asm/mem_encrypt.h | 10 ++++++++++ arch/x86/kernel/crash_dump_64.c | 5 +++++ fs/proc/vmcore.c | 8 ++++---- include/linux/crash_dump.h | 14 ++++++++++++++ include/linux/mem_encrypt.h | 15 +-------------- kernel/dma/mapping.c | 8 -------- kernel/dma/swiotlb.c | 3 +-- 11 files changed, 40 insertions(+), 37 deletions(-) From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B8E9CC742D7 for ; Sat, 13 Jul 2019 04:48:31 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0D95F20989 for ; Sat, 13 Jul 2019 04:48:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0D95F20989 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.ibm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 45ly3c17hXzDqWp for ; Sat, 13 Jul 2019 14:48:28 +1000 (AEST) Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=linux.ibm.com (client-ip=148.163.158.5; helo=mx0a-001b2d01.pphosted.com; envelope-from=bauerman@linux.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 45ly176g3wzDqnD for ; Sat, 13 Jul 2019 14:46:19 +1000 (AEST) Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x6D4foiu114262 for ; Sat, 13 Jul 2019 00:46:15 -0400 Received: from e35.co.us.ibm.com (e35.co.us.ibm.com [32.97.110.153]) by mx0a-001b2d01.pphosted.com with ESMTP id 2tq5mjvb4w-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sat, 13 Jul 2019 00:46:15 -0400 Received: from localhost by e35.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sat, 13 Jul 2019 05:46:14 +0100 Received: from b03cxnp08025.gho.boulder.ibm.com (9.17.130.17) by e35.co.us.ibm.com (192.168.1.135) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Sat, 13 Jul 2019 05:46:09 +0100 Received: from b03ledav005.gho.boulder.ibm.com (b03ledav005.gho.boulder.ibm.com [9.17.130.236]) by b03cxnp08025.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x6D4k80Q56164730 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 13 Jul 2019 04:46:08 GMT Received: from b03ledav005.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id F21D0BE051; Sat, 13 Jul 2019 04:46:07 +0000 (GMT) Received: from b03ledav005.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5B303BE04F; Sat, 13 Jul 2019 04:46:03 +0000 (GMT) Received: from morokweng.localdomain.com (unknown [9.85.135.203]) by b03ledav005.gho.boulder.ibm.com (Postfix) with ESMTP; Sat, 13 Jul 2019 04:46:03 +0000 (GMT) From: Thiago Jung Bauermann To: x86@kernel.org Subject: [PATCH 0/3] Remove x86-specific code from generic headers Date: Sat, 13 Jul 2019 01:45:51 -0300 X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 x-cbid: 19071304-0012-0000-0000-0000174F2918 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00011418; HX=3.00000242; KW=3.00000007; PH=3.00000004; SC=3.00000286; SDB=6.01231409; UDB=6.00648690; IPR=6.01012701; MB=3.00027699; MTD=3.00000008; XFM=3.00000015; UTC=2019-07-13 04:46:14 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19071304-0013-0000-0000-0000580BA0F3 Message-Id: <20190713044554.28719-1-bauerman@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-07-13_01:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1907130055 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-s390@vger.kernel.org, Konrad Rzeszutek Wilk , Robin Murphy , Mike Anderson , Ram Pai , linux-kernel@vger.kernel.org, Alexey Dobriyan , Halil Pasic , iommu@lists.linux-foundation.org, Ingo Molnar , Borislav Petkov , Thomas Lendacky , "H. Peter Anvin" , linux-fsdevel@vger.kernel.org, Thomas Gleixner , linuxppc-dev@lists.ozlabs.org, Christoph Hellwig , Thiago Jung Bauermann , Marek Szyprowski Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" Hello, This version mostly changes patch 2/3, removing dma_check_mask() from kernel/dma/mapping.c as suggested by Christoph Hellwig, and also adapting s390's . There's also a small change in patch 1/3 as mentioned in the changelog below. Patch 3/3 may or may not need to change s390 code depending on how Tom Lendacky's patch is fixed to avoid breaking that architecture, so I haven't made any changes for now. These patches are applied on top of today's master which at the time was at commit 9787aed57dd3 ("coresight: Make the coresight_device_fwnode_match declaration's fwnode parameter const"), plus a cherry-pick of commit e67a5ed1f86f ("dma-direct: Force unencrypted DMA under SME for certain DMA masks"), which is in dma-mapping/for-next and comes from this patch: https://lore.kernel.org/linux-iommu/10b83d9ff31bca88e94da2ff34e30619eb396078.1562785123.git.thomas.lendacky@amd.com/ I don't have a way to test SME, SEV, nor s390's PEF so the patches have only been build tested. Original cover letter below: Both powerpc¹ and s390² are adding headers. Currently, they have to supply definitions for functions and macros which only have a meaning on x86: sme_me_mask, sme_active() and sev_active(). Christoph Hellwig made a suggestion to "clean up the Kconfig and generic headers bits for memory encryption so that we don't need all this boilerplate code", and this is what this patch does. After this patch set, this is powerpc's : #ifndef _ASM_POWERPC_MEM_ENCRYPT_H #define _ASM_POWERPC_MEM_ENCRYPT_H #include static inline bool mem_encrypt_active(void) { return is_secure_guest(); } static inline bool force_dma_unencrypted(struct device *dev) { return is_secure_guest(); } int set_memory_encrypted(unsigned long addr, int numpages); int set_memory_decrypted(unsigned long addr, int numpages); #endif /* _ASM_POWERPC_MEM_ENCRYPT_H */ Changelog Since v1: - Patch "x86,s390: Move ARCH_HAS_MEM_ENCRYPT definition to arch/Kconfig" - Remove definition of ARCH_HAS_MEM_ENCRYPT from s390/Kconfig as well. - Reworded patch title and message a little bit. - Patch "DMA mapping: Move SME handling to x86-specific files" - Adapt s390's as well. - Remove dma_check_mask() from kernel/dma/mapping.c. Suggested by Christoph Hellwig. -- ¹ https://lore.kernel.org/linuxppc-dev/20190521044912.1375-12-bauerman@linux.ibm.com/ ² https://lore.kernel.org/kvm/20190612111236.99538-2-pasic@linux.ibm.com/ Thiago Jung Bauermann (3): x86,s390: Move ARCH_HAS_MEM_ENCRYPT definition to arch/Kconfig DMA mapping: Move SME handling to x86-specific files fs/core/vmcore: Move sev_active() reference to x86 arch code arch/Kconfig | 3 +++ arch/s390/Kconfig | 3 --- arch/s390/include/asm/mem_encrypt.h | 4 +--- arch/x86/Kconfig | 4 +--- arch/x86/include/asm/mem_encrypt.h | 10 ++++++++++ arch/x86/kernel/crash_dump_64.c | 5 +++++ fs/proc/vmcore.c | 8 ++++---- include/linux/crash_dump.h | 14 ++++++++++++++ include/linux/mem_encrypt.h | 15 +-------------- kernel/dma/mapping.c | 8 -------- kernel/dma/swiotlb.c | 3 +-- 11 files changed, 40 insertions(+), 37 deletions(-)