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 lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8D53BD49207 for ; Mon, 18 Nov 2024 16:06:11 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.839400.1255199 (Exim 4.92) (envelope-from ) id 1tD4Fj-0000pq-Mu; Mon, 18 Nov 2024 16:05:27 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 839400.1255199; Mon, 18 Nov 2024 16:05:27 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tD4Fj-0000pj-JN; Mon, 18 Nov 2024 16:05:27 +0000 Received: by outflank-mailman (input) for mailman id 839400; Mon, 18 Nov 2024 16:05:26 +0000 Received: from mail.xenproject.org ([104.130.215.37]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tD4Fi-0000pd-7g for xen-devel@lists.xenproject.org; Mon, 18 Nov 2024 16:05:26 +0000 Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.96) (envelope-from ) id 1tD4Fe-00BId7-02; Mon, 18 Nov 2024 16:05:22 +0000 Received: from lfbn-gre-1-248-145.w90-112.abo.wanadoo.fr ([90.112.205.145] helo=l14) by xenbits.xenproject.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tD4Fd-00FG94-2H; Mon, 18 Nov 2024 16:05:21 +0000 X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xenproject.org; s=20200302mail; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date; bh=hOPsZNwuk5Of7mPpSe/MIV1efYXeimkHvzOur3w1rP4=; b=OQiXcgEPsvbrw034DEWEss4y7z PawOfKRjrWzYq6BaK+BXlU+cGyDwlKKR1CVR9AtldNz1qsLTncbQCyiZX/De9bEQlExXt9YXDW33V bOh386Z1BUnzZvOH6aEKLY1T4V9dhWVuF7NMfclqt3MZNvD+5hbN8DNyuwdjrZSUgS8s=; Date: Mon, 18 Nov 2024 17:05:18 +0100 From: Anthony PERARD To: Jiqian Chen , "Michael S. Tsirkin" , Marcel Apfelbaum Cc: Stefano Stabellini , Paul Durrant , "Edgar E . Iglesias" , qemu-devel@nongnu.org, xen-devel@lists.xenproject.org, Stewart Hildebrand , Huang Rui Subject: Re: [QEMU PATCH v10] xen/passthrough: use gsi to map pirq when dom0 is PVH Message-ID: References: <20241106061418.3655304-1-Jiqian.Chen@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20241106061418.3655304-1-Jiqian.Chen@amd.com> On Wed, Nov 06, 2024 at 02:14:18PM +0800, Jiqian Chen wrote: > In PVH dom0, when passthrough a device to domU, QEMU code > xen_pt_realize->xc_physdev_map_pirq wants to use gsi, but in current codes > the gsi number is got from file /sys/bus/pci/devices//irq, that is > wrong, because irq is not equal with gsi, they are in different spaces, so > pirq mapping fails. > > To solve above problem, use new interface of Xen, xc_pcidev_get_gsi to get > gsi and use xc_physdev_map_pirq_gsi to map pirq when dom0 is PVH. > > Signed-off-by: Jiqian Chen > Signed-off-by: Huang Rui > Signed-off-by: Jiqian Chen Acked-by: Anthony PERARD But, this following change probably needs an ack from PCI maintaners, CCed. > diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h > index eb26cac81098..07805aa8a5f3 100644 > --- a/include/hw/pci/pci.h > +++ b/include/hw/pci/pci.h > @@ -23,6 +23,10 @@ extern bool pci_available; > #define PCI_SLOT_MAX 32 > #define PCI_FUNC_MAX 8 > > +#define PCI_SBDF(seg, bus, dev, func) \ > + ((((uint32_t)(seg)) << 16) | \ > + (PCI_BUILD_BDF(bus, PCI_DEVFN(dev, func)))) > + > /* Class, Vendor and Device IDs from Linux's pci_ids.h */ > #include "hw/pci/pci_ids.h" Thanks, -- Anthony PERARD