Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp3614820pxb; Tue, 19 Apr 2022 06:38:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwnA1BezjiXpzXxQ33Yw1H194yE9mBA1OaAKYc6F8Lw03MclRCSm4jU+gEt4wfF4qWRMu5w X-Received: by 2002:a17:906:3144:b0:6ce:de5d:5e3b with SMTP id e4-20020a170906314400b006cede5d5e3bmr13908791eje.689.1650375517225; Tue, 19 Apr 2022 06:38:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650375517; cv=none; d=google.com; s=arc-20160816; b=RVgOA+vjNeBokriq3UpOg7Ynr2NHkWilgnk7BUgtcc92fixRQrcnT/WR0gZRv1Tfju c0njwakyXib3Rc+CzRe4sRVe8PqxYyduksybZkj+Wyc8SO7M3kp7E/9UI6TucmrnhnS+ FO6BbdA/eYMkeMCNxB0F86Hg1TW9ihhk9w5DZ5LJcgoFhb8TNpZ9iYcomiCle6F9eC1C uIZgJtuMdA9yOgT8ED1xJHJAw+RSQUXycMRsZyF6apbvszpC5ye/BdYzVxN6yOY4Vqs3 SeUHM4FnST266TJfxBICK1e8DM8Ph4Q6DP6Ay+AVX5S0q8SE3lxzH3gXtUMqsGQ1lqfU RwEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=GMKadEHiTmr8sMWciGZpm/ApvS8oZyRT0h8LfXKkoVY=; b=IfgmWsFKqJHNb0vNpWwxDpoEpM2BmvMsrbJhGEIEIQQjriGqcnDScg+NvyjE+5yQ9D d3+S1Q7rMEONsO7WzM2XmZTGWa9lh4uvGAIAoleBA+01+9jwvCBpSWZ7Ui5LN1bSsCOi B7/hi9JZ6FpiTQRSdb0y+wgKVcufPpYkgby/C1poekB8PuDuZnYv4X+XWuoIGGUdpAuR Cv8xXNVjtoTraKEWPrC+SkyhLZHziLuuxkwoNVelLiXvM1MH8ZgtOHFM2sOvuxI/cOu+ KyKUl4ahpiYOEM7HbIW0K87O9LaPeXuqSoDSAPSlGjXu2rKk2IartRTcoAvDLOILPUjT lmKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lQdsl9ry; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id eb5-20020a0564020d0500b0041d6ea68688si9821458edb.325.2022.04.19.06.38.12; Tue, 19 Apr 2022 06:38:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lQdsl9ry; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239010AbiDRMcE (ORCPT + 99 others); Mon, 18 Apr 2022 08:32:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239527AbiDRM2b (ORCPT ); Mon, 18 Apr 2022 08:28:31 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F48E21832; Mon, 18 Apr 2022 05:22:02 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CFE7460EF4; Mon, 18 Apr 2022 12:22:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DBD28C385A8; Mon, 18 Apr 2022 12:22:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650284521; bh=yVc9gM0GvyeesUHCUbbJse0kel0eC1dgwpszLaGwkxs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lQdsl9ryeh/oQkayejIuYA+uzlHsI89DHEwKbjEeqTK5QWvCm9KdaBLsHw8r+OCAv wo9MXjBVgX7lHh4Vjb4/4kyJcUhb0tg1PW0bE58wHRAqapufP38WjR0QDI2qrYtUSH sWlzy4mB0dxyXrZcN2XPVtTerpDOokOnMo6A0SUE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael Kelley , Boqun Feng , Robin Murphy , Wei Liu , Sasha Levin Subject: [PATCH 5.17 143/219] PCI: hv: Propagate coherence from VMbus device to PCI device Date: Mon, 18 Apr 2022 14:11:52 +0200 Message-Id: <20220418121210.893992320@linuxfoundation.org> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220418121203.462784814@linuxfoundation.org> References: <20220418121203.462784814@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 From: Michael Kelley [ Upstream commit 8d21732475c637c7efcdb91dc927a4c594e97898 ] 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 Link: https://lore.kernel.org/r/1648138492-2191-3-git-send-email-mikelley@microsoft.com Signed-off-by: Wei Liu Signed-off-by: Sasha Levin --- 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 ae0bc2fee4ca..88b3b56d0522 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; -- 2.35.1