From: Oleksandr Andrushchenko <andr2000@gmail.com>
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, jbeulich@suse.com,
andrew.cooper3@citrix.com, george.dunlap@citrix.com,
paul@xen.org, bertrand.marquis@arm.com, rahul.singh@arm.com,
Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Subject: [PATCH v5 01/10] xen/arm: Add new device type for PCI
Date: Fri, 8 Oct 2021 08:55:26 +0300 [thread overview]
Message-ID: <20211008055535.337436-2-andr2000@gmail.com> (raw)
In-Reply-To: <20211008055535.337436-1-andr2000@gmail.com>
From: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Add new device type (DEV_PCI) to distinguish PCI devices from platform
DT devices, so some drivers, like IOMMU, can handle PCI devices
differently.
Also add a helper which is when given a struct device returns the
corresponding struct pci_dev which this device is a part of.
Because of the header cross-dependencies, e.g. we need both
struct pci_dev and struct arch_pci_dev at the same time, this cannot be
done with an inline.
Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Reviewed-by: Rahul Singh <rahul.singh@arm.com>
Tested-by: Rahul Singh <rahul.singh@arm.com>
---
Since v2:
- !! dropped Stefano's r-b because of the changes
- simplified dev_to_pci to use a single
container_of(dev, struct pci_dev, arch.dev) (Jan)
Since v1:
- Folded new device type (DEV_PCI) into this patch.
---
xen/arch/arm/pci/pci.c | 7 +++++++
xen/include/asm-arm/device.h | 4 ++--
xen/include/asm-arm/pci.h | 7 +++++++
3 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/xen/arch/arm/pci/pci.c b/xen/arch/arm/pci/pci.c
index 73540045d187..138da19284ab 100644
--- a/xen/arch/arm/pci/pci.c
+++ b/xen/arch/arm/pci/pci.c
@@ -27,6 +27,13 @@ int arch_pci_clean_pirqs(struct domain *d)
return 0;
}
+struct pci_dev *dev_to_pci(struct device *dev)
+{
+ ASSERT(dev->type == DEV_PCI);
+
+ return container_of(dev, struct pci_dev, arch.dev);
+}
+
static int __init dt_pci_init(void)
{
struct dt_device_node *np;
diff --git a/xen/include/asm-arm/device.h b/xen/include/asm-arm/device.h
index ebe84ea853cd..7bf040560363 100644
--- a/xen/include/asm-arm/device.h
+++ b/xen/include/asm-arm/device.h
@@ -4,6 +4,7 @@
enum device_type
{
DEV_DT,
+ DEV_PCI,
};
struct dev_archdata {
@@ -25,8 +26,7 @@ typedef struct device device_t;
#include <xen/device_tree.h>
-/* TODO: Correctly implement dev_is_pci when PCI is supported on ARM */
-#define dev_is_pci(dev) ((void)(dev), 0)
+#define dev_is_pci(dev) ((dev)->type == DEV_PCI)
#define dev_is_dt(dev) ((dev)->type == DEV_DT)
enum device_class
diff --git a/xen/include/asm-arm/pci.h b/xen/include/asm-arm/pci.h
index f99356af1eba..7a91ebbdaf0c 100644
--- a/xen/include/asm-arm/pci.h
+++ b/xen/include/asm-arm/pci.h
@@ -26,6 +26,13 @@ struct arch_pci_dev {
struct device dev;
};
+/*
+ * Because of the header cross-dependencies, e.g. we need both
+ * struct pci_dev and struct arch_pci_dev at the same time, this cannot be
+ * done with an inline here. Macro can be implemented, but looks scary.
+ */
+struct pci_dev *dev_to_pci(struct device *dev);
+
/* Arch-specific MSI data for vPCI. */
struct vpci_arch_msi {
};
--
2.25.1
next prev parent reply other threads:[~2021-10-08 5:56 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-08 5:55 [PATCH v5 00/10] PCI devices passthrough on Arm, part 2 Oleksandr Andrushchenko
2021-10-08 5:55 ` Oleksandr Andrushchenko [this message]
2021-10-08 5:55 ` [PATCH v5 02/10] xen/arm: Introduce pci_find_host_bridge_node helper Oleksandr Andrushchenko
2021-10-08 5:55 ` [PATCH v5 03/10] xen/device-tree: Make dt_find_node_by_phandle global Oleksandr Andrushchenko
2021-10-08 5:55 ` [PATCH v5 04/10] xen/arm: Mark device as PCI while creating one Oleksandr Andrushchenko
2021-10-08 5:55 ` [PATCH v5 05/10] xen/domain: Call pci_release_devices() when releasing domain resources Oleksandr Andrushchenko
2021-10-08 5:55 ` [PATCH v5 06/10] libxl: Allow removing PCI devices for all types of domains Oleksandr Andrushchenko
2021-10-11 16:11 ` Anthony PERARD
2021-10-11 16:16 ` Oleksandr Andrushchenko
2021-10-25 13:14 ` Roger Pau Monné
2021-10-25 13:17 ` Oleksandr Andrushchenko
2021-10-08 5:55 ` [PATCH v5 07/10] libxl: Only map legacy PCI IRQs if they are supported Oleksandr Andrushchenko
2021-10-11 16:37 ` Anthony PERARD
2021-10-12 1:32 ` Stefano Stabellini
2021-10-25 13:22 ` Roger Pau Monné
2021-10-25 13:38 ` Oleksandr Andrushchenko
2021-10-25 13:46 ` Roger Pau Monné
2021-11-02 11:32 ` Jan Beulich
2021-11-02 11:37 ` Oleksandr Andrushchenko
2021-10-08 5:55 ` [PATCH v5 08/10] xen/arm: Setup MMIO range trap handlers for hardware domain Oleksandr Andrushchenko
2021-10-13 10:11 ` Roger Pau Monné
2021-10-25 9:38 ` Oleksandr Andrushchenko
2021-10-25 13:40 ` Roger Pau Monné
2021-10-25 13:47 ` Oleksandr Andrushchenko
2021-10-08 5:55 ` [PATCH v5 09/10] xen/arm: Do not map PCI ECAM and MMIO space to Domain-0's p2m Oleksandr Andrushchenko
2021-10-08 23:00 ` Stefano Stabellini
2021-10-13 16:17 ` Julien Grall
2021-10-25 11:37 ` Oleksandr Andrushchenko
2021-10-28 11:13 ` Julien Grall
2021-10-28 11:20 ` Oleksandr Andrushchenko
2021-10-08 5:55 ` [PATCH v5 10/10] xen/arm: Process pending vPCI map/unmap operations Oleksandr Andrushchenko
2021-10-13 15:30 ` Julien Grall
2021-10-25 11:24 ` Oleksandr Andrushchenko
2021-10-08 22:54 ` [PATCH v5 00/10] PCI devices passthrough on Arm, part 2 Stefano Stabellini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211008055535.337436-2-andr2000@gmail.com \
--to=andr2000@gmail.com \
--cc=Artem_Mygaiev@epam.com \
--cc=andrew.cooper3@citrix.com \
--cc=bertrand.marquis@arm.com \
--cc=george.dunlap@citrix.com \
--cc=jbeulich@suse.com \
--cc=julien@xen.org \
--cc=oleksandr_andrushchenko@epam.com \
--cc=oleksandr_tyshchenko@epam.com \
--cc=paul@xen.org \
--cc=rahul.singh@arm.com \
--cc=roger.pau@citrix.com \
--cc=sstabellini@kernel.org \
--cc=volodymyr_babchuk@epam.com \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.