From nobody Fri Nov 29 18:26:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1632986053; cv=none; d=zohomail.com; s=zohoarc; b=fHDBAeJEpzGc2eqgMu55+bXRDgxvpnm3LcKQaHFR91/By0MfpO63hnGyju/XUzWrLPId1ouPwYNf/9/Tqku7gi/xJOUizQRpRBPJN2XXaCEvyr+D0A8JYxgTp4bSKh+P2/2wiZoyIq7uJu1XTm/uwKAyxlJyFR+PiQQ8nnw1l90= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1632986053; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=hrW151Pn3PyP3za7zVLCbht2FcxzTewAzo6dwWGEqVU=; b=UPQ8xMCIDQSwMnhDHoc0sjEnqVeKmV7/fiCFLnghyHFDKh2r0kyy4aB6UPehCuwRGDrPmoHM7VVpe7cA7ySN+z6abhKhjWNIQK/0rCdI69mgf20t9fPLUA5Z0jEWIP06N7ziS+vWq9ysoswRKM/cB9xtUYQmKUYdLa2u+GAFQ48= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 163298605370764.38944729552213; Thu, 30 Sep 2021 00:14:13 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.199403.353471 (Exim 4.92) (envelope-from ) id 1mVqGS-0006Fa-Pg; Thu, 30 Sep 2021 07:13:56 +0000 Received: by outflank-mailman (output) from mailman id 199403.353471; Thu, 30 Sep 2021 07:13:56 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mVqGS-0006FJ-Lx; Thu, 30 Sep 2021 07:13:56 +0000 Received: by outflank-mailman (input) for mailman id 199403; Thu, 30 Sep 2021 07:13:55 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mVqGR-0004B3-A1 for xen-devel@lists.xenproject.org; Thu, 30 Sep 2021 07:13:55 +0000 Received: from mail-lf1-x131.google.com (unknown [2a00:1450:4864:20::131]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 217905a7-2aad-4d67-baac-a2ec09057c84; Thu, 30 Sep 2021 07:13:33 +0000 (UTC) Received: by mail-lf1-x131.google.com with SMTP id y26so21269232lfa.11 for ; Thu, 30 Sep 2021 00:13:33 -0700 (PDT) Received: from localhost.localdomain (host-176-36-245-220.b024.la.net.ua. [176.36.245.220]) by smtp.gmail.com with ESMTPSA id y3sm267835lfh.132.2021.09.30.00.13.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Sep 2021 00:13:32 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version 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" X-Inumbo-ID: 217905a7-2aad-4d67-baac-a2ec09057c84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=hrW151Pn3PyP3za7zVLCbht2FcxzTewAzo6dwWGEqVU=; b=KyfuI8SonaSWtz6zuzp494aO7A2NeB2DFx5t5TBA7HLhBzmr0zEhamJF8rtXINz02Z g7xwVq2gx1xENguCWdaZgT02OwqEMKR2hAYJyR5m7BAD4TdoQyQ0IHW7QyeFrniw9C+L JgjGmpfvodDgYdTg4KrllQ5NlrOlx3qJmPCcyo0Kd1NEvdetdWK4lpllURpPP5K776wD vWo/Yf6W6UHHyTFrlXrB773n5JK+LZchpgueXLVT1EFMqt6C8zBntZDl/osxmcjNtbv4 weFFl2qpX6aHOjjd2FZ7RIB8UblXwgA6GqOoCQxmm/AiwlMhgia0q9IEWQucM35t3ZgG WejA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=hrW151Pn3PyP3za7zVLCbht2FcxzTewAzo6dwWGEqVU=; b=JViZynxMC0BTguzu8kV5IGAWamnM+x1n6tDMZzziKKX0oZh54twgo/QMf47j2G7maJ f8D8jWXtV0mndVWn6crjMPZDnd9K9Q8YE2WZPpmHqyNY/TzmmUbXUM8Pyo1GywQBvVtY tFf9NjEsfkwqlN/wObcOeDCwRUHK70ONAui/afSBpVN10kSDh/v+b3FftOwttPonNwIp azPnrDRHuLUm6XMgfIcpT+XfFQq/fe4MikizVVScvgK/jraF4f3tSGCz7ZxlIkdvAf/r VPMNkncdMkMkvWEwJKFnxGyM7gjHPUcfLdIxvH0EzppxgzTOcXLd7WfpzC7XaTY1hTtk jgrg== X-Gm-Message-State: AOAM531SqzYXEIdByPbVtxNE93/K5U9xgUJEWUAbNOdo2ieSBPGtyA1W pVgEOPhogo/01silz1c2+3RQoBpWRfg= X-Google-Smtp-Source: ABdhPJzt9ZlZEBCnM5k9rLLU/Zi6Qrtzj23d7bzRA4B8Hmo0JcAyQKiyusR2vxgD//ruRm6yTB+myQ== X-Received: by 2002:a2e:9410:: with SMTP id i16mr4390219ljh.134.1632986012562; Thu, 30 Sep 2021 00:13:32 -0700 (PDT) From: Oleksandr Andrushchenko To: xen-devel@lists.xenproject.org Cc: julien@xen.org, sstabellini@kernel.org, oleksandr_tyshchenko@epam.com, volodymyr_babchuk@epam.com, Artem_Mygaiev@epam.com, roger.pau@citrix.com, bertrand.marquis@arm.com, rahul.singh@arm.com, Oleksandr Andrushchenko Subject: [PATCH v3 05/11] xen/arm: Mark device as PCI while creating one Date: Thu, 30 Sep 2021 10:13:20 +0300 Message-Id: <20210930071326.857390-6-andr2000@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210930071326.857390-1-andr2000@gmail.com> References: <20210930071326.857390-1-andr2000@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1632986054613100002 Content-Type: text/plain; charset="utf-8" From: Oleksandr Andrushchenko While adding a PCI device mark it as such, so other frameworks can distinguish it from DT devices. For that introduce an architecture defined helper which may perform additional initialization of the newly created PCI device. Signed-off-by: Oleksandr Andrushchenko Acked-by: Jan Beulich --- Since v2: - !! dropped Stefano's r-b because of the changes - introduced arch_pci_init_pdev (Jan) Since v1: - moved the assignment from iommu_add_device to alloc_pdev --- xen/arch/arm/pci/pci.c | 5 +++++ xen/drivers/passthrough/pci.c | 2 ++ xen/include/asm-arm/pci.h | 5 +++++ xen/include/asm-x86/pci.h | 2 ++ 4 files changed, 14 insertions(+) diff --git a/xen/arch/arm/pci/pci.c b/xen/arch/arm/pci/pci.c index 9fc522e566a9..a8d10e869603 100644 --- a/xen/arch/arm/pci/pci.c +++ b/xen/arch/arm/pci/pci.c @@ -34,6 +34,11 @@ struct pci_dev *dev_to_pci(struct device *dev) return container_of(dev, struct pci_dev, arch.dev); } =20 +void arch_pci_init_pdev(struct pci_dev *pdev) +{ + pci_to_dev(pdev)->type =3D DEV_PCI; +} + static int __init dt_pci_init(void) { struct dt_device_node *np; diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c index 38eb451448a3..9f804a50e780 100644 --- a/xen/drivers/passthrough/pci.c +++ b/xen/drivers/passthrough/pci.c @@ -329,6 +329,8 @@ static struct pci_dev *alloc_pdev(struct pci_seg *pseg,= u8 bus, u8 devfn) *((u8*) &pdev->devfn) =3D devfn; pdev->domain =3D NULL; =20 + arch_pci_init_pdev(pdev); + rc =3D pdev_msi_init(pdev); if ( rc ) { diff --git a/xen/include/asm-arm/pci.h b/xen/include/asm-arm/pci.h index e6d4000e2ac8..566a9436a18e 100644 --- a/xen/include/asm-arm/pci.h +++ b/xen/include/asm-arm/pci.h @@ -105,6 +105,9 @@ static always_inline bool is_pci_passthrough_enabled(vo= id) { return pci_passthrough_enabled; } + +void arch_pci_init_pdev(struct pci_dev *pdev); + #else /*!CONFIG_HAS_PCI*/ =20 struct arch_pci_dev { }; @@ -121,5 +124,7 @@ static inline int pci_get_host_bridge_segment(const str= uct dt_device_node *node, return -EINVAL; } =20 +static inline void arch_pci_init_pdev(struct pci_dev *pdev) {} + #endif /*!CONFIG_HAS_PCI*/ #endif /* __ARM_PCI_H__ */ diff --git a/xen/include/asm-x86/pci.h b/xen/include/asm-x86/pci.h index 61b940c91d4a..e7f10beb4eb8 100644 --- a/xen/include/asm-x86/pci.h +++ b/xen/include/asm-x86/pci.h @@ -38,4 +38,6 @@ static always_inline bool is_pci_passthrough_enabled(void) return true; } =20 +static inline void arch_pci_init_pdev(struct pci_dev *pdev) {} + #endif /* __X86_PCI_H__ */ --=20 2.25.1