Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp2060264pxb; Fri, 25 Mar 2022 10:22:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzULU33os4SUISY2v4aSos5uE63RXr1LEE/0Z+E2TV8jSASsBK8+osrP/cN5R3WUN2k89Sw X-Received: by 2002:a05:6a00:1687:b0:4e1:45d:3ded with SMTP id k7-20020a056a00168700b004e1045d3dedmr10852111pfc.0.1648228969819; Fri, 25 Mar 2022 10:22:49 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1648228969; cv=pass; d=google.com; s=arc-20160816; b=H3s9LUWimhJypLgXWZ8LaO4FkHj0HUoT06310r49FixA3tpgTLmX3GFxodm/2L0hez JLuD+jUt2pFafohwIf40A1Mo2f4UZEFv0IRo8Xz+xQIE4hTWW2VLuvDJU+o/PfKwZpZU NZCPRJdP5MheBDzgsRy3DkouRpbbmlC1QA+4uHA2yaxoZEj7g53+TPA2/G3q53d+DRfW afLwoPw3X/z8U7+pDUzQqKA4Z2C1Dg/qYO+Q07G5xe1rl3GvO6BkTDuNnfnr4E8OYaoL /5QKFFOm9NTEYqTv1JmU86N09XWClDoTwZS/bLYJ9XVcPa2F6CB4ws30ZIWbVACSo7vt XX/g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=cE74jggk/LMNOtLMIV90q30xNMRXi88xMxhkXHWxUYQ=; b=lxUfTjjanS3VeYyuRlwpTCFyexXMgQiBlsI3/hwp734OZoP2KqJVN0ZA7dLMP42KAx zup8tX9saBOKkO37XRKE3Sl4nYabA246+7NBHmWDr8PvoTSyiNriBnGF5ZwImGGUGj8g gbfl9Z+/iMOuBD6Uwnqa4YF1WEth7s/FAfm5r3n7tq9ewNAcxCzYQDt3vwYIUGqKXHlm yXzYCMihfbjzHhNw1UhH7w0pHG1NSkPA3CHFkPpAdZDPda8KHupX7VGTSm8tT/3xCiWG j/DQi+nqIbxzQmqrc7MEl0TVp6jx3wDZ1L4EJkjqOd6PiqyWgrqfTYIheRUCF7Q5t4ym LKEw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector2 header.b=V+cWx5qO; arc=pass (i=1 spf=pass spfdomain=microsoft.com dkim=pass dkdomain=microsoft.com dmarc=pass fromdomain=microsoft.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id d10-20020a056a00244a00b004fae310a83csi3492519pfj.151.2022.03.25.10.22.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Mar 2022 10:22:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector2 header.b=V+cWx5qO; arc=pass (i=1 spf=pass spfdomain=microsoft.com dkim=pass dkdomain=microsoft.com dmarc=pass fromdomain=microsoft.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 060E8EF7B3; Fri, 25 Mar 2022 10:18:46 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351634AbiCXQQz (ORCPT + 99 others); Thu, 24 Mar 2022 12:16:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51562 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351600AbiCXQQq (ORCPT ); Thu, 24 Mar 2022 12:16:46 -0400 Received: from na01-obe.outbound.protection.outlook.com (mail-eus2azon11021025.outbound.protection.outlook.com [52.101.57.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 350F049FB7; Thu, 24 Mar 2022 09:15:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SA6TRA0+bwF6JundqA4AoeSWROD5COFICNGO65Jomd+ffpY47A4LwXsIkLHaGQ6sj02uvQ49dtYFOIjoSWOsLmh9pc7GYNIvSus1aOYPS0/LHurndk+H3ZuSjvbDrisJIVu7F7H8Xa6tbOU33YDPYhmr/KpadGox2S7fNQkiRnxYtBpnGmXaHeH5NK4NAeje1BpcwxwkglYn1tsAKoYgmhQUIOLCIWp/IK3uJyvnwZ03UC9Ld21HD09leezGbtE2ik+ZnoEkQN278/D1fzSJhQFqjsEZU+aNH0xwt9eUH0foPD7uW06B6l/c/nkY/QcT+c+c5K3+3+5GzzQ9P9+1zw== 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=cE74jggk/LMNOtLMIV90q30xNMRXi88xMxhkXHWxUYQ=; b=ZsAh2nqwQa7J3hvDY3eHx7dRpP5cBTKZbFtTlmljZqPVVU1x3DaWsr2Ab//sO8FX1xx0jCOvtdeSxG6KL1LabHDt8WNI/B8/75z36HWS8b88ZUHNW8blTSBdr5X/76OUGgfx9ICunFQweZSn9gTah/JYTRCXl96uPXhFm5vHiaGp/R9eA+dhsTVwcFzIeW5/prA8OVI+R37bnFZveN+zej5KmntA/n0ewbHRl3vVWv40UYdqdQm2B+y8GrODEoUrCTTF3QNUdT6O5vzzOtAoLitCyz6Rog5MASL5wyWvgwo59hDHdmJFHZOT/0yD/RiGgh0g6RiwUJbw5ybuTshMSQ== 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=cE74jggk/LMNOtLMIV90q30xNMRXi88xMxhkXHWxUYQ=; b=V+cWx5qO5suFZFK50EN++8iQeiyjkLEtONRwvC4+2cCuc0VJwH7tcYtgROYUmgy8fVIIXrduIxSmj+NgoM33a1LoFVKLoRhEjH/uZKyf+A1mYv7gXHDzGun+FH/BXJkZS3Z0V/UbjnegUQlJ9DC0hVt/8/5rCmSEnUXoPjO/NzA= 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 BY5PR21MB1411.namprd21.prod.outlook.com (2603:10b6:a03:238::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5123.10; Thu, 24 Mar 2022 16:15:11 +0000 Received: from DM6PR21MB1514.namprd21.prod.outlook.com ([fe80::f8aa:99ff:9265:bb6b]) by DM6PR21MB1514.namprd21.prod.outlook.com ([fe80::f8aa:99ff:9265:bb6b%4]) with mapi id 15.20.5123.010; Thu, 24 Mar 2022 16:15:11 +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 v3 2/2] PCI: hv: Propagate coherence from VMbus device to PCI device Date: Thu, 24 Mar 2022 09:14:52 -0700 Message-Id: <1648138492-2191-3-git-send-email-mikelley@microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1648138492-2191-1-git-send-email-mikelley@microsoft.com> References: <1648138492-2191-1-git-send-email-mikelley@microsoft.com> Content-Type: text/plain X-ClientProxiedBy: MW4PR04CA0253.namprd04.prod.outlook.com (2603:10b6:303:88::18) 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: bb3c36de-932b-4d15-c6ac-08da0db17900 X-MS-TrafficTypeDiagnostic: BY5PR21MB1411: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: J5U/FY2T2iJarJzLTbno/tIe+WUDannNPb10hCTyRBG7RR7vUCaotv6LVcSDuDMlGEQxyn2MMuxrxT8cKsBhQ1lYeHKpPoLswBoGaIG5aEPB/2skxdbG9MG4/8OoJSR+uhQ9Yj+oroIMHq5DltWaZamYNNe35aWYTA/S5NM3pS7BMbY6Yc3F05BtyHsbfjZYYo7sA6hwvDXhZNeMNGoyEvte2IWEigDqe7L7ID35HMSHoIT58rDs9LBBws4oBCw0qSTseHn9q/I21bQcOAcgYfP1OZndjCw4yXOqnIxw/M+udt7leLkuMBeb6kwtfAJTubyQWvdhbGmdF7O0A6FpLZ3kRqHnE6KnK0wPZpadO3HSTgNwNDouYQyh1C4xj5zoJbWpCk1H96FktUy/RSpaLGZx0i06hPOLFs2JzTE5xxE9m7F14sOZ0ZHLJFhNlnNLYmnjS70c9A6u7qFC+CAO3+BDGfpSMR0lIrvorNT+o5h7kER3VJJNdqnMBYoGzOkEjd2CaipUpyM36Dw8kO4/Ey/Yke1LRcMenpY6XbSAWA9TWkzAfW4CwugHg1SlOvmIwBng3PYFrPgqhmgOs+cf+9PI3lZGrUMlXAgLrYrHYeOZTz/fdtF+NmI6Gzrk4VwYeuAZHfxMQdrnlL0tXV2em4HsS39H7d2ZPRuwbaRDzYuITVTMCLzNDyo0fCEyC/iZxDtuUEcWgkZHUVFcRpyAGBCvose+6dScgoR0cYC6sh6beAetIMzbMjer2BYkik8/SH25SCN3hIJ+8UdvPqqB+g== 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)(2906002)(6666004)(6506007)(52116002)(2616005)(6512007)(26005)(107886003)(186003)(8676002)(4326008)(10290500003)(6486002)(508600001)(66476007)(66556008)(86362001)(316002)(66946007)(36756003)(921005)(82950400001)(8936002)(7416002)(82960400001)(5660300002)(38100700002)(38350700002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?sYSPpkHkc2hBJ9xM1eTcE1luKHO0LMWb0tgRiV7cAk3psFLu2oPTz2pI5ikD?= =?us-ascii?Q?+BEICoj4LT5rh18iZQ6WCr7uDJVH9QH7dPTEITny0AmZTA80N+p1bPWx/zh3?= =?us-ascii?Q?KhQLrzUH6MjiC9yVD9OI4gatBFYegHPTXuwWjlr5TchFYCOlwX9BNCASk6x+?= =?us-ascii?Q?6AnUNVOc3QAnsLDOWG/NIykrEqAI0jsuMEEFDS576tdlke1fLVHw3u59R4ED?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WfWWI/h12dLjfb5QNYae?= =?us-ascii?Q?rqXu6mcB3wITDGiJcOhN+cRFEpBuMyeww4mihfvrNBtdFaHi72CIrDrIUkMY?= =?us-ascii?Q?USYx2Y9Z3rD63RGK4YKFSA/RiZ8/tm/sQt3tof++OTKd7cM8M9GBo19hX/Vd?= =?us-ascii?Q?zYRxuvesB6qhHMEXDVqkbjxj9e+pQDMRKcLsxXYxaYTtibuSRa1bEG0kgiOQ?= =?us-ascii?Q?VHZbHtJlM/MTJ47t6IryLbasi+w5rS1ZhfiV0fkDxvNQFEmA3NtfTdHeceil?= =?us-ascii?Q?z5rhxI9oXPgSe12n0Us7crXtxKxdDb9uFDVFdj8w6h3tZx8smlFhdm90Hq3D?= =?us-ascii?Q?rS1lHWNiO2WLhdT5iREFpArW8mlaSKMFOWBUyBEio8SIxeIrfJzYFPzjhMFp?= =?us-ascii?Q?LWRv5mzGhvni6PGdCHFVxf+dN6Yy74ZEmmDJVZ3iE8/WO6cdD6keNyVzdhv4?= =?us-ascii?Q?5Qw1uLH7jKFYzs63d8cRXYjBYyosoylTjFQw5xIA1aJfc/9KP6NfbR1iA8UG?= =?us-ascii?Q?MvHlp+DAXIvPRMeG0Pixjd596xAeencziQCjJ7t9q0Njv/gn+Tig5gxKrhcZ?= =?us-ascii?Q?UVSd+d8tKK0IQkLzaPuzbMSJxGY7rsHbxc/8IqyV+Xcmc8hs8ABEFKaY4F6H?= =?us-ascii?Q?hVzACm5z4soPzEHhitT9Jj1StPu1u6Q=3D?= X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: bb3c36de-932b-4d15-c6ac-08da0db17900 X-MS-Exchange-CrossTenant-AuthSource: DM6PR21MB1514.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Mar 2022 16:15:11.8212 (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: IxVHIs606MZYdd07fL9rlXN+HFZ3VzhcM7pW3kurNfyN+HFPUImUuqiQYsGX54PH4ZsdyXpzqJmm+BX8U8umzg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR21MB1411 X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 setting up the PCI host bus so that normal PCI mechanisms will propagate 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 Acked-by: Boqun Feng Acked-by: Robin Murphy --- drivers/pci/controller/pci-hyperv.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/pci/controller/pci-hyperv.c b/drivers/pci/controller/pci-hyperv.c index ae0bc2f..88b3b56 100644 --- a/drivers/pci/controller/pci-hyperv.c +++ b/drivers/pci/controller/pci-hyperv.c @@ -3404,6 +3404,15 @@ static int hv_pci_probe(struct hv_device *hdev, hbus->bridge->domain_nr = dom; #ifdef CONFIG_X86 hbus->sysdata.domain = dom; +#elif defined(CONFIG_ARM64) + /* + * Set the PCI bus parent to be the corresponding VMbus + * device. Then the VMbus device will be assigned as the + * ACPI companion in pcibios_root_bridge_prepare() and + * pci_dma_configure() will propagate device coherence + * information to devices created on the bus. + */ + hbus->sysdata.parent = hdev->device.parent; #endif hbus->hdev = hdev; -- 1.8.3.1