From patchwork Thu Mar 17 16:12:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Kelley X-Patchwork-Id: 552276 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4F50BC4321E for ; Thu, 17 Mar 2022 16:13:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236387AbiCQQOl (ORCPT ); Thu, 17 Mar 2022 12:14:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58654 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233044AbiCQQOk (ORCPT ); Thu, 17 Mar 2022 12:14:40 -0400 Received: from na01-obe.outbound.protection.outlook.com (mail-eus2azon11020021.outbound.protection.outlook.com [52.101.56.21]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F41D167F4; Thu, 17 Mar 2022 09:13:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BjkmuHUA8rhKyqCndwbvCHE7bhFcDpxoTe4XApiK+CHxBAfn5SNoUjQnCn1gcP6oMEvPdn88OLdNG55UB1McOWP9k1kLL3M8K47Y+/DK861KesaoN3mvDythmgu3cp8LsSdos1otUoYKnFB7ZdX8lfPcplNS7yjhaZk7KJnI00f+gXksk6uFJc7fGkauUjjcGY/m8dNZPGTsiyhMYyQXd0gYY4x1SvtP5rk6IbR3UUJSgSaUNnFOq+SgVzHFAUBVgHpCHEnj3mSYeJz+0s8o8BK64CqJbBZ+Qy+SSlvNZvSiOAvp8tTXfv0wVXibb3bX9i/auUm3gmpGiUhHK6NO9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=fANw3N96wb/SEz2HYRPFH4oNYkebZSLj6chgN0ZIU84=; b=JEKxydoVBhbsk07j+z1HjdK+hv3H25po61mKDmWefjvRPODqOxwd0e1UoXKrgrPpSBbxxZMVF5PTgyXASJW9zBfxhJvNtBFwK1J+id6Eay1kln0+pQYG7YjhCCko99tw0kzhX77bM2UxLhTSWfELRm3kaxfzxZVGxZJ27zzBWOmHKtnA9yl2EX3SKew8/uR3kEncJ09WxxJjotuFADWHYYvEcdjLDqNj22yeFTBGGvo34KddVvYKDd9PuqcCc7yxCKonQuZo+MfKkX8LXW/EBjx3WXskDR+uzQLnuoyJLa9U5bM/Dms7AeaDzK94XB6WXF2TsFlxndD2WC7CczzIYw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microsoft.com; dmarc=pass action=none header.from=microsoft.com; dkim=pass header.d=microsoft.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fANw3N96wb/SEz2HYRPFH4oNYkebZSLj6chgN0ZIU84=; b=Cj4NzznzV4wQ9PdTJDlDkNKJ8NzeGPWaYbN2kL7ia3ZLbqdX/ZRyIqyugM73xMtM/NkyW9/9NClcI6rjVZIVbUjwNrEAIHGrBOH8k2sQExqUTD8zbKqUpUJos1ab+UPEJdbBwIsqm8mSXbb36/BYSCyY2ia7qQjgnlUiLqxiMYE= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=microsoft.com; Received: from DM6PR21MB1514.namprd21.prod.outlook.com (2603:10b6:5:22d::11) by BL0PR2101MB0995.namprd21.prod.outlook.com (2603:10b6:207:36::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5081.15; Thu, 17 Mar 2022 16:13:20 +0000 Received: from DM6PR21MB1514.namprd21.prod.outlook.com ([fe80::8c81:f644:fc1c:1357]) by DM6PR21MB1514.namprd21.prod.outlook.com ([fe80::8c81:f644:fc1c:1357%4]) with mapi id 15.20.5102.007; Thu, 17 Mar 2022 16:13:20 +0000 From: Michael Kelley To: sthemmin@microsoft.com, kys@microsoft.com, haiyangz@microsoft.com, wei.liu@kernel.org, decui@microsoft.com, rafael@kernel.org, lenb@kernel.org, lorenzo.pieralisi@arm.com, robh@kernel.org, kw@linux.com, bhelgass@google.com, hch@lst.de, m.szyprowski@samsung.com, robin.murphy@arm.com, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org, linux-pci@vger.kernel.org, iommu@lists.linux-foundation.org Cc: mikelley@microsoft.com Subject: [PATCH 1/4] ACPI: scan: Export acpi_get_dma_attr() Date: Thu, 17 Mar 2022 09:12:40 -0700 Message-Id: <1647533563-2170-2-git-send-email-mikelley@microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1647533563-2170-1-git-send-email-mikelley@microsoft.com> References: <1647533563-2170-1-git-send-email-mikelley@microsoft.com> X-ClientProxiedBy: MW3PR06CA0007.namprd06.prod.outlook.com (2603:10b6:303:2a::12) To DM6PR21MB1514.namprd21.prod.outlook.com (2603:10b6:5:22d::11) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5c4a72cf-95d6-45fe-0749-08da08310da9 X-MS-TrafficTypeDiagnostic: BL0PR2101MB0995:EE_ X-MS-Exchange-AtpMessageProperties: SA|SL X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: YiP+Rr8tt0Rf1WyyjlpF5bj0HsFxvDzokvhvuX8g43Iz6SPSgqSigWvb3zWgS3sBJDK2haWZMETorFL5k4wLPrn7PKvrJlpin7CEXzw7c2F/neT/oOk/PAlB/DIzQXYD4c2x56ICiIFA4ld/fymwYcLInjryoWzpAJwnbZEs13KdpGSyknEGbkvPQJGALp8w1ICrsxdIpCGLiyOvfilQJDxQ+BDeHm3C8A8S8nzVdA30jsufl3MTGxlVp73/DMqofVQWJBxl/9s8MvN/LM7Z+Zp5dD0GKNLwmD82C8MInKllsqxFvz3x6IAwyvFL8EMGsYu8sjfn8wUN4dNmvtwWICOu90KJG6nIl2D24JBfxdDySEHkO87z8bKOaObMOWb7UlGjB8TXHU7Nu+RLJBA/s78OKPscXCVUJjhvScq/xeGrH1YhrwmbFkMlK8QxW+oPSXTRamHewdeh8YqK5Q9Mk77/Nw6bsd5dHO6srKQeTF26yzSk/RwuPe/D6+8BRLUC5Rjh51zElNV9M3MfUnFcH9yibKq+1x+R2QapMhymEAfmYPHAM2k5IZOnMT7zqg0OpPwDeQD6ATxPvI7QoyOUw4UdQ2z9NzJqWZSSbNL7bt3VJaM4+F+vurkQY0I/0+9pOm8WaOndl2Xv43lJCwBR4jTcgHu+ybaKmtQK6Pzo1x+tDSG8CnR3hu/Wqtl8QkprtI8EeNUGaD9ilKjhOJCgWhfOV8zknFfPAkVRRaQWmSgKG+IceQCQgteewlZqQtqDHmfAVd3W+13FxXF2ppEvCg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR21MB1514.namprd21.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(4636009)(366004)(451199009)(186003)(26005)(4326008)(8676002)(2616005)(8936002)(66946007)(66476007)(66556008)(107886003)(38100700002)(38350700002)(316002)(36756003)(10290500003)(4744005)(6486002)(86362001)(5660300002)(921005)(6512007)(82960400001)(7416002)(82950400001)(6506007)(2906002)(508600001)(6666004)(52116002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: g/Nf1JDFHyzLc4yhaPYLvZUnuYhjAClA/WFwf8cqgaWqk2FaTh8EEYByjuIa4NJVO+Xnkr2e3GJAly6Oy43FtSchnjVIag8lkbA5FkII5uobmPM0Mt3cE5pREyY/9YuWDW22q7iCAlMcGlRcWC1NGcET5WB623a1Q3Z23C6APlhQ8Q4V/ojK9KdXosdbux9M2UP8q9wIwn0Jo8fygE93ruixYopO8VvMb7HK2DBJYGgE1tWQBZJcY/BAw+JuTc5o/eXt6TMJnJzv2HdkQdJcBHU/5oCHjto6se2txJzRDalEHabxsVDHS3KCJzdRRhVk3npF9z1jxsjikNmu8EvnH8UyWfYnfzFruLaHS4v2kRqP8jO3+dgEq/XnITlTWnYckSM1ZGTlhrb6BG7WuXk4M8baeQeEQ8OpfD9GxhVzLFISzawiKx8CdGz2o7nIGci3fz7qzQ4Jvv79dU4D7zBlbQ0ftonPWWPYLxdxxM9ND0xYGXXDVNfYHi1b6Gh318RDvrakDDTR1mgME69A4PZJbzOiE2SbgcS0lL+/JQxmzlOcD+TZW8TxM1O+/Sk8c4h+03RnbHqr7/LFUxSUP1V5gqMt5zuRiiV2HSD7GQHqf+2HoiuoryhNTBqVOhUaYPMmspmEhMbsf7KaHEyb7H7ZLh4P7kB4JW8Eg2pb81//pwz0Eg/V8mzXH+NNwagxmrAa8FrkT90fzQHXoCa2X7t+fAXUqNXzOKtJyhFwtAXCmdWhLTq3qDuMX/J42c9GqkB/+yB2a8NGo3PQ6i6htzdaYbpaE4TvJ95WZnYSg6yeeBBt2hdkAhCsG/nByAM1YIHFIejpysqlHley9Q0r+XLO4UTK8IQPP/SUgRPXEfvM0XcfIrlGpgD0pS6UXaK00+iUVH8M6a9wumbBrSaWlgElgD/KmX9W/pdmjT8X/7T82qyBMEZ9oB90Tqjb3YJKQFDPevbVu/Z8LoStCLyUpkhDg3EsNa9MSZFcRy6pHOtoZlSDAxIDKysRcy5iohKR4bU6KFE8tQufJfhKOLoOhXn9qWKMFsO0roNBOctoZ/XRWdk75Dqk+bAWXdX1+gR66ys/TrYLxERhtS0R3N4bsUH4+lf5h5wAMHXlJoWbQ25OqCPPxvOlUHXlXWLjddetuS3c3fRLtTo8BI+sdtED8pbm7veAnkizO5LwXZk3LLT06eCeDq6THsYEpotO0LsR+wcSvtAnQBBxieKHZqdGDNWNTCOuP7hsyJR8eLGEtL+y4gFo4ZcGr6KyaIv6hK1Ma6mfjiK5HDHZ2g2/LWmIWCBXBX9A+lFP3iK6f1ZGEYRiFzlG57B6Xx3Oy4EOqOPmRuniC6D0+6Nmwgf1ZUcnTElne7ZoU/fWjkLa5XbPDJ05gz+FFDNvzC1FKxNaTRMPrbeYSWVYvRKxHYjqJPYXxIDz+V+GD15jOKcxRH3PNjhxf6Ziuo4d18sxwUdMMrsYbyzllShfqV3K6Ve4Fk71WVczmg== X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5c4a72cf-95d6-45fe-0749-08da08310da9 X-MS-Exchange-CrossTenant-AuthSource: DM6PR21MB1514.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Mar 2022 16:13:20.3247 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: jSOWCiZtIB2q0qPNK00ZSp+LgtlZeAKmba7e5kMzxwZfyLMKMophg2weFRZzJ+rmyskbepiHW3dA7F/bM0EW/A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR2101MB0995 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org Export acpi_get_dma_attr() so that it can be used by the Hyper-V VMbus driver, which may be built as a module. The related function acpi_dma_configure_id() is already exported. Signed-off-by: Michael Kelley --- drivers/acpi/scan.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 1331756..9f3c88f 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c @@ -1489,6 +1489,7 @@ enum dev_dma_attr acpi_get_dma_attr(struct acpi_device *adev) else return DEV_DMA_NON_COHERENT; } +EXPORT_SYMBOL_GPL(acpi_get_dma_attr); /** * acpi_dma_get_range() - Get device DMA parameters. From patchwork Thu Mar 17 16:25:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Kelley X-Patchwork-Id: 552273 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6EFF1C433EF for ; Thu, 17 Mar 2022 16:25:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236564AbiCQQ1I (ORCPT ); Thu, 17 Mar 2022 12:27:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40000 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236540AbiCQQ1B (ORCPT ); Thu, 17 Mar 2022 12:27:01 -0400 Received: from na01-obe.outbound.protection.outlook.com (mail-centralusazon11021024.outbound.protection.outlook.com [52.101.62.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4BD43DAFC5; Thu, 17 Mar 2022 09:25:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=e0NhkDClOkLvQt/RRQb+jzedPz2jjhzXkr48E84UBIPZqzVHCCVKjpreHFEIYRa2aJh/hpekJtstZlZLriPb1pyZYxIW0W5/C4tbOkt5qAc0rRQV8y5k+9I88uRZfhlN2CczgZ2btm+QUWfheqcTg/mAms9g1xHyX7mitP+aQrPinrfj9go84olK//WJ/Q4DNc/r+JHid001vS2i8+XzmcO2tgOD7c9q9ibi/UuDrGquwCUEgR9cvw8lxucINj+So6dqljxRv43NtBUM6wbNNziulFpJCfemgBqIrxirwLNrFfjvlbUMBjt442OELZO3Hw+e8x0zJ3zvWn6gkxAP6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=WxZuje2ccNfL+dilqXvqiAwKeYbCnnj+H5tv91jgZzc=; b=B1/g7SHhil4StypBijAPjYmj3YWTd8WBYPrWp8DnKdp1pHiu/awyiOvvdYu5N+NvXZzYeQulLdWXWBgJFqcWMSXijw0HLnIvkUU/5PAwlm8vzVozV9YSXF8DQoQ5PA/aNWj0YjWs312OsSac8FaQsIr1uCR3tt4VdmX5sHFPUbdsTPWqUEaay1egwwTRIylfmt2gimnm6oZr512GlhC+Ng+12ecmp6YUouzBmjGYYk7hm8P1GmiA1rMNRNnnVgguS3rgjM1peBioL6blZ1FaL3wD84cIJzJQO450hWy58oiPZN67Uvehx1U7QiRyMdAUUdMNXrVBW/c6LlL0Tw1PLA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microsoft.com; dmarc=pass action=none header.from=microsoft.com; dkim=pass header.d=microsoft.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WxZuje2ccNfL+dilqXvqiAwKeYbCnnj+H5tv91jgZzc=; b=Zgo7Fev8foZOmdvTUYUwxDLxYI6/ACexVvwgR71amsLRBHaueyo8qhfWajiS1Gu73XQ8wboXoefUtEWzmCJ4U+xcQNdW8ckWmzaq3rA96b8A1ILRiDTt6tzawMdqYwVVZOltoSgyRmqP3uDDt9yc/xUqNBpPs8oYaXb8XDfr/D8= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=microsoft.com; Received: from DM6PR21MB1514.namprd21.prod.outlook.com (2603:10b6:5:22d::11) by BL0PR2101MB1796.namprd21.prod.outlook.com (2603:10b6:207:19::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5102.7; Thu, 17 Mar 2022 16:25:43 +0000 Received: from DM6PR21MB1514.namprd21.prod.outlook.com ([fe80::8c81:f644:fc1c:1357]) by DM6PR21MB1514.namprd21.prod.outlook.com ([fe80::8c81:f644:fc1c:1357%4]) with mapi id 15.20.5102.007; Thu, 17 Mar 2022 16:25:43 +0000 From: Michael Kelley To: sthemmin@microsoft.com, kys@microsoft.com, haiyangz@microsoft.com, wei.liu@kernel.org, decui@microsoft.com, rafael@kernel.org, lenb@kernel.org, lorenzo.pieralisi@arm.com, robh@kernel.org, kw@linux.com, bhelgaas@google.com, hch@lst.de, m.szyprowski@samsung.com, robin.murphy@arm.com, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org, linux-pci@vger.kernel.org, iommu@lists.linux-foundation.org Cc: mikelley@microsoft.com Subject: [PATCH 2/4 RESEND] dma-mapping: Add wrapper function to set dma_coherent Date: Thu, 17 Mar 2022 09:25:09 -0700 Message-Id: <1647534311-2349-3-git-send-email-mikelley@microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1647534311-2349-1-git-send-email-mikelley@microsoft.com> References: <1647534311-2349-1-git-send-email-mikelley@microsoft.com> X-ClientProxiedBy: MW4P222CA0001.NAMP222.PROD.OUTLOOK.COM (2603:10b6:303:114::6) To DM6PR21MB1514.namprd21.prod.outlook.com (2603:10b6:5:22d::11) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c0939e0c-e960-4f57-0e22-08da0832c882 X-MS-TrafficTypeDiagnostic: BL0PR2101MB1796:EE_ X-MS-Exchange-AtpMessageProperties: SA|SL X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: a2PJvTQmy+qBdJMrhcQvH5odCF+txcZ7z7z0DEmBOhS5PN3DdVvpjJ6Qs6yA0cyWTPBSq1kpvFHDgrGrxnBw68CM6vvMt3cy0ZCrtzjJF5yCp5B+LbS9C7UQbEhhljg0QXqTBcYYLdjeeztifaA6sIaD5Nmywp1E9slwjqNL7xqv/IolJAXUo9/LS61m82vZs5UQWPJcBjzS8KR8+ber4NA7beK8dVT4/ZjqVARGYIaJeOIdYaYuhl9i7pD/P6xU3J97Cx75WaB80JKM3qqy1tl63oflbUB5jpwXyQHrzqs/O9foUrEDeY6D6aLI9CO9E9lmGeGGx4rbDcbuKVSxmOacfgucViFAi8snWDrHc0D9KmdCR4Svc2K5qO9ehDCb7cn5WjOYHs/CaCjKPBx7cO6BsXYxY3YIU/Y8Sde+ln7kLxIfw26daeFdf/bUuafBT06NUFHZQMuNQgeqJnDmFP0ISwQUDVHhnNzCM8Sug0a0DRhNIpTF9jUzL9a0RjdU9cV4GhuNmkyexTbSQpVIdt4R9yIDJi4h2lgqlWaUi5Z+N6AHHSrLofAhoo7/hocC8CIqBRCgD2ajEnsB6v2RY+8FMruzqBiusXRo2UMcxG0CQgWDtDgU5qWUSJl4bgXtilhHfPqsz87jJMATxmSVo64rG1cAfWGWXC9Km9hqqG40HiTynhI8Y5NK1Cl2i2Pl+2DCcNUJ/Yki75J6hvOlRd6DjcZm6b4En1X1zZD5/Vme54v1QmFE4WGTlu18wDk/WNFbv4HaUNfQzynOOS0lgg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR21MB1514.namprd21.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(4636009)(366004)(451199009)(6666004)(4326008)(8676002)(7416002)(66476007)(66556008)(66946007)(6506007)(921005)(508600001)(82950400001)(10290500003)(82960400001)(52116002)(38350700002)(6486002)(38100700002)(8936002)(2906002)(107886003)(5660300002)(6512007)(86362001)(4744005)(26005)(186003)(36756003)(316002)(2616005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 0av/8x5/s5DDYsN4H1M8Oo0+Cr42RfQO9oxfqFYM2cuxq79z+1qabJm5uvsb7x6BapWsDLIKaiGr4MSPow02pV+KhLeMLo0hsJbg2cnZGLFC2ltA08hhPkiwax0Y01H+c6pm3FVw47ejuGYgl5JpHQuCHw2K0ZYHn47QMQj7PXczB1o2hw5jYz26jyFvkoYI2sdtjv+qEHP4Q06vnzYjPHJ8InQStQHdOPyVIGOIChq5XBvgKB6oGx4lWbqGcTuyHAYK19UKdIR03Aya2SW0cXuofDsDOS3498xq7025UjEA1Ga+8Jw8eBf1M/Jc1etlgvcjVbuFV5olF0eIcuhm3IKCVgE03wqOpgKgSqWFwVKKc1Mh34em9qGY1ZCFwDmSXge5al8b/tAUuhtWqF2lnA5ZeK5r2vVJalv7ufhWB3c3JbimjSnQZ2Un65ezCu3J4r42SsKh7nyQZ3GGWIzzxynIZ4UFAhfhAxLqvF89MaM7nzeZZAaeE2Ofq/NmxvoBj8DmL1jXnboXL2nngtmGVL8Z268DK9twsgNi2tDBHe80JqLAgX28xHy5eKlqRo6EOEXn5YZdKkYmf4TZVK2rhoxKI1mGcyY7c/NkJIORBhGLc0ZMmF2KqbT4dZb14RFbiudY+jmRn41TkIasmKGF1/J+OU8T3KERu/tBBVlUIj1/reucSocTpqgWKQjoLnN/aBkXuz5UveoJwW1FHhTWGAAZQwIVw5moG9X/17GaK8gwi9gXIMTd+C35+TbXa/94XAogucl9+YNjBnw0RzuowuoWw8Sg0CaA8sM2CkE8NW+BUZONnJVkCEAsaBsGAIiLs/I5oIRj7EMvO5RsjW91IXl59BLrVf9pSmAMDPlFW/9iU9IpFj4k/QD5yte1QOV73jMOEazUUygzSOqcBc29EycuBW2NM2GO6K6NBLXkLMk5ZcwsfWq4FRyOu8+Vm9CMCWorNkbpsRwBs+mJFX45ns9OGPa3JmbFoVBqT3SLriMGvwzRcIFaRanmX2+Wv2J2MB07Y8U4VFDoWrC5PCoKd/urAiNLcd2UDp7hGCiVPFtRRx+HILZse5gCCjWBGL7wbIQHFt+h/c59/AWnM0BF3rsLLiK2J8xpOfYHgHUzG0UWf3SmRs7lBv6JCaPUv0N7w27D1xs0wRMldO5oS5g5Kt8rcmjMYuP+PEGJoF+lYSarqmXNAdJ05M4gPbZJdTwYiJVZbARvncV7TGPJxahPQvsYgsreFO6EhSOjw1FnXRUUmStx4I8Qpa0fCAJPMWuiu29sKEFar+Nh6cMBSlmwWbL48JWiHgI6fFxoOVdvdLIb6Mrx1PRa89jiRboZ5osKwZI60W07OpV3kOvSGvvijl1UHzS1B0pdBBj55ML2pFGqsblJlETrdrdGGBQqKK/FsU4gvNhZPJjIV4mEglvpxX2EaInm2anhrIs5MVFf9tTf4xIzWUtmSuMadQZk5F+L0ca/MJPPtTpxoPXAxaj6mw== X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: c0939e0c-e960-4f57-0e22-08da0832c882 X-MS-Exchange-CrossTenant-AuthSource: DM6PR21MB1514.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Mar 2022 16:25:43.2999 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: thINH8NTaWtd2dm7lqe57swda2R2EZ03Z0TV3Yf9IMYieOtm6GKvzTCYE6wlofCTlhcm1IWPUL38W25Mu64EXg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR2101MB1796 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org Add a wrapper function to set dma_coherent, avoiding the need for complex #ifdef's when setting it in architecture independent code. Signed-off-by: Michael Kelley --- include/linux/dma-map-ops.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/linux/dma-map-ops.h b/include/linux/dma-map-ops.h index 0d5b06b..3350e7a 100644 --- a/include/linux/dma-map-ops.h +++ b/include/linux/dma-map-ops.h @@ -254,11 +254,20 @@ static inline bool dev_is_dma_coherent(struct device *dev) { return dev->dma_coherent; } +static inline void dev_set_dma_coherent(struct device *dev, + bool coherent) +{ + dev->dma_coherent = coherent; +} #else static inline bool dev_is_dma_coherent(struct device *dev) { return true; } +static inline void dev_set_dma_coherent(struct device *dev, + bool coherent) +{ +} #endif /* CONFIG_ARCH_HAS_DMA_COHERENCE_H */ void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle, From patchwork Thu Mar 17 16:12:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Kelley X-Patchwork-Id: 552275 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B4F99C4332F for ; Thu, 17 Mar 2022 16:13:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236438AbiCQQOw (ORCPT ); Thu, 17 Mar 2022 12:14:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58832 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236404AbiCQQOo (ORCPT ); Thu, 17 Mar 2022 12:14:44 -0400 Received: from na01-obe.outbound.protection.outlook.com (mail-eus2azon11020021.outbound.protection.outlook.com [52.101.56.21]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D501A1FA76; Thu, 17 Mar 2022 09:13:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=H0UOWmYjeXeP9nbSsdL4EPDUB7jifsnNtB9BUTB9CH0nU+nHMLUWLtIkfom9zdShQ6ILjKKVvgd8ipfhIh7AZ8GaAedFceH5k99HHzPY/Bzk7FkFkkMj6tMjeeHVlNJbwz55B91gXGQnXww2m8cD7DjnifjIrnwxhUgzWu4Q+0HVOTeJAspAwD9JlPPn74nNF+0NzcHdNrF9Q4Orc4weteycCi3057jYfiQp0bddmOZQ2dkUxE+OqA9xEuQZpMABY6kM3mrI9i4WyXNjzWG8yjnwh9dGf5wkgyu3vCWK12lAOyKVZpd5X9eRj3vdasXeTGdP2yQLNFFq1kBeB2v5kA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=2yDLDyXVr4lWPvqstJjFwb/JQmGOxqMwR4p51AL2DjA=; b=h6+XIkbi/bCBWsWoAF6tfNDrWfpWIAvcSuwxVpkpA6tWdEUHJ9tPQ+sa7j4tv5RFb/tfuSdVAHKWPi2Ib934H7ynojyAJ8kcu44qZ4ZvEF3kedd7hb4jDC+r+ui5+FK5pnGo/DbxdB+pHpqGuDEPc5QFwZHHTQn60pPAbZo5xOXtAi0dCpnRCeXgrF9z1w3VjO0SWe8JhsCnmg/HP4LmM9C6tbcLpz+R3WDFx8p1/Rl64PQuRiExKQGvs+4dcMXNsQ8xNEydN3Hs1n50/4PR/0iXuogFTjdQmNTE2HIdcNTi12UZtKuoHx/jFELMlVxy6V2D8/l+LM0XaYiGDm6rtg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microsoft.com; dmarc=pass action=none header.from=microsoft.com; dkim=pass header.d=microsoft.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=2yDLDyXVr4lWPvqstJjFwb/JQmGOxqMwR4p51AL2DjA=; b=WIcvQ/0q/VM9rZVkzFEG+B4z1xPDDaIs33kqB18OgPeeI85YaAwIGepIXBkGSFsV0YjLnel1l2NauMTT5s2S9e9ep7YkVOMkk2n/o8QMh+i265o01zG9RSbKxDkkeWCc5M3oDJk3XZRgFxKLW0OBI1wPI5KSCqNZaMImR+ttiB8= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=microsoft.com; Received: from DM6PR21MB1514.namprd21.prod.outlook.com (2603:10b6:5:22d::11) by BL0PR2101MB0995.namprd21.prod.outlook.com (2603:10b6:207:36::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5081.15; Thu, 17 Mar 2022 16:13:23 +0000 Received: from DM6PR21MB1514.namprd21.prod.outlook.com ([fe80::8c81:f644:fc1c:1357]) by DM6PR21MB1514.namprd21.prod.outlook.com ([fe80::8c81:f644:fc1c:1357%4]) with mapi id 15.20.5102.007; Thu, 17 Mar 2022 16:13:22 +0000 From: Michael Kelley To: sthemmin@microsoft.com, kys@microsoft.com, haiyangz@microsoft.com, wei.liu@kernel.org, decui@microsoft.com, rafael@kernel.org, lenb@kernel.org, lorenzo.pieralisi@arm.com, robh@kernel.org, kw@linux.com, bhelgass@google.com, hch@lst.de, m.szyprowski@samsung.com, robin.murphy@arm.com, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org, linux-pci@vger.kernel.org, iommu@lists.linux-foundation.org Cc: mikelley@microsoft.com Subject: [PATCH 3/4] Drivers: hv: vmbus: Propagate VMbus coherence to each VMbus device Date: Thu, 17 Mar 2022 09:12:42 -0700 Message-Id: <1647533563-2170-4-git-send-email-mikelley@microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1647533563-2170-1-git-send-email-mikelley@microsoft.com> References: <1647533563-2170-1-git-send-email-mikelley@microsoft.com> X-ClientProxiedBy: MW3PR06CA0007.namprd06.prod.outlook.com (2603:10b6:303:2a::12) To DM6PR21MB1514.namprd21.prod.outlook.com (2603:10b6:5:22d::11) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: eb52f53b-986b-4294-bdf5-08da08310f12 X-MS-TrafficTypeDiagnostic: BL0PR2101MB0995:EE_ X-MS-Exchange-AtpMessageProperties: SA|SL X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4EHNXLwFM+R8VxJ/0zskQBaT6T7uigvIqQvkJp+MGE4ZvpnyCaQIM8ZlrEOUF2BWau1LEKqPInxpw8iyUPuxHuYIfHZJdn7FHwP1m35+Oo/ZQPyUR3EcyHb0TURsNGc+Jqk7hiuHPVi/DOeHXHwLePEaZL+Aw/46PbwI8+RbZdVkc//SKXSZapJGaZhU6hC1FtJ4QuRr/XedTDXmarne/tHotLEekmhSSMy94Brta5toRa+HDl66S2v5jyVFfAKhoWiy6azsIa8Uydy4oEo7WQ2KbnJT15jZpgQ3eAaG4r4pRAnCfS0GYTKE/I6IOZIYoOuIbr2JK63LTMdWx1ncijxQeZxmCZMOKVCuK+0CXMxkLRSYTXnrmhIOb0Rcc8gmfRRdkfDLOe91ohFUXafk8bqJ04dOJo9ej1WWtq+d24pEIUsnE757+ed92/uOsWIwaXPG3UK3kUO18uHjhNDlUdarfHaSd1eYWNU8iL2zC6PeBSdXxdEeJIKIiXqwC7xwCGFkqWUBwYRszkAsBWexj2GsvCIKWco/h6pM68NtD9+RVMYnDVguqzHqzvpWU7b6bnHyBlQV2iFoquUwyY2eMZP8XPVMzVn8ddohiU9LAad8Dh0iBFMsiyM7K17SRm14Btf5z0+jLI1xhf42i7S8yRBkObwiuA7SqC9NjY9evrerdyJd3YgBYBJLBmKs17RW/PT8hIF6N6Y82uKk3Q5EUgApXg1G1zLcZMXeNtz5DsCLfnadaMFGyZOFNu0JAM9omEtY7rvQ+ymc+BNkIy5v8Q== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR21MB1514.namprd21.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(4636009)(366004)(451199009)(83380400001)(186003)(26005)(4326008)(8676002)(2616005)(8936002)(66946007)(66476007)(66556008)(107886003)(38100700002)(38350700002)(316002)(36756003)(10290500003)(6486002)(86362001)(5660300002)(921005)(6512007)(82960400001)(7416002)(82950400001)(6506007)(2906002)(508600001)(6666004)(52116002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: U6UHLyLM3WVJ9lT05bFYn97qJVgRV+uVmD0YFVhcnZclkCpCAwfafjmem24foppDtruXtI7g7qAXIfxyYRmV9/tAJwIrH05WyJ+a7mhKyjtVAYTMQrSjvkRSuWMkfjMp5knlWpPDfK5adJ2vFe8gSt7pRVxzZqjHVuscwhb8DqgUm7FM7Tp+NiV6jAsCIcm0OdZBFSP9+76Tp49izfX/um/k/tfMCgV+zhnGlJp8fTpmvCcGf0DBahJHF41lQpuGxwwqW/qaxswhKY0YDFbPUzPNvqPB0NnNv3gqRF1yDbQKmrzei+Kze4o+3phBcKbaXVZlPZHqMf8XzEKLradwEVEfFNIYaLepzlsmIULNZAUqS17GEGDkHlQUt8AAZ8XH3etr0mDAIvPzQcwWuvoEoHrfZIe5a2J23eWA7d3C/zGY6bTm/z+pKcucByZtLjwVltnRpDsO1Rjz29IsslvK7nx3JyR6hBz7MbhrH2dYOhfrmruffIIw1oHwCoUiHi0haxI3hhOV8vjSLPHsoL0gF+uMPmae4aeh50u/DPr8A1eQh/qrr5scSUmzHMyGrkyHRey/rReQLcK79d6O/8Q5dtMsrOz4rdWrr7R0ziPABgwKizeBXouQPIjfJT/3uAv3QlPxRgo3eraOSyT43vCzYjGQtP0dwRzAluX7cDtPr/vfyJ1JQnuImQ0robR/D3IcSg61fp7zH09gzdblH+et3DbrNfizkJQe0u4EtDiRfgaWhxMlZgOtZvQ33NXtXotgkXMUx6ruCRELWOZWyyX5w7Msel5yNmZqHLbb7JHa4miGbxNahmCCImT/h8aZ6EU9dHN16ibCNY/TeuSuf0Q5WX0xE9y5R8/e3Y1UVZLVJl5Yhw645r38A89WrYkKMnsFg0AJ9lyJAQ/GgIk2XBZ/9KF1o4bbcZRD3eLBGbD35KhAMQ8TPoUiUUJ1brdOmH5s7Orh+gB/ntomOVjE5YOU//9hMwnEzeUCw5oQc3rUj1P4FbCucLXAZIoFCKxpFBggvyA01jSzpJa/ASmTvPLwTiyaC+Q+TxmTJoBOQWApzAOaYIVnuqcsQsUYrbumHu3XUVhdB6NpxzGLdkHgzEyCI0AssDD+qO7k5bZJsgLsilRvrMcisOCLZ1qHIRcSNpx5qEtsx0BAmTS4eBjpreqqWCD2lIvWsLcUS+0gYtzMfRnY4l2JwurlPJ39Rk2wNpE/PwNvHrm5fKgUGfIE0yfNILJ4trIAEUzvElWC9nTYwWRbo4Ds5MHo9BF40mMKLVj/ckUVsOExbIJRFpIbr5HvmLAmYs+bJzgf3Okp1NTCtIWSmizfPZY6pS2gRF6sheZNqxjuGM0K9wnunGzvUeAzylC7qkq1fRCghzYxt25zW1D+eQ4gdZPEbbWZ9NTCiaKmOGdZ6+zDJPkFTVnjhlJTnRMTlDVfmd15jSECS+ddOQK44ine1G4sOk6WPHvgTwY9/OT/d5UWRCATV/4vqGnw/w== X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: eb52f53b-986b-4294-bdf5-08da08310f12 X-MS-Exchange-CrossTenant-AuthSource: DM6PR21MB1514.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Mar 2022 16:13:22.6963 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: PfRB4pibcMHQ2eo2nV+doiyNol2bg7KWwTLGKiLlXqNt4xPDdBcmf83alNOrlHDI5LjdB+CK4ayY0xgWF38Gcg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR2101MB0995 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org VMbus synthetic devices are not represented in the ACPI DSDT -- only the top level VMbus device is represented. As a result, on ARM64 coherence information in the _CCA method is not specified for synthetic devices, so they default to not hardware coherent. Drivers for some of these synthetic devices have been recently updated to use the standard DMA APIs, and they are incurring extra overhead of unneeded software coherence management. Fix this by propagating coherence information from the VMbus node in ACPI to the individual synthetic devices. There's no effect on x86/x64 where devices are always hardware coherent. Signed-off-by: Michael Kelley --- drivers/hv/vmbus_drv.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c index 12a2b37..c0e993ad 100644 --- a/drivers/hv/vmbus_drv.c +++ b/drivers/hv/vmbus_drv.c @@ -904,6 +904,21 @@ static int vmbus_probe(struct device *child_device) drv_to_hv_drv(child_device->driver); struct hv_device *dev = device_to_hv_device(child_device); const struct hv_vmbus_device_id *dev_id; + enum dev_dma_attr coherent; + + /* + * On ARM64, propagate the DMA coherence setting from the top level + * VMbus ACPI device to the child VMbus device being added here. + * Older Hyper-V ARM64 versions don't set the _CCA method on the + * top level VMbus ACPI device as they should. Treat these cases + * as DMA coherent since that's the assumption made by Hyper-V. + * + * On x86/x64 these calls assume coherence and have no effect. + */ + coherent = acpi_get_dma_attr(hv_acpi_dev); + if (coherent == DEV_DMA_NOT_SUPPORTED) + coherent = DEV_DMA_COHERENT; + acpi_dma_configure(child_device, coherent); dev_id = hv_vmbus_get_id(drv, dev); if (drv->probe) { From patchwork Thu Mar 17 16:25:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Kelley X-Patchwork-Id: 552272 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 74524C433EF for ; Thu, 17 Mar 2022 16:25:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236577AbiCQQ1L (ORCPT ); Thu, 17 Mar 2022 12:27:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236557AbiCQQ1I (ORCPT ); Thu, 17 Mar 2022 12:27:08 -0400 Received: from na01-obe.outbound.protection.outlook.com (mail-centralusazon11021019.outbound.protection.outlook.com [52.101.62.19]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A67C1E6174; Thu, 17 Mar 2022 09:25:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jso8lGDRloSWDlJ9ed9eAN6Lu1mI6F2skw+wU6uioHTK0AYsg8FOc+DLR6Qit71Hj9MGUB8yMSuigJgTexkDWvkG+GlbXg5LSZWCguHeMPdXDEMHEqdkkHBni9Y/n65dxxMCiIDj0pUxsMryLpDEYfl4qnBua/23adB7Nr2x9y8qj0ibK+4YKGqMnO8bbGKqqFBMS6Pi6h6/TgV0ZhwW8f16Lh/VMTkcV7zI3I0ZBiqB5CCdKoTksx/u3pB+6kkgwYB4HTn9QFFh6V6wIygYi4XdJf436/a93VNytvMPRf20IoQvPkAmzW5Fi6M4kvK343ZgE9tLiYa6murvlvQhcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=TMBkvB8XqJXPIW9KcFtQrPV7sFII7sr9r1YK92fPbUg=; b=d+BvDfcDIhmBuHaZNbzSRDxH7F4kjAN685yNS284908+AH0j8718JeaexYEjhfKJg4/IT8OU84rSctkPIm7M1U6tnzEhh4h9+pK7IH8jJYMjLvgsTpbYLQydgpBaO/0L0TjKpEiLmSV6R8yLqwJOIPOJGHWB+s8CK4Krz9YwSBLUbghFJbwwrXuku/fQCRbL9akaSOkvwOxN907o4m+tMMdR/B4iJxFwELbjdhLrzQSUkP1cn6Ba53o5kvBOnW/9AbJl+38UPZar6EVOQgl4fFLofhjZoI+yBaFsBWItXiyA15DqeIpJ0wUZNKUaAAsBKTHXdzz+0kvzf9JZzTWUvw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microsoft.com; dmarc=pass action=none header.from=microsoft.com; dkim=pass header.d=microsoft.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=TMBkvB8XqJXPIW9KcFtQrPV7sFII7sr9r1YK92fPbUg=; b=g/T2hVXJton/8y0wyTwv8nl2Mb45A0mPQkEj7j4zKmcpxAYjNbLxHMxxlGgEA0yOTZoefNfTrg0acSvE3FF1sUjPKhJI1NexYJGJwk0GkjgSZs0qd68BBB2PUEyOqVOyaJywYGoSd1epWFZwcHGNiB29PNZMH/Bbg3Dn5/TigUc= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=microsoft.com; Received: from DM6PR21MB1514.namprd21.prod.outlook.com (2603:10b6:5:22d::11) by BL0PR2101MB1796.namprd21.prod.outlook.com (2603:10b6:207:19::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5102.7; Thu, 17 Mar 2022 16:25:46 +0000 Received: from DM6PR21MB1514.namprd21.prod.outlook.com ([fe80::8c81:f644:fc1c:1357]) by DM6PR21MB1514.namprd21.prod.outlook.com ([fe80::8c81:f644:fc1c:1357%4]) with mapi id 15.20.5102.007; Thu, 17 Mar 2022 16:25:45 +0000 From: Michael Kelley To: sthemmin@microsoft.com, kys@microsoft.com, haiyangz@microsoft.com, wei.liu@kernel.org, decui@microsoft.com, rafael@kernel.org, lenb@kernel.org, lorenzo.pieralisi@arm.com, robh@kernel.org, kw@linux.com, bhelgaas@google.com, hch@lst.de, m.szyprowski@samsung.com, robin.murphy@arm.com, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org, linux-pci@vger.kernel.org, iommu@lists.linux-foundation.org Cc: mikelley@microsoft.com Subject: [PATCH 4/4 RESEND] PCI: hv: Propagate coherence from VMbus device to PCI device Date: Thu, 17 Mar 2022 09:25:11 -0700 Message-Id: <1647534311-2349-5-git-send-email-mikelley@microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1647534311-2349-1-git-send-email-mikelley@microsoft.com> References: <1647534311-2349-1-git-send-email-mikelley@microsoft.com> X-ClientProxiedBy: MW4P222CA0001.NAMP222.PROD.OUTLOOK.COM (2603:10b6:303:114::6) To DM6PR21MB1514.namprd21.prod.outlook.com (2603:10b6:5:22d::11) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6eb045ae-5cb7-4bea-3391-08da0832c9e7 X-MS-TrafficTypeDiagnostic: BL0PR2101MB1796:EE_ X-MS-Exchange-AtpMessageProperties: SA|SL X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6nmNVD7+VrwOL1LWsCZ5yDAm6zK6hd01a13m7Ds1JvPeSQwm7+Pr5aptTDpmmKIvVFUmvdjesTWxChcUU6+8WZtykwJO+4o5X/lgpmFBxvhnIAdqsYIAH00ZEOwWK0RF3O2yZCeAsUMCnurN8aX+R1MLxeflPdX5jztN498INWwWP7VUxEiRxJ+TLUGDZhmAWggxU29Mx2BKIlt7FBFCtnm+mnEowNXqAWUkbZYtTvLVHQ8/4+3uYxLgiixyq8xkCl9YWeGxrQRj+lcuAv7SYafWr5FU3+zGVE4CKtJ2mEGcuELFHbtF40+5N+eTw550xDekrNOw2uCGY3Te6r+WePilbBVzVHRRg9wS78skHEqRSD1z+Dv8H5NPm/q4pY1b46wJyfOL4Kr387Le9sGTNvITZ9I+H9k6oSD8T8HTu+SJC9M85oWBp25fpqG8WO/rZVOEZ6BxmXR219lKDA/NAsJ+XMWm/SySiu8U7CSOscqEn8v8CL4TobWM5zezEIU1HNh++3JIK0fawXogIIugJ6sn3NutNj6K4ARnlCrAeG9GKtZOdsTy/GNaMdosChCqCdyUD0quaV7pjK3NTXCrxkHvSlfNSWUM+qyA6MxJwI4TMoajXwN5R7VMaNWZd7mPC5pB3HY0iLl6LwcRtgxgVobsP3/keE9krt4p0qumeduBJjm+i9NacG4mL7DoYUI1FZD6Sp+xc/cCBJU+PHwOe8IzE/nWd6gz1dvNWH/cufqKXYR1EsOVt6FQPi1wGxj+I7Mt6F9WBIWTJ2xE5PEvfA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR21MB1514.namprd21.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(4636009)(366004)(451199009)(6666004)(4326008)(8676002)(7416002)(66476007)(66556008)(66946007)(6506007)(921005)(508600001)(82950400001)(10290500003)(82960400001)(52116002)(38350700002)(6486002)(38100700002)(8936002)(2906002)(83380400001)(107886003)(5660300002)(6512007)(86362001)(26005)(186003)(36756003)(316002)(2616005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: HFUBH3kH254ypgDiOcIzPk4/7ervIBIjyVW02Sb9jCkJvtPt7xF4ilfprTINCQWrzE8bA/t1HvTJ8gDdLjMkwwdDZi2w8VzQn3QGHVSzFSFL6aH/SuJcq/QmPJhCfjCCm/LY5Hq/2KtKhsiyGPvGhAyh8Ooz4D0aWIr8BszlT1tY7JyyHaJTlW0Kz1qJ8hIBjqyHU8EjbgcqkTtnyJ39TEJNQbCWh470pEeGUhSdcw2myMvdHuTscoSbLutYefnVRf85s0was1A7kvsXiMFu5E83WQqOPR/xc/86aKbfs0Wzttz27mAnUQ3EFe5OqZoHCQFyFZp1BRzooYmTVtBFIqLDALGPU6B6RNklEgOra6b/ooz+QtM2QaHbyJzVYTYkWwE2ctTdTrYES0uW3JZl+C39Ts32zQsdR3wQJY5PHzpivAvoYTXT0QNG7xATnyJAc6QJhLDSp9BPWtXa5fx3vPx5YrTdTep3dReMCZmQia9uC33Wn8awqk/NeHtvWMyElzLa3TJZA6CoSSREkrx5E9y/P2E+X2vx3lQM4Bd+e3vDSqyIaqv3Mo7G8vEsC7rqKhg1fdBN1l6oLCIzJLwvJYTXwoeVFJeIma2LwUxFc/Lyk6UPUSMB+tDLmySNSYn5/PR+4A6SxLu08fZX24C2Uj2TR601MIbvdNYYSEBMFWO9uETAlB2CcgTMKt2MpFB5SnRVVv4rZfRbgv2lHEoPLJUqY4kGlcfkEzh/BpHEKp3jAD6tY4SHVcYbXu/iPYH4kkY7sj0lHf0Ve9v+nfvLvAG/ACy/jxOvarEnoIn0v+bMvfz1DEu9yOxtqJ0+ejoQIqtQrPvjQP5RjybJ3zaga4JTgcUIoq2p1hUvncjarF0SAjqk18c6os20LmCpxnmL50k9YrirZ/nzeEY7bpJL2XIxbHcqJmTsqeErnIOamcuUDH7CHgITisn5eEOWLBXXrIffQnB+xCKXVIv/Pb5qEf3Xb1ZN/ubCdXBgQzBxbTtPBf2SwQs1V0Y0jMUxm9O0SRNAbga1gr2bry/MwCLseiItx2Vt0L+160BYKwlExFNtRZiRqoQgJhNxYMCt5DiyLbruD7cLsZ37DehGEBT6+H5rFPYXiizbQf7GLR/BToLTVbx8XAgHi2MLsbgV2EgLpVQApUF/z9tGvyWnInkJbBPjZ5LmryiHVVcn/V6knSxv/Raun/Gxc9uiOj29pzFxstTSxHYFmP9bX8tvBG4H/LA4Kil+uVnkEeJzN+2jla5Wt6q3oyl8gmPqOmod+bNm4cxsqJoOEG8Sm/HiBjRDSQgZTGnBHxHmrW19T6rmXMyMhUU/8CmPrd7Pg9os+64J32bJYRC12+TijTRg1BMLBEdfOOrOWNfS10F4KoA1bX+RP1JTAoLvxv2Qpp3mivH8lrd5qtrFDNuRB8HADmpy3dMt11iuiU9xaZQ61EumhJk8AGLYkYoEjNnuoCzImscAHmEVArZIdtLeD6khIi28ig== X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6eb045ae-5cb7-4bea-3391-08da0832c9e7 X-MS-Exchange-CrossTenant-AuthSource: DM6PR21MB1514.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Mar 2022 16:25:45.8216 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: mkT0jZx7Ru7C6rkvMwD+JnVn2oeWLXOkfGR44Zn5QUH5Lv7k+sI95cLck/lq0g+rCxkjare7PYTEofc7/+1lYQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR2101MB1796 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org PCI pass-thru devices in a Hyper-V VM are represented as a VMBus device and as a PCI device. The coherence of the VMbus device is set based on the VMbus node in ACPI, but the PCI device has no ACPI node and defaults to not hardware coherent. This results in extra software coherence management overhead on ARM64 when devices are hardware coherent. Fix this by propagating the coherence of the VMbus device to the PCI device. There's no effect on x86/x64 where devices are always hardware coherent. Signed-off-by: Michael Kelley --- drivers/pci/controller/pci-hyperv.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/drivers/pci/controller/pci-hyperv.c b/drivers/pci/controller/pci-hyperv.c index ae0bc2f..14276f5 100644 --- a/drivers/pci/controller/pci-hyperv.c +++ b/drivers/pci/controller/pci-hyperv.c @@ -49,6 +49,7 @@ #include #include #include +#include #include /* @@ -2142,9 +2143,9 @@ static void hv_pci_remove_slots(struct hv_pcibus_device *hbus) } /* - * Set NUMA node for the devices on the bus + * Set NUMA node and DMA coherence for the devices on the bus */ -static void hv_pci_assign_numa_node(struct hv_pcibus_device *hbus) +static void hv_pci_assign_properties(struct hv_pcibus_device *hbus) { struct pci_dev *dev; struct pci_bus *bus = hbus->bridge->bus; @@ -2167,6 +2168,14 @@ static void hv_pci_assign_numa_node(struct hv_pcibus_device *hbus) numa_map_to_online_node( hv_dev->desc.virtual_numa_node)); + /* + * On ARM64, propagate the DMA coherence from the VMbus device + * to the corresponding PCI device. On x86/x64, these calls + * have no effect because DMA is always hardware coherent. + */ + dev_set_dma_coherent(&dev->dev, + dev_is_dma_coherent(&hbus->hdev->device)); + put_pcichild(hv_dev); } } @@ -2191,7 +2200,7 @@ static int create_root_hv_pci_bus(struct hv_pcibus_device *hbus) return error; pci_lock_rescan_remove(); - hv_pci_assign_numa_node(hbus); + hv_pci_assign_properties(hbus); pci_bus_assign_resources(bridge->bus); hv_pci_assign_slots(hbus); pci_bus_add_devices(bridge->bus); @@ -2458,7 +2467,7 @@ static void pci_devices_present_work(struct work_struct *work) */ pci_lock_rescan_remove(); pci_scan_child_bus(hbus->bridge->bus); - hv_pci_assign_numa_node(hbus); + hv_pci_assign_properties(hbus); hv_pci_assign_slots(hbus); pci_unlock_rescan_remove(); break;