Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp450752ybi; Thu, 11 Jul 2019 22:42:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqwEBgjl4R9cV9Wt7vftHTNGdxr/H0eo9a7mYbv/cXmzDJTjFuVAN7GiHo55iAmF7aVMdh2M X-Received: by 2002:a63:3f84:: with SMTP id m126mr8885462pga.213.1562910159190; Thu, 11 Jul 2019 22:42:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562910159; cv=none; d=google.com; s=arc-20160816; b=rjvS4BvPxdClyd49GRrcMVYiby5wzX4aX4TEx2vatvZ2WgAOreic7+hK+QpjxXc7f3 wVm13FDbmVxEcFsgvvvoeQm1+V8s6902hpva5SfgstF2DQPDUEah7oTYP3yanRV4D5uj wza4PkyCkdn410QI+urEyDXtHCJl7/M7/ZYt0NznGKnkB+WZj0njkgrzFuq2QfZjUVNq ZyDLvl6f2FNVLS3cNCFBNbkrY4IwnyX0z02ggbJHup+bX5P8sy4fHkcsQI8WnGgpQb6k Br+Z12JUKKporuE7uFSdfInE056q2qK9AZBvzgL9DIGjaIYpgKoBlL1JijnzkA50tD73 yMUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:content-transfer-encoding :mime-version:date:subject:cc:to:from; bh=9u7MhmhqOvwAm3suFsHYZyR1+12IuBmFdcwl6UeLXEE=; b=QS334gYK0r0SetU5VoXn3XVVP78vPLa/HT2TG+wzeUrTKV9A6Hjj749nx0k1G4WEBC Lm/Z0HZWcyBYm6aOyBCI2R6NJfoY2fj+21gDyLPUf/gJkCXjOI8JxV1ZpH72nghrU6UW /DSN2rq4yxY75iam8iqux6g+KoeXAZA0TF3v6LlxS8l09aL5pUGs3VnHOUox2NBY4SX7 lZGjxJEJtgnCX5bIMxwBLYc+MTPskXbswgmdnPun+oaExSMn6bpHIWh3Fme6c2n0DZSs pRJbb0ucAUdY34tzIFBSsKFmxJ834mUq6mXNuv9AEyk+JIVFL8Ak2oVTU2DskmFBfSvX LGBQ== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a32si6805835pla.178.2019.07.11.22.42.10; Thu, 11 Jul 2019 22:42:39 -0700 (PDT) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725935AbfGLFlO (ORCPT + 99 others); Fri, 12 Jul 2019 01:41:14 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:35590 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725791AbfGLFlO (ORCPT ); Fri, 12 Jul 2019 01:41:14 -0400 Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x6C5bRCK054410 for ; Fri, 12 Jul 2019 01:41:12 -0400 Received: from e12.ny.us.ibm.com (e12.ny.us.ibm.com [129.33.205.202]) by mx0b-001b2d01.pphosted.com with ESMTP id 2tpjb7ukyc-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 12 Jul 2019 01:41:12 -0400 Received: from localhost by e12.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 12 Jul 2019 06:41:11 +0100 Received: from b01cxnp23032.gho.pok.ibm.com (9.57.198.27) by e12.ny.us.ibm.com (146.89.104.199) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Fri, 12 Jul 2019 06:41:07 +0100 Received: from b01ledav004.gho.pok.ibm.com (b01ledav004.gho.pok.ibm.com [9.57.199.109]) by b01cxnp23032.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x6C5f5vh40042908 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Jul 2019 05:41:05 GMT Received: from b01ledav004.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7ECDB112061; Fri, 12 Jul 2019 05:41:05 +0000 (GMT) Received: from b01ledav004.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2586A112064; Fri, 12 Jul 2019 05:41:01 +0000 (GMT) Received: from morokweng.localdomain.com (unknown [9.85.149.188]) by b01ledav004.gho.pok.ibm.com (Postfix) with ESMTP; Fri, 12 Jul 2019 05:41:00 +0000 (GMT) From: Thiago Jung Bauermann 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 , Halil Pasic , Mike Anderson , Ram Pai , Thiago Jung Bauermann Subject: [PATCH 0/3] Remove x86-specific code from generic headers Date: Fri, 12 Jul 2019 02:36:28 -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: 19071205-0060-0000-0000-0000035D6D9B X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00011413; HX=3.00000242; KW=3.00000007; PH=3.00000004; SC=3.00000286; SDB=6.01230955; UDB=6.00648415; IPR=6.01012239; MB=3.00027687; MTD=3.00000008; XFM=3.00000015; UTC=2019-07-12 05:41:11 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19071205-0061-0000-0000-00004A1B8F54 Message-Id: <20190712053631.9814-1-bauerman@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-07-12_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-1907120058 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, 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 series 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 */ I don't have a way to test SME nor SEV, so the patches have only been build tested. They assume the presence of the following two commits: Commit 4eb5fec31e61 ("fs/proc/vmcore: Enable dumping of encrypted memory when SEV was active"), which is now in Linus' master branch; 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/ Thiago Jung Bauermann (3): x86/Kconfig: Move ARCH_HAS_MEM_ENCRYPT 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/x86/Kconfig | 5 ++--- arch/x86/include/asm/dma-mapping.h | 7 +++++++ 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/Kconfig | 3 +++ kernel/dma/mapping.c | 4 ++-- kernel/dma/swiotlb.c | 3 +-- 11 files changed, 52 insertions(+), 25 deletions(-) -- ¹ 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/