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 64748C742A8 for ; Fri, 12 Jul 2019 05:51:29 +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 36587208E4 for ; Fri, 12 Jul 2019 05:51:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 36587208E4 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 0587D5654; Fri, 12 Jul 2019 05:51:29 +0000 (UTC) Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id D9E37564B for ; Fri, 12 Jul 2019 05:41:13 +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 6D86C883 for ; Fri, 12 Jul 2019 05:41:13 +0000 (UTC) Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x6C5bevJ015254 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 mx0a-001b2d01.pphosted.com with ESMTP id 2tpj96kwp5-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 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 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=993 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1907120058 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 , "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 SGVsbG8sCgpCb3RoIHBvd2VycGPCuSBhbmQgczM5MMKyIGFyZSBhZGRpbmcgPGFzbS9tZW1fZW5j cnlwdC5oPiBoZWFkZXJzLiBDdXJyZW50bHksCnRoZXkg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kgcmVmZXJlbmNlIHRvIHg4NiBhcmNoIGNvZGUKCiBhcmNo L0tjb25maWcgICAgICAgICAgICAgICAgICAgICAgIHwgIDMgKysrCiBhcmNoL3g4Ni9LY29uZmln ICAgICAgICAgICAgICAgICAgIHwgIDUgKystLS0KIGFyY2gveDg2L2luY2x1ZGUvYXNtL2RtYS1t YXBwaW5nLmggfCAgNyArKysrKysrCiBhcmNoL3g4Ni9pbmNsdWRlL2FzbS9tZW1fZW5jcnlwdC5o IHwgMTAgKysrKysrKysrKwogYXJjaC94ODYva2VybmVsL2NyYXNoX2R1bXBfNjQuYyAgICB8ICA1 ICsrKysrCiBmcy9wcm9jL3ZtY29yZS5jICAgICAgICAgICAgICAgICAgIHwgIDggKysrKy0tLS0K IGluY2x1ZGUvbGludXgvY3Jhc2hfZHVtcC5oICAgICAgICAgfCAxNCArKysrKysrKysrKysrKwog aW5jbHVkZS9saW51eC9tZW1fZW5jcnlwdC5oICAgICAgICB8IDE1ICstLS0tLS0tLS0tLS0tLQog a2VybmVsL2RtYS9LY29uZmlnICAgICAgICAgICAgICAgICB8ICAzICsrKwoga2VybmVsL2RtYS9t YXBwaW5nLmMgICAgICAgICAgICAgICB8ICA0ICsrLS0KIGtlcm5lbC9kbWEvc3dpb3RsYi5jICAg ICAgICAgICAgICAgfCAgMyArLS0KIDExIGZpbGVzIGNoYW5nZWQsIDUyIGluc2VydGlvbnMoKyks IDI1IGRlbGV0aW9ucygtKQoKLS0gCgrCuSBodHRwczovL2xvcmUua2VybmVsLm9yZy9saW51eHBw Yy1kZXYvMjAxOTA1MjEwNDQ5MTIuMTM3NS0xMi1iYXVlcm1hbkBsaW51eC5pYm0uY29tLwrCsiBo dHRwczovL2xvcmUua2VybmVsLm9yZy9rdm0vMjAxOTA2MTIxMTEyMzYuOTk1MzgtMi1wYXNpY0Bs aW51eC5pYm0uY29tLwoKX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX18KaW9tbXUgbWFpbGluZyBsaXN0CmlvbW11QGxpc3RzLmxpbnV4LWZvdW5kYXRpb24ub3Jn Cmh0dHBzOi8vbGlzdHMubGludXhmb3VuZGF0aW9uLm9yZy9tYWlsbWFuL2xpc3RpbmZvL2lvbW11 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:47188 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725846AbfGLFlO (ORCPT ); Fri, 12 Jul 2019 01:41:14 -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 x6C5aQEO013077 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 mx0a-001b2d01.pphosted.com with ESMTP id 2tpj07mb1h-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 From: Thiago Jung Bauermann Subject: [PATCH 0/3] Remove x86-specific code from generic headers Date: Fri, 12 Jul 2019 02:36:28 -0300 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Message-Id: <20190712053631.9814-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 , Halil Pasic , Mike Anderson , Ram Pai , Thiago Jung Bauermann 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/ 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 1CBA4C742A8 for ; Fri, 12 Jul 2019 05:45:14 +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 99823208E4 for ; Fri, 12 Jul 2019 05:45:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 99823208E4 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 45lMMV1YlHzDqlh for ; Fri, 12 Jul 2019 15:45:10 +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 45lMH040VrzDqnw for ; Fri, 12 Jul 2019 15:41:15 +1000 (AEST) Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x6C5b1AJ093750 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 2tpgt7en5g-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 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 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 , "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, 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/