From patchwork Thu Mar 17 16:25:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael Kelley (LINUX)" X-Patchwork-Id: 12784274 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 C342DC43219 for ; Thu, 17 Mar 2022 16:25:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236541AbiCQQ1B (ORCPT ); Thu, 17 Mar 2022 12:27:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39940 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236531AbiCQQ1A (ORCPT ); Thu, 17 Mar 2022 12:27:00 -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 A0DEEDCE12; Thu, 17 Mar 2022 09:25:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WPQlamQyMttrK6h6t0nYqoFtP6ovKnVBJrLUBrMnVc53bwdKX1RAkKCPlL+QNsUfZLTZ9wrGq8mlYfzURthtLumzSuUfOcy46oOa9OhQnNfAT+oD/Dk1vXYh2ISBKrP7+yMZarLsshiZCziQ7sQp0S/0BPTHN++WxAXZiJffzi5Bl8xo4KkOA1qKWAlPZ/NV+DZsYlV4fHN0Azt5yOc3VdFOcm2GzrqkfZWg+oe7+E0g7R5ulGTF6QfVXRGThazdI0AXi34B8UwpO2jOQFWDQzxCEnJ3lHUHdVNH3X0PbG9YQhDHu1w79p1dUWf5QWCXg+l+kU3GY+v9Rt5zjnLKoA== 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=FbV9rfoUZ796KEiD1Kw8v0oYLENvKcTh3cuAOLMdDDoJMLAd+fxSaWsHDkG2FifO/xSzmTAERV8h34EiB6+0Ig6NE0u9E5v5zMHDj8ZmIphYv4uNMUd/oGd/4PTwtauXNZlL9NnhzFOP1o/kMNWA7x0FU2rD1LnK4apghsO/Is5bkgtX9t4tXjbkL/uzQpulelOTe9j84ofnklYrXdgfxtCHgFA6M2lyKlpH/1EqIXhh61Djfte9nPKJqym6yvFiHb57NaK78JtM8rx3vBnYXx/tEYGlzFyGqvAxdA255HElMLXjQ1uCAHjN4iSddGqFBbg6WCdG4rG4Wa/rGBqUiQ== 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=B1BTghpvhd/jlwFYvBqKmmBQkaqNeIWP8l8Gxg802E+Wlu2OfvI5WTG4LXNO4+5kUxedAe96XBkp8cxoRM/PPWwtoPypGZgsmMm1sWDSz+U1ZdjmSHA7KugtUUBm2Iq7fxV0yFJHciLzDl/+Z1kpe9h0dPsfvxmGhcPxnMSzaZg= 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:42 +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:42 +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 1/4 RESEND] ACPI: scan: Export acpi_get_dma_attr() Date: Thu, 17 Mar 2022 09:25:08 -0700 Message-Id: <1647534311-2349-2-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: a0c88254-8563-4cbd-ea44-08da0832c7ce 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: Erzoh7rUUTtIXeOUen8PzzUEDQ034Hic6w+/wbcTZezivSugEPjDY9u+JxHSUbo/Hfdg7YAruP2Mwxa3g2sbw6iUtI8u/RMzqOT8nfaLW6eqisIWPjGXZYaWmEDywDGUOsKz2Gqsn9ApdTos5plnRar2oVbtm6vCUpSIR6SjHYSFQw7WtvAM56AGHsIH4fHAclZc5mxnW9X660lqCfbZ/0ttCAunTorCWJwE9A+5xvHsclE1quOj/3tJ3RTYPMlMIVFmqsxIShJ0r7ctFr+oKH+Bbyj02sWZQvwYOYDHL90bk+MLqH6Sqmgj8CPXLorVgtWFutiMMhcqvDnFwC5lGri59IFg7ypZCOKogSPjs3zrGiQsoel4YoioCdWqGjHD5ID3Z0Qd9UAXaJyK0egMY03jwEUVX0Uv3rpqzLDL06XbfUkC3LAAh9EqWU8HXAbU36XjtJVA7VWZZ69zSjmVqN1JBhPiQVMIsZmjM77swe+F21p8JvxtOaoME9WpT7vRTOSCqit8t+bcKeqbIfPUDEf15cz7S4UoMiq1Zji+H4jrAG3XC4dmCgrtmqv6RYnKQtPxltVZMdd5oQvW1t8yz7RvhRM6UYyl34tR9zahn58fBWM4Rt9AC9WhMNeV99WKCFrVfpwWqTtYErgt2OcjnQTqiDSE/igxfW4xAWwFbVo9NQ3kuyEpuo2xY59GXJ+YBSYPqOXzwIuJGxtey4FV9xlbjIQXfgH3cMvvW/LpILRX7d3uQrKOqTsB3jlk6uwcBdeK4PMdRtfGHXnOy31EUw== 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: a056XUFSE9rAhiPxMYPpd+lAiKlS6YB2qxUBDkX3dliwWPgR7jl8FjmvKmSGWA8V8QLeD1MF9hvU4gebubwv/MM16eP85tdUSTixrX/N87cxCrZBzRUhKetQz1bld/8sCWGZMGVM+DSEWBP1u3s6hVkGWq9e9sdegUDg2rZhOzXp462siZ3GN8kndKyfvc/rly5oPGfXns55pOeNWC7CYS7lN165Jrxo5QEv4rblNShtL+yMb4yp+mVaCDaYnxZHgD3LI1/E3Gdys0gkdPv1hsp2TDOEni6jQhZsGwTm+dRYuAQzLm2jUxvHoDDM7doHdOCWpI2jXDSH8rbYZaYFcW+ZgI4/m3rWqSQ6PtlcMppGmY6nnLud7F4aUT/wMoqRnqaq7suFue+Rm3smRo9In3AAC4wSMeEyc8FKfcUWUIwjzpWoh6iqQ6voj3n/GT7mTq5ymR2KfnA3Bz5DdYpNs/LNW9dc6GrOORosaOIbO2le4NBzWw1haTe9Gp49epLKRl6lqgJTYc29s97/QmGcDbv07rsE72iC45Avqn4Ewt6OXQIh5XXJoRlMMbY+9m2PNv4LvbLukhaR0qP74iGKXIa9wqPGZ03y+cpmHacQQnRTCze8lWkU9mwIew3mBVQDMFhRqZLQQkoX+YJlA4BU/vReBDpJkOgpZ/RNnUW0MG2SkGZQmc6kamtK1uZji4nPLHur4qS+hQHYZdseeMTlFYceY/Ck6WcXvQT7SGEyjVsb5seDEs1jJHnBguoCgK7abXg2vkppOLvT3FOtpJ2VImOx1qF3R0xLLhgGCFiQdNAoLlppWdAKhZB968MvLpiL/PmhuuQhE2jRwJDWLancKj1ECUkBoHlMqPMKqUdoJaaKVGXRBJjLKtpxr36Q8gZwcdpLXzBpfD9nsDj5Ih/UssGcrcjUHWYDHm5K8/nS9q2pGru1zBkkBbHk6MIEEfnXQuQdiRIvERRu2GhCfRjV3gXzT3BublKpWtKCcS8HDtuvIFJXKEyZBKKJaZobrNgHbuGlr5YNTg7cnjcrw4hRSHSNiUV7vrd8sDxxZdE/2wyrYAkEAQEIMqZmATHoN82qiSLj7BLPdD2VvqczPlEF90jXHT1RdxyvV2ItNzVLHaTbm3yyVhAfqtiF91advTXND1FUoVGrzi4g4SL60+QZpM+5C5/4lXJELDxnJm5paoQdcVNxs+VtO28F+kCZfd7f+dkz18M6+N8zDXZHHk4pQp0czTio2jgjZucH75FelsnIInLFNBe+aAuJ0tEK5So8PgAXn80RPWgXcnOdxxgilvksjhPe+br14p+hkcVLTmAWhk/lpTOU1ROIzpeGFn5Ctba0LvMk9A5Pa9ogP5kH7m3gh4ms5KLLHQm3FBIQVDpngCw7PNJo/LG5calZ95QY33MqeheiNfppYs+531vAqenZSAoOssQOG8eLPqVs/sSRHKEdhIy9JUung5/bUGLhP2nxCwUU0Dz03t80zK6d2w== X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: a0c88254-8563-4cbd-ea44-08da0832c7ce 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:42.1309 (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: z+i68gO6DoG59CtUFAk6SPRjZB3HDrD7KYiU4wNZhB8NhaFSX5TWA6fxllkyVEiiz/Aeud/0PoKlfdiaeyMPPw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR2101MB1796 Precedence: bulk List-ID: X-Mailing-List: linux-pci@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 (LINUX)" X-Patchwork-Id: 12784275 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 8E9D7C4332F for ; Thu, 17 Mar 2022 16:25:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236566AbiCQQ1I (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-pci@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:25:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael Kelley (LINUX)" X-Patchwork-Id: 12784276 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 E918AC4321E for ; Thu, 17 Mar 2022 16:25:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236569AbiCQQ1J (ORCPT ); Thu, 17 Mar 2022 12:27:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40438 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236555AbiCQQ1I (ORCPT ); Thu, 17 Mar 2022 12:27:08 -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 1DAC3E09AA; Thu, 17 Mar 2022 09:25:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EAmeEfozy1ICrxUzvNM1+D9t8rxdPI+QTazfes5mpWTuBnRHsl5nhzb3FbkzlBgH6b16HHWcjPpADRmCDPdWpi6kB5efpbdxX+6euT5rSA/8DcxrwTSpmZy21OW4wIkwk+mAauIAAotVrrWyi6FiL3/+etYKIL5RcvJbomsDgNwEQ2cGwuTRDhqFd1tkK2tWTsVkv9Y823LF0RFRa2c/fsO58YV2bJQ9xJ5l0nA6A/gG3XBvZkeb3jmdw8nkcGCAoDOVypPI7eiKxjYxGhGbEMCXjbpSrFB4P4yRvofq0ZJjDYTS2W2jFqH2s1qdz4l9O/Ec80pW9hBnlDgESGQ91A== 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=JCEPgHJkxpVaKLCdLVHFBHWBModwZS5KxkoiA5bT6Df5/Kt7EhOHE3UeZheXUBT02BygFjNJEJ5XzE0r9WbBvF8WJRTIEie9YntIghkB3Mf9frdhFetOtNAXIl5qCuHx0pe6EUnU1Xfg3o6FocgtoOY2YF1Edcyjbh66CbCzckiL1c6P0gT2X8wfLb7oQGKnITZLl09zVMYyxlVAK19Cpf8eIOMfpZ8Qwd0Lks79U/gfANTIck+kBaXYCIgCI1St3WrR7Z8N6W/SDRUo4DKIkEVUq/o3nG/Ltlr+hHjck/iAlvQ+aq/Ld/Ei6hw19tESL+WGRXbtTeGfOyGQMYAjqA== 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=Ox6SoDTR6ZwroRn7UIOMjYKCETmwMeANcUdl7gOhAUTMEbf1BYhsRurRu+rDc811okNdBZVP5i5Nf8zKZGhQgigCVlA4qwbvNMOBXRduU6W8fvwpYvpAVzjaQ+WYn/uJuk9+9pFHJbx6a8yliLcy1XDToLONIUjXGsSJimRqtd4= 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:44 +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:44 +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 3/4 RESEND] Drivers: hv: vmbus: Propagate VMbus coherence to each VMbus device Date: Thu, 17 Mar 2022 09:25:10 -0700 Message-Id: <1647534311-2349-4-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: 03e43920-5040-4f7f-f532-08da0832c933 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: 9x7i7ZIcI1bM/9NhjjosCWUOYKMju4ofDVqyu0/7B2LagKOoGW4Onj7COHZgbXSejtDqpZyR/l1T51d1+BNYpAhShiZ7RAv29zlBsLOEGg2n1qBJyHQr+4oHQaBcO/43h7jI4hTO6S6ipj6mofU7zfzrgJHJRGicWC9TB3n3LWOyQPndIbA43k2zfM2d3hf3yat2uRSPZXjCflZriJdjGu9WpS6FZ5HbRA8LkhjHNjmD2xEaroxdQlINJ4UwDWwAJrC01yWALSfgqHgc7ss+FN5d8fHO+9Teey/+slAFtPGO1N8dHku/CcRwMEQuotVQXqzDaiJ0Oa21IsFiizAeanNRB46ZtiHfriFUEambnYJrbkSy0N7xibsdpNTpWdxwo4lceJkroRoR5LXVKN+Bi5xY2DRgoj14lU7hoTfbTQaRZaslmwYAioWHNwtY5a151bmkDoENntLAp4wqFaDG4r8ffA8ipN27Ly9w4Bz2M9yzV5GEhkYlfSjb5mapeQWcYjqBEFbwVtxhd48xBVmS+G6lwgWHUvrXYd53R27AmCre0ieQ+tPbiKukINkDp9YHTFCfnr6PbiPJZFd/aBonI6ufLKujOrVKVZXYyvvANYDxwAR/mrfGZBYQwPr6i9wNuvUPjzeMtzlWgsX/o7zHBDx1/jC9JqXMAkU5DYFOD4CqmSkNs0PPo9ibZ2iRagne2PddUO0jYLg5D4ALvGepm3kjtQQ1AzmndXE2tBDDBdPDW+yHfqdvnsK3HsjJq+KZUA4UvcXtU1/DN/2DWu+OyA== 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: a8i393B9wI3gEpiiJDMkqrXXrbo9yH5qmTdAf5SF+W5VBQpQcwctoyyBar3QoRHQrJ//ff82BeJEBnb5XYqN46XiWs4QiddR+A9Ft9BRj41iX9Yo5S4F5fVToM4bSDVlGaCXz9Gfl4m/NuK2qqJVIxU1y7PKFX69Y8GLPxbMfgqc/ucY/Es2Kf6UlAd0dzgb0aTQijX8ZyOc/ir40uHV1X+SGySmZDM9596t3wK40fX55qseGpqDx6K1UZDJAYVIwhGS0eOED1+OtKc6mN0n2Kld/MhwoNcefKkU6u8OXs21KmNB48mV2anlCBxuYYaUGvr19XO4NiZaAHXWVs9rtyR7rEDqjusA5q0EZOk6PD0cIioPlOZmYvrMnJS4+kqDniIPNKLLfRwe9nMW2KrV3dzZtzvuBABQY2qRQIlpW7Rz1kq/eB1z6dHA0YzZ+y1YnznLcEZH8THHtYN8T2KMyKSZ6slGM8ky/dG8BS91cJNJ+9hCvV8FFfKshytVMnf+hLGw1Iju7ASOKdsJxTwjhDBZH3CA+dteCcCNcanVTs2I1dijgRK+QNf5dnRqFV7jmmXK8W9W/FEXIt23g4OnoFOd/OtDps+73SLQuKa65Sq8d5alY1Hhf0hgCb+YZIg6UL5Aczcr3eKD33g4iyuFhz79jeVhbFxmSYtXF0QRFGDVXt4NuFDUZm58pdA6rlo/YL98cRtXWU4EOXyJ3fykALcW9rZa1a1lS4s+tLhW9InXPeEyOf2ZFhBWjUBz4SOxyX83g4PYMuBBODxAWFfU8Uulj43hmgdCmy4LtwI60+tuPTYxJ/lEvrGJ2iFt0Srt2kLd02jzSeJq17jtFJqau0SNK7t8cBq36QEIppCC6sOJiiLZtXdeU4NJVSI5h8EjtN7rDTmJFlEUEO9XvnVw60GxHdo24jepFonbV3Sei3zwwTEOhqLJn2We1Gw3n3eunGD0yia60MWrD+zCw41ixNfqd7G5Ds0t4LRr0q1mAG1b87cicolyNp1q7tCsixpm7FlxCwBUfPo/uQGKyhJFbudznyENHVHj2frKAtIXBraGEV06SGKLWM6e1pf6381dBoqgc5vedk0D7Ss8XnX6dNPM26tWmMdyRDGa9U9fqV9nX7h2eQe68zHu2bCFbDwB7XUqajQL8aV714gFUoWbGjfv9zeIgntnHTmyyVaJTwml0HRToiRINtCK6UhT7lMbY99zT91QaEZXG9vRs6fS46mjM3z+BbQqq4poj4UU85ypaMHw8cJw6v7ZyND+xH/w6HxuACaPjYLDjdanOOgcnAMhK8QSQ29vkLairFeC2hmTVyJs9rjmQ7h83sVETwkC+otP2cIz6byPOYDkOIPWk2THIEkybMBTJiW8/1aykhimaKi7b94jAO04bmvLBbhFKRS7WkQW6HDzmPsvftSxd24HJ+YJ4jGWoP9JGJsQuca/oKk3RxzFtuh8JdEA/7FeVjpLgkZoAU7R4V+ZEygpOg== X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 03e43920-5040-4f7f-f532-08da0832c933 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:44.4708 (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: 9KsrKkWFiu3a4jdU8kI380/s4lM/vWB/mIUIp4aia9PJvtlZkBYeXmsM/RStytXY5VKtvgrImeqsB8MJsXiarQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR2101MB1796 Precedence: bulk List-ID: X-Mailing-List: linux-pci@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 (LINUX)" X-Patchwork-Id: 12784277 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 B366DC433FE for ; Thu, 17 Mar 2022 16:25:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236576AbiCQQ1L (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-pci@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;