Re: [PATCH v16 1/5] arm/vpci: honor access size when returning an error

2024-05-22 Thread Stewart Hildebrand
On 5/22/24 18:59, Stewart Hildebrand wrote: > From: Volodymyr Babchuk > > Guest can try to read config space using different access sizes: 8, > 16, 32, 64 bits. We need to take this into account when we are > returning an error back to MMIO handler, otherwise it is possible to

[PATCH v16 5/5] xen/arm: account IO handlers for emulated PCI MSI-X

2024-05-22 Thread Stewart Hildebrand
-by: Oleksandr Andrushchenko Acked-by: Julien Grall Signed-off-by: Volodymyr Babchuk Signed-off-by: Stewart Hildebrand --- This depends on a constant defined in ("vpci: add initial support for virtual PCI bus topology"), so cannot be committed without the dependency. Since v5: - optimize with

[PATCH v16 4/5] xen/arm: translate virtual PCI bus topology for guests

2024-05-22 Thread Stewart Hildebrand
in the physical topology, e.g. it can't be mapped to some physical host bridge. So, all access to the host bridge itself needs to be trapped and emulated. Signed-off-by: Oleksandr Andrushchenko Signed-off-by: Volodymyr Babchuk Signed-off-by: Stewart Hildebrand --- In v15: - base on top of ("arm

[PATCH v16 3/5] vpci: add initial support for virtual PCI bus topology

2024-05-22 Thread Stewart Hildebrand
. Please note, that at the moment only function 0 of a multifunction device can be passed through. Signed-off-by: Oleksandr Andrushchenko Signed-off-by: Volodymyr Babchuk Signed-off-by: Stewart Hildebrand Acked-by: Jan Beulich --- In v16: - s/add_virtual_device/assign_virtual_sbdf/ - move ASSERT

[PATCH v16 2/5] vpci/header: emulate PCI_COMMAND register for guests

2024-05-22 Thread Stewart Hildebrand
llow dom0 to control this bit freely. Bits 11-15 PCIe 6.1: RsvdP PCI LB 3.0: Reserved QEMU: res_mask Xen domU: rsvdp_mask Xen dom0: We allow dom0 to control these bits freely. Signed-off-by: Oleksandr Andrushchenko Signed-off-by: Volodymyr Babchuk Signed-off-by: Stewart Hildebrand Revi

[PATCH v16 1/5] arm/vpci: honor access size when returning an error

2024-05-22 Thread Stewart Hildebrand
to read one byte, but we are writing 0x in the target register. Signed-off-by: Volodymyr Babchuk Signed-off-by: Stewart Hildebrand --- v14->v15: * re-order so this patch comes before ("xen/arm: translate virtual PCI bus topology for guests") * s/access_mask/invalid/ *

[PATCH v16 0/5] PCI devices passthrough on Arm, part 3

2024-05-22 Thread Stewart Hildebrand
This is next version of vPCI rework. Aim of this series is to prepare ground for introducing PCI support on ARM platform. in v16: - minor updates - see individual patches in v15: - reorder so ("arm/vpci: honor access size when returning an error") comes first in v14: - drop first 9

[PATCH v15 5/5] xen/arm: account IO handlers for emulated PCI MSI-X

2024-05-17 Thread Stewart Hildebrand
-by: Oleksandr Andrushchenko Acked-by: Julien Grall Signed-off-by: Volodymyr Babchuk Signed-off-by: Stewart Hildebrand --- This depends on a constant defined in ("vpci: add initial support for virtual PCI bus topology"), so cannot be committed without the dependency. Since v5: - optimize with

[PATCH v15 3/5] vpci: add initial support for virtual PCI bus topology

2024-05-17 Thread Stewart Hildebrand
. Please note, that at the moment only function 0 of a multifunction device can be passed through. Signed-off-by: Oleksandr Andrushchenko Signed-off-by: Volodymyr Babchuk Signed-off-by: Stewart Hildebrand Acked-by: Jan Beulich --- In v15: - add Jan's A-b In v13: - s/depends on/select/ in Kconfig

[PATCH v15 4/5] xen/arm: translate virtual PCI bus topology for guests

2024-05-17 Thread Stewart Hildebrand
in the physical topology, e.g. it can't be mapped to some physical host bridge. So, all access to the host bridge itself needs to be trapped and emulated. Signed-off-by: Oleksandr Andrushchenko Signed-off-by: Volodymyr Babchuk Signed-off-by: Stewart Hildebrand --- In v15: - base on top of ("arm

[PATCH v15 2/5] vpci/header: emulate PCI_COMMAND register for guests

2024-05-17 Thread Stewart Hildebrand
llow dom0 to control this bit freely. Bits 11-15 PCIe 6.1: RsvdP PCI LB 3.0: Reserved QEMU: res_mask Xen domU/dom0: rsvdp_mask Signed-off-by: Oleksandr Andrushchenko Signed-off-by: Volodymyr Babchuk Signed-off-by: Stewart Hildebrand Reviewed-by: Jan Beulich --- RFC: There is an unaddresse

[PATCH v15 1/5] arm/vpci: honor access size when returning an error

2024-05-17 Thread Stewart Hildebrand
to read one byte, but we are writing 0x in the target register. Signed-off-by: Volodymyr Babchuk Signed-off-by: Stewart Hildebrand --- v14->v15: * re-order so this patch comes before ("xen/arm: translate virtual PCI bus topology for guests") * s/access_mask/invalid/ *

[PATCH v15 0/5] PCI devices passthrough on Arm, part 3

2024-05-17 Thread Stewart Hildebrand
This is next version of vPCI rework. Aim of this series is to prepare ground for introducing PCI support on ARM platform. in v15: - reorder so ("arm/vpci: honor access size when returning an error") comes first in v14: - drop first 9 patches as they were committed - updated ("vpci/header:

Re: [XEN PATCH v8 1/5] xen/vpci: Clear all vpci status of device

2024-05-17 Thread Stewart Hildebrand
On 5/17/24 04:08, Chen, Jiqian wrote: > On 2024/5/16 21:08, Jan Beulich wrote: >> On 16.05.2024 11:52, Jiqian Chen wrote: >>> @@ -67,6 +68,41 @@ ret_t pci_physdev_op(int cmd, >>> XEN_GUEST_HANDLE_PARAM(void) arg) >>> +pcidevs_lock(); >>> +pdev = pci_get_pdev(NULL, sbdf); >>> +

Re: [PATCH v14 5/5] arm/vpci: honor access size when returning an error

2024-05-15 Thread Stewart Hildebrand
On 5/15/24 02:32, Jan Beulich wrote: > On 14.05.2024 22:31, Stewart Hildebrand wrote: >> Here's what the patch ("arm/vpci: honor access size when returning an >> error") now looks like based on staging: >> >> diff --git a/xen/arch/arm/vpci.c b/xen/

Re: [XEN PATCH v7 1/5] xen/vpci: Clear all vpci status of device

2024-05-15 Thread Stewart Hildebrand
ice state. When the state of device is reset on dom0 side, > dom0 can call this hypercall to notify vpci. > > Signed-off-by: Huang Rui > Signed-off-by: Jiqian Chen > Reviewed-by: Stewart Hildebrand > Reviewed-by: Stefano Stabellini Could we consider this patch for 4

Re: [PATCH v14 5/5] arm/vpci: honor access size when returning an error

2024-05-14 Thread Stewart Hildebrand
On 5/14/24 13:48, Julien Grall wrote: > Hi Stewart, > > On 14/05/2024 15:33, Stewart Hildebrand wrote: >> From: Volodymyr Babchuk >> >> Guest can try to read config space using different access sizes: 8, >> 16, 32, 64 bits. We need to take this into account when

[PATCH v14 5/5] arm/vpci: honor access size when returning an error

2024-05-14 Thread Stewart Hildebrand
to read one byte, but we are writing 0x in the target register. Signed-off-by: Volodymyr Babchuk Signed-off-by: Stewart Hildebrand --- v9->10: * New patch in v10. --- xen/arch/arm/vpci.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/xen/arch/arm/vpci.

[PATCH v14 4/5] xen/arm: account IO handlers for emulated PCI MSI-X

2024-05-14 Thread Stewart Hildebrand
-by: Oleksandr Andrushchenko Acked-by: Julien Grall Signed-off-by: Volodymyr Babchuk Signed-off-by: Stewart Hildebrand --- This actually moved here from the part 2 of the prep work for PCI passthrough on Arm as it seems to be the proper place for it. Since v5: - optimize with IS_ENABLED(CONFIG_HAS_PCI_MSI

[PATCH v14 3/5] xen/arm: translate virtual PCI bus topology for guests

2024-05-14 Thread Stewart Hildebrand
in the physical topology, e.g. it can't be mapped to some physical host bridge. So, all access to the host bridge itself needs to be trapped and emulated. Signed-off-by: Oleksandr Andrushchenko Signed-off-by: Volodymyr Babchuk Signed-off-by: Stewart Hildebrand --- In v11: - Fixed format issues - Added

[PATCH v14 1/5] vpci/header: emulate PCI_COMMAND register for guests

2024-05-14 Thread Stewart Hildebrand
llow dom0 to control this bit freely. Bits 11-15 PCIe 6.1: RsvdP PCI LB 3.0: Reserved QEMU: res_mask Xen domU/dom0: rsvdp_mask Signed-off-by: Oleksandr Andrushchenko Signed-off-by: Volodymyr Babchuk Signed-off-by: Stewart Hildebrand --- RFC: There is an unaddressed question for Rog

[PATCH v14 2/5] vpci: add initial support for virtual PCI bus topology

2024-05-14 Thread Stewart Hildebrand
. Please note, that at the moment only function 0 of a multifunction device can be passed through. Signed-off-by: Oleksandr Andrushchenko Signed-off-by: Volodymyr Babchuk Signed-off-by: Stewart Hildebrand --- In v13: - s/depends on/select/ in Kconfig - check pdev->sbdf.fn instead of two boole

[PATCH v14 0/5] PCI devices passthrough on Arm, part 3

2024-05-14 Thread Stewart Hildebrand
This is next version of vPCI rework. Aim of this series is to prepare ground for introducing PCI support on ARM platform. in v14: - drop first 9 patches as they were committed - updated ("vpci/header: emulate PCI_COMMAND register for guests") in v13: - drop ("xen/arm: vpci: permit access to

Re: [PATCH] xen/spinlock: use correct pointer

2024-04-26 Thread Stewart Hildebrand
On 4/26/24 02:31, Jan Beulich wrote: > On 25.04.2024 22:45, Stewart Hildebrand wrote: >> The ->profile member is at different offsets in struct rspinlock and >> struct spinlock. When initializing the profiling bits of an rspinlock, >> an unrelated member in struct rspinlo

Re: [PATCH 11/15] tools/helpers: Add get_overlay

2024-04-25 Thread Stewart Hildebrand
On 4/24/24 20:43, Henry Wang wrote: > Hi Jan, > > On 4/24/2024 2:08 PM, Jan Beulich wrote: >> On 24.04.2024 05:34, Henry Wang wrote: >>> From: Vikram Garhwal >>> >>> This user level application copies the overlay dtbo shared by dom0 while >>> doing >>> overlay node assignment operation. It uses

[PATCH] xen/spinlock: use correct pointer

2024-04-25 Thread Stewart Hildebrand
ck: make struct lock_profile rspinlock_t aware") Signed-off-by: Stewart Hildebrand --- xen/common/spinlock.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/xen/common/spinlock.c b/xen/common/spinlock.c index 558ea7ac3518..28c6e9d3ac60 100644 --- a/xen/common/spinlock.c +++

[PATCH] arm/vpci: make prefetchable mem 64 bit

2024-04-24 Thread Stewart Hildebrand
The vPCI prefetchable memory range is >= 4GB, so the memory space flags should be set to 64-bit. See IEEE Std 1275-1994 [1] for a definition of the field. [1] https://www.devicetree.org/open-firmware/bindings/pci/pci2_1.pdf Signed-off-by: Stewart Hildebrand --- xen/include/public/arch-ar

Re: [PATCH V4] Add requirements for Device Passthrough

2024-04-08 Thread Stewart Hildebrand
henko Two nits below. With those addressed: Reviewed-by: Stewart Hildebrand > --- > > V2: >- add R-b >- update README >- lower case for platform, s/simple/non-DMA-capable, other misc > updates >- add "Allowed for the safe direct mapped

Re: [PATCH] avoid UB in guest handle arithmetic

2024-03-22 Thread Stewart Hildebrand
On 3/19/24 09:26, Jan Beulich wrote: > At least XENMEM_memory_exchange can have huge values passed in the > nr_extents and nr_exchanged fields. Adding such values to pointers can > overflow, resulting in UB. Cast respective pointers to "unsigned long" Why not uintptr_t?

Re: [PATCH v13 10/14] vpci/header: emulate PCI_COMMAND register for guests

2024-03-18 Thread Stewart Hildebrand
On 2/14/24 10:41, Jan Beulich wrote: > On 02.02.2024 22:33, Stewart Hildebrand wrote: >> @@ -836,9 +870,20 @@ static int cf_check init_header(struct pci_dev *pdev) >> if ( pdev->ignore_bars ) >> return 0; >> >> -/* Disable memory de

Re: [PATCH] pci: fix locking around vPCI removal in pci_remove_device()

2024-02-29 Thread Stewart Hildebrand
anup ahead of having removed the vPCI handlers >> could lead to stale data in vPCI MSI(-X) internal structures. >> >> Fixes: 4f78438b45e2 ('vpci: use per-domain PCI lock to protect vpci >> structure') >> Signed-off-by: Roger Pau Monné > > Reviewed-by: Jan Beulich Reviewed-by: Stewart Hildebrand Thanks

[PATCH] tests/vpci: fix unit tests after locking change

2024-02-27 Thread Stewart Hildebrand
The recent vPCI locking broke the vPCI unit tests. Fix it to unblock CI. Fixes: 4f78438b45e2 ("vpci: use per-domain PCI lock to protect vpci structure") Reported-by: Andrew Cooper Signed-off-by: Stewart Hildebrand --- tools/tests/vpci/emul.h | 9 - tools/tests/vpci/main.c

Re: [RFC XEN PATCH v5 1/5] xen/vpci: Clear all vpci status of device

2024-02-22 Thread Stewart Hildebrand
On 2/22/24 01:22, Chen, Jiqian wrote: > Hi Stewart, > > On 2024/2/10 02:02, Stewart Hildebrand wrote: >> On 1/12/24 01:13, Jiqian Chen wrote: >>> When a device has been reset on dom0 side, the vpci on Xen >>> side won't get notification, so the cached state in vp

[PATCH v13.3 01/14] vpci: use per-domain PCI lock to protect vpci structure

2024-02-20 Thread Stewart Hildebrand
u Monné Suggested-by: Jan Beulich Signed-off-by: Oleksandr Andrushchenko Signed-off-by: Volodymyr Babchuk Signed-off-by: Stewart Hildebrand --- Changes in v13.3: - remove d's in comment in vpci_msix_arch_print() - remove comment after domain_done: label in vpci_dump_msi() - slightly tweak ASSER

Re: [PATCH v13.2 01/14] vpci: use per-domain PCI lock to protect vpci structure

2024-02-19 Thread Stewart Hildebrand
On 2/19/24 08:12, Jan Beulich wrote: > On 19.02.2024 13:47, Stewart Hildebrand wrote: >> On 2/19/24 07:10, Jan Beulich wrote: >>> On 19.02.2024 12:47, Stewart Hildebrand wrote: >>>> @@ -895,6 +891,15 @@ int vpci_msix_arch_print(const struct vpci_msix *msix) &g

Re: [PATCH v13.2 01/14] vpci: use per-domain PCI lock to protect vpci structure

2024-02-19 Thread Stewart Hildebrand
On 2/19/24 07:10, Jan Beulich wrote: > On 19.02.2024 12:47, Stewart Hildebrand wrote: >> @@ -895,6 +891,15 @@ int vpci_msix_arch_print(const struct vpci_msix *msix) >> { >> unsigned int i; >> >> +/* >> + * Assert that d->pdev_list doesn't c

[PATCH v13.2 01/14] vpci: use per-domain PCI lock to protect vpci structure

2024-02-19 Thread Stewart Hildebrand
u Monné Suggested-by: Jan Beulich Signed-off-by: Oleksandr Andrushchenko Signed-off-by: Volodymyr Babchuk Signed-off-by: Stewart Hildebrand --- Changes in v13.2: - clarify comment in vpci_msix_arch_print() - add parenthesis around arg in macro definition - make the helper macro an ASSER

Re: [PATCH v13.1 01/14] vpci: use per-domain PCI lock to protect vpci structure

2024-02-16 Thread Stewart Hildebrand
On 2/16/24 06:44, Roger Pau Monné wrote: > On Thu, Feb 15, 2024 at 03:30:00PM -0500, Stewart Hildebrand wrote: >> From: Oleksandr Andrushchenko >> >> Use the per-domain PCI read/write lock to protect the presence of the >> pci device vpci field. This lock can be used

[PATCH v13.1 01/14] vpci: use per-domain PCI lock to protect vpci structure

2024-02-15 Thread Stewart Hildebrand
u Monné Suggested-by: Jan Beulich Signed-off-by: Oleksandr Andrushchenko Signed-off-by: Volodymyr Babchuk Signed-off-by: Stewart Hildebrand --- Changes in v13.1: * move pdev_list_is_read_locked() to pci.h * use pdev_list_is_read_locked() in more places * use d directly in pdev_list_is_read_locked(

Re: [PATCH v13 01/14] vpci: use per-domain PCI lock to protect vpci structure

2024-02-14 Thread Stewart Hildebrand
On 2/14/24 06:38, Jan Beulich wrote: > On 02.02.2024 22:33, Stewart Hildebrand wrote: >> --- a/xen/arch/x86/physdev.c >> +++ b/xen/arch/x86/physdev.c >> @@ -123,7 +123,9 @@ int physdev_map_pirq(domid_t domid, int type, int >> *index, int *pirq_p, >> >>

Re: [PATCH v13 01/14] vpci: use per-domain PCI lock to protect vpci structure

2024-02-13 Thread Stewart Hildebrand
On 2/13/24 04:05, Jan Beulich wrote: > On 13.02.2024 10:01, Roger Pau Monné wrote: >> On Tue, Feb 13, 2024 at 09:44:58AM +0100, Jan Beulich wrote: >>> On 13.02.2024 09:35, Roger Pau Monné wrote: >>>> On Fri, Feb 02, 2024 at 04:33:05PM -0500, Stewart Hildebrand wrot

Re: [PATCH v13 01/14] vpci: use per-domain PCI lock to protect vpci structure

2024-02-13 Thread Stewart Hildebrand
On 2/13/24 03:35, Roger Pau Monné wrote: > On Fri, Feb 02, 2024 at 04:33:05PM -0500, Stewart Hildebrand wrote: >> From: Oleksandr Andrushchenko >> >> Use the per-domain PCI read/write lock to protect the presence of the >> pci device vpci field. This lock can be used

Re: [RFC XEN PATCH v5 1/5] xen/vpci: Clear all vpci status of device

2024-02-09 Thread Stewart Hildebrand
ice state. When the state of device is reset on dom0 side, > dom0 can call this hypercall to notify vpci. > > Co-developed-by: Huang Rui > Signed-off-by: Jiqian Chen Reviewed-by: Stewart Hildebrand If you send another version, the RFC tag may be dropped. One thing to keep an eye ou

Re: [PATCH v13 01/14] vpci: use per-domain PCI lock to protect vpci structure

2024-02-06 Thread Stewart Hildebrand
On 2/2/24 16:33, Stewart Hildebrand wrote: > --- > Changes in v13: > - hold off adding Roger's R-b tag even though it was provided on v12.2 > - use a wrapper construct to ease readability of odd-looking ASSERTs > - new placement of ASSERT in __pci_enable_msix(), _

[PATCH v13 11/14] vpci: add initial support for virtual PCI bus topology

2024-02-02 Thread Stewart Hildebrand
. Please note, that at the moment only function 0 of a multifunction device can be passed through. Signed-off-by: Oleksandr Andrushchenko Signed-off-by: Volodymyr Babchuk Signed-off-by: Stewart Hildebrand --- In v13: - s/depends on/select/ in Kconfig - check pdev->sbdf.fn instead of two boole

[PATCH v13 07/14] rangeset: add rangeset_purge() function

2024-02-02 Thread Stewart Hildebrand
From: Volodymyr Babchuk This function can be used when user wants to remove all rangeset entries but do not want to destroy rangeset itself. Signed-off-by: Volodymyr Babchuk Signed-off-by: Stewart Hildebrand Acked-by: Jan Beulich --- Changes in v13: - Added Jan's A-b Changes in v12: - s

[PATCH v13 12/14] xen/arm: translate virtual PCI bus topology for guests

2024-02-02 Thread Stewart Hildebrand
in the physical topology, e.g. it can't be mapped to some physical host bridge. So, all access to the host bridge itself needs to be trapped and emulated. Signed-off-by: Oleksandr Andrushchenko Signed-off-by: Volodymyr Babchuk Signed-off-by: Stewart Hildebrand --- In v11: - Fixed format issues - Added

[PATCH v13 10/14] vpci/header: emulate PCI_COMMAND register for guests

2024-02-02 Thread Stewart Hildebrand
llow dom0 to control this bit freely. Bits 11-15 PCIe 6.1: RsvdP PCI LB 3.0: Reserved QEMU: res_mask Xen domU/dom0: rsvdp_mask Signed-off-by: Oleksandr Andrushchenko Signed-off-by: Volodymyr Babchuk Signed-off-by: Stewart Hildebrand --- RFC: There is an unaddressed question for Rog

[PATCH v13 13/14] xen/arm: account IO handlers for emulated PCI MSI-X

2024-02-02 Thread Stewart Hildebrand
-by: Oleksandr Andrushchenko Acked-by: Julien Grall Signed-off-by: Volodymyr Babchuk Signed-off-by: Stewart Hildebrand --- This actually moved here from the part 2 of the prep work for PCI passthrough on Arm as it seems to be the proper place for it. Since v5: - optimize with IS_ENABLED(CONFIG_HAS_PCI_MSI

[PATCH v13 09/14] vpci/header: program p2m with guest BAR view

2024-02-02 Thread Stewart Hildebrand
mapped, while for domUs the BARs are mapped at the requested guest address without modifying the BAR address in the device PCI config space. Signed-off-by: Oleksandr Andrushchenko Signed-off-by: Volodymyr Babchuk Signed-off-by: Stewart Hildebrand Reviewed-by: Roger Pau Monné --- In v12.3

[PATCH v13 14/14] arm/vpci: honor access size when returning an error

2024-02-02 Thread Stewart Hildebrand
to read one byte, but we are writing 0x in the target register. Signed-off-by: Volodymyr Babchuk Signed-off-by: Stewart Hildebrand --- v9->10: * New patch in v10. --- xen/arch/arm/vpci.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/xen/arch/arm/vpci.

[PATCH v13 08/14] vpci/header: handle p2m range sets per BAR

2024-02-02 Thread Stewart Hildebrand
Reviewed-by: Roger Pau Monné Signed-off-by: Stewart Hildebrand --- In v12: - s/rangeset_empty/rangeset_purge/ - change i to num_bars for expansion ROM (purely cosmetic change) In v11: - Modified commit message to note changes in error handling in vpci_process_pending() - Removed redundant ASSERT

[PATCH v13 06/14] rangeset: add RANGESETF_no_print flag

2024-02-02 Thread Stewart Hildebrand
. Suggested-by: Jan Beulich Signed-off-by: Oleksandr Andrushchenko Signed-off-by: Volodymyr Babchuk Reviewed-by: Jan Beulich Signed-off-by: Stewart Hildebrand --- Since v5: - comment indentation (Jan) Since v1: - update BUG_ON with new flag - simplify the definition of the flags --- xen/common

[PATCH v13 05/14] vpci/header: implement guest BAR register handlers

2024-02-02 Thread Stewart Hildebrand
returning default ~0 on read may confuse guest OS. Introduce is_hwdom convenience variable and convert an existing is_hardware_domain() check. Signed-off-by: Oleksandr Andrushchenko Signed-off-by: Volodymyr Babchuk Reviewed-by: Roger Pau Monné Signed-off-by: Stewart Hildebrand --- In v12

[PATCH v13 04/14] vpci/header: rework exit path in init_header()

2024-02-02 Thread Stewart Hildebrand
Volodymyr Babchuk Acked-by: Roger Pau Monné Signed-off-by: Stewart Hildebrand --- In v12: - s/init_bars/init_header/ - Re-order tags - Fixup scissors line In v11: - Do not remove empty line between "goto fail;" and "continue;" In v10: - Added Roger's A-b tag. In v9: - New in v9

[PATCH v13 03/14] vpci: add hooks for PCI device assign/de-assign

2024-02-02 Thread Stewart Hildebrand
-off-by: Oleksandr Andrushchenko Signed-off-by: Volodymyr Babchuk Reviewed-by: Roger Pau Monné Signed-off-by: Stewart Hildebrand Acked-by: Jan Beulich --- In v13: - Add Jan's A-b - Rebase on cb4ecb3cc17b ("pci: fail device assignment if phantom functions cannot be assigned")

[PATCH v13 02/14] vpci: restrict unhandled read/write operations for guests

2024-02-02 Thread Stewart Hildebrand
sure only hardware domain can access the hardware directly and restrict guests from doing so. Suggested-by: Roger Pau Monné Signed-off-by: Oleksandr Andrushchenko Signed-off-by: Volodymyr Babchuk Reviewed-by: Roger Pau Monné Signed-off-by: Stewart Hildebrand --- Since v9: - removed stray

[PATCH v13 01/14] vpci: use per-domain PCI lock to protect vpci structure

2024-02-02 Thread Stewart Hildebrand
d-by: Jan Beulich Signed-off-by: Oleksandr Andrushchenko Signed-off-by: Volodymyr Babchuk Signed-off-by: Stewart Hildebrand --- Changes in v13: - hold off adding Roger's R-b tag even though it was provided on v12.2 - use a wrapper construct to ease readability of odd-looking ASSERTs - new pla

[PATCH v13 00/14] PCI devices passthrough on Arm, part 3

2024-02-02 Thread Stewart Hildebrand
This is next version of vPCI rework. Aim of this series is to prepare ground for introducing PCI support on ARM platform. in v13: - drop ("xen/arm: vpci: permit access to guest vpci space") as it was unnecessary in v12: - I (Stewart) coordinated with Volodomyr to send this whole series. So,

Re: [PATCH v12 11/15] vpci: add initial support for virtual PCI bus topology

2024-02-01 Thread Stewart Hildebrand
On 1/25/24 11:00, Jan Beulich wrote: > On 09.01.2024 22:51, Stewart Hildebrand wrote: >> --- a/xen/drivers/Kconfig >> +++ b/xen/drivers/Kconfig >> @@ -15,4 +15,8 @@ source "drivers/video/Kconfig" >> config HAS_VPCI >> bool >> >> +con

Re: [PATCH v12 10/15] vpci/header: emulate PCI_COMMAND register for guests

2024-01-31 Thread Stewart Hildebrand
On 1/25/24 10:43, Jan Beulich wrote: > On 09.01.2024 22:51, Stewart Hildebrand wrote: >> --- a/xen/drivers/vpci/header.c >> +++ b/xen/drivers/vpci/header.c >> @@ -168,6 +168,9 @@ static void modify_decoding(const struct pci_dev *pdev, >> uint16_t

Re: [PATCH v12 03/15] vpci: add hooks for PCI device assign/de-assign

2024-01-30 Thread Stewart Hildebrand
On 1/9/24 16:51, Stewart Hildebrand wrote: > diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c > index 3a973324bca1..a902de6a8693 100644 > --- a/xen/drivers/passthrough/pci.c > +++ b/xen/drivers/passthrough/pci.c > @@ -1476,6 +1485,10 @@ static int assig

Re: [PATCH v12.2 01/15] vpci: use per-domain PCI lock to protect vpci structure

2024-01-30 Thread Stewart Hildebrand
.01.2024 16:07, Roger Pau Monné wrote: >>>>>>>>> On Tue, Jan 23, 2024 at 03:32:12PM +0100, Jan Beulich wrote: >>>>>>>>>> On 15.01.2024 20:43, Stewart Hildebrand wrote: >>>>>>>>>>> @@ -2888,6 +2888,8 @@ int allocate_and_ma

Re: [PATCH v12.2 01/15] vpci: use per-domain PCI lock to protect vpci structure

2024-01-30 Thread Stewart Hildebrand
On 1/24/24 00:00, Stewart Hildebrand wrote: > On 1/23/24 10:07, Roger Pau Monné wrote: >> On Tue, Jan 23, 2024 at 03:32:12PM +0100, Jan Beulich wrote: >>> On 15.01.2024 20:43, Stewart Hildebrand wrote: >>>> @@ -2888,6 +2888,8 @@ int allocate_and_map_msi_pirq(struct d

Re: [PATCH v12.2 01/15] vpci: use per-domain PCI lock to protect vpci structure

2024-01-24 Thread Stewart Hildebrand
On 1/24/24 03:21, Roger Pau Monné wrote: > On Wed, Jan 24, 2024 at 12:07:28AM -0500, Stewart Hildebrand wrote: >> On 1/23/24 09:29, Jan Beulich wrote: >>> On 15.01.2024 20:43, Stewart Hildebrand wrote: >>>> @@ -1043,11 +1043,11 @@ static int __pci_enable_msix(stru

Re: [PATCH v12.2 01/15] vpci: use per-domain PCI lock to protect vpci structure

2024-01-23 Thread Stewart Hildebrand
On 1/23/24 09:29, Jan Beulich wrote: > On 15.01.2024 20:43, Stewart Hildebrand wrote: >> @@ -1043,11 +1043,11 @@ static int __pci_enable_msix(struct pci_dev *pdev, >> struct msi_info *msi, >> { >> struct msi_desc *old_desc; >> >> -ASSERT(pci

Re: [PATCH v12.2 01/15] vpci: use per-domain PCI lock to protect vpci structure

2024-01-23 Thread Stewart Hildebrand
On 1/23/24 10:07, Roger Pau Monné wrote: > On Tue, Jan 23, 2024 at 03:32:12PM +0100, Jan Beulich wrote: >> On 15.01.2024 20:43, Stewart Hildebrand wrote: >>> @@ -2888,6 +2888,8 @@ int allocate_and_map_msi_pirq(struct domain *d, int >>> index, int *pirq_p, >>

[PATCH v12.3 09/15] vpci/header: program p2m with guest BAR view

2024-01-19 Thread Stewart Hildebrand
mapped, while for domUs the BARs are mapped at the requested guest address without modifying the BAR address in the device PCI config space. Signed-off-by: Oleksandr Andrushchenko Signed-off-by: Volodymyr Babchuk Signed-off-by: Stewart Hildebrand Reviewed-by: Roger Pau Monné --- In v12.3

Re: [PATCH v12 14/15] xen/arm: vpci: permit access to guest vpci space

2024-01-16 Thread Stewart Hildebrand
On 1/9/24 16:51, Stewart Hildebrand wrote: > Move iomem_caps initialization earlier (before arch_domain_create()). > > Signed-off-by: Stewart Hildebrand Since the iomem_access_permitted() check over in ("vpci/header: program p2m with guest BAR view") was changed to use

Re: [PATCH v12.2 09/15] vpci/header: program p2m with guest BAR view

2024-01-16 Thread Stewart Hildebrand
On 1/15/24 14:44, Stewart Hildebrand wrote: > diff --git a/xen/drivers/vpci/header.c b/xen/drivers/vpci/header.c > index feccd070ddd0..8483404c5e91 100644 > --- a/xen/drivers/vpci/header.c > +++ b/xen/drivers/vpci/header.c > @@ -41,13 +42,24 @@ static int cf_check map_range( >

[PATCH v12.2 09/15] vpci/header: program p2m with guest BAR view

2024-01-15 Thread Stewart Hildebrand
mapped, while for domUs the BARs are mapped at the requested guest address without modifying the BAR address in the device PCI config space. Signed-off-by: Oleksandr Andrushchenko Signed-off-by: Volodymyr Babchuk Signed-off-by: Stewart Hildebrand Reviewed-by: Roger Pau Monné --- In v12.2

[PATCH v12.2 01/15] vpci: use per-domain PCI lock to protect vpci structure

2024-01-15 Thread Stewart Hildebrand
d for_each_pdev and pci_get_pdev_by_domain while accessing pdevs in vpci code. Suggested-by: Roger Pau Monné Suggested-by: Jan Beulich Signed-off-by: Oleksandr Andrushchenko Signed-off-by: Volodymyr Babchuk Signed-off-by: Stewart Hildebrand --- Changes in v12.2: - drop Roger's R-b - drop b

Re: [PATCH v12 09/15] vpci/header: program p2m with guest BAR view

2024-01-15 Thread Stewart Hildebrand
On 1/15/24 04:07, Jan Beulich wrote: > On 12.01.2024 16:06, Roger Pau Monné wrote: >> On Tue, Jan 09, 2024 at 04:51:24PM -0500, Stewart Hildebrand wrote: >>> From: Oleksandr Andrushchenko >>> +/* >>> + * Make sure that the guest

Re: [PATCH v12.1 01/15] vpci: use per-domain PCI lock to protect vpci structure

2024-01-15 Thread Stewart Hildebrand
On 1/15/24 03:58, Jan Beulich wrote: > On 12.01.2024 19:14, Stewart Hildebrand wrote: >> From: Oleksandr Andrushchenko >> >> Use the per-domain PCI read/write lock to protect the presence of the >> pci device vpci field. This lock can be used (and in a few case

Re: [PATCH v12 01/15] vpci: use per-domain PCI lock to protect vpci structure

2024-01-15 Thread Stewart Hildebrand
On 1/15/24 03:53, Roger Pau Monné wrote: > On Fri, Jan 12, 2024 at 12:54:56PM -0500, Stewart Hildebrand wrote: >> On 1/12/24 08:48, Roger Pau Monné wrote: >>> On Tue, Jan 09, 2024 at 04:51:16PM -0500, Stewart Hildebrand wrote: >>>> @@ -202,8 +204,20 @@ static int __i

[PATCH v12.1 09/15] vpci/header: program p2m with guest BAR view

2024-01-12 Thread Stewart Hildebrand
mapped, while for domUs the BARs are mapped at the requested guest address without modifying the BAR address in the device PCI config space. Signed-off-by: Oleksandr Andrushchenko Signed-off-by: Volodymyr Babchuk Signed-off-by: Stewart Hildebrand Reviewed-by: Roger Pau Monné --- In v12.1

Re: [PATCH v12 09/15] vpci/header: program p2m with guest BAR view

2024-01-12 Thread Stewart Hildebrand
On 1/12/24 10:06, Roger Pau Monné wrote: > On Tue, Jan 09, 2024 at 04:51:24PM -0500, Stewart Hildebrand wrote: >> From: Oleksandr Andrushchenko >> >> Take into account guest's BAR view and program its p2m accordingly: >> gfn is guest's view of the BAR and mf

[PATCH v12.1 01/15] vpci: use per-domain PCI lock to protect vpci structure

2024-01-12 Thread Stewart Hildebrand
d for_each_pdev and pci_get_pdev_by_domain while accessing pdevs in vpci code. Suggested-by: Roger Pau Monné Suggested-by: Jan Beulich Signed-off-by: Oleksandr Andrushchenko Signed-off-by: Volodymyr Babchuk Signed-off-by: Stewart Hildebrand Reviewed-by: Roger Pau Monné --- Changes in v12.

Re: [PATCH v12 01/15] vpci: use per-domain PCI lock to protect vpci structure

2024-01-12 Thread Stewart Hildebrand
On 1/12/24 08:48, Roger Pau Monné wrote: > On Tue, Jan 09, 2024 at 04:51:16PM -0500, Stewart Hildebrand wrote: >> From: Oleksandr Andrushchenko >> >> Use a previously introduced per-domain read/write lock to check >> whether vpci is present, so we are sure there are no

Re: [PATCH v12 11/15] vpci: add initial support for virtual PCI bus topology

2024-01-12 Thread Stewart Hildebrand
On 1/12/24 06:46, George Dunlap wrote: > On Tue, Jan 9, 2024 at 9:54 PM Stewart Hildebrand > wrote: >> diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h >> index 37f5922f3206..b58a822847be 100644 >> --- a/xen/include/xen/sched.h >> +++ b/xen/include/xe

Re: [RFC XEN PATCH v4 4/5] domctl: Use gsi to grant/revoke irq permission

2024-01-10 Thread Stewart Hildebrand
On 1/5/24 02:09, Jiqian Chen wrote: > diff --git a/xen/common/domctl.c b/xen/common/domctl.c > index f5a71ee5f78d..eeb975bd0194 100644 > --- a/xen/common/domctl.c > +++ b/xen/common/domctl.c > @@ -653,12 +653,20 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) > u_domctl) >

Re: [RFC XEN PATCH v4 1/5] xen/vpci: Clear all vpci status of device

2024-01-10 Thread Stewart Hildebrand
On 1/10/24 01:24, Chen, Jiqian wrote: > On 2024/1/9 23:24, Stewart Hildebrand wrote: >> On 1/5/24 02:09, Jiqian Chen wrote: >>> diff --git a/xen/drivers/pci/physdev.c b/xen/drivers/pci/physdev.c >>> index 42db3e6d133c..552ccbf747cb 100644 >>> --- a/xen/drivers

[PATCH v12 10/15] vpci/header: emulate PCI_COMMAND register for guests

2024-01-09 Thread Stewart Hildebrand
llow dom0 to control this bit freely. Bits 11-15 PCIe 6.1: RsvdP PCI LB 3.0: Reserved QEMU: res_mask Xen domU/dom0: rsvdp_mask Signed-off-by: Oleksandr Andrushchenko Signed-off-by: Volodymyr Babchuk Signed-off-by: Stewart Hildebrand --- In v12: - Rework patch using vpci_add_register_mask() -

[PATCH v12 08/15] vpci/header: handle p2m range sets per BAR

2024-01-09 Thread Stewart Hildebrand
Reviewed-by: Roger Pau Monné Signed-off-by: Stewart Hildebrand --- In v12: - s/rangeset_empty/rangeset_purge/ - change i to num_bars for expansion ROM (purely cosmetic change) In v11: - Modified commit message to note changes in error handling in vpci_process_pending() - Removed redundant ASSERT

[PATCH v12 11/15] vpci: add initial support for virtual PCI bus topology

2024-01-09 Thread Stewart Hildebrand
. Please note, that at the moment only function 0 of a multifunction device can be passed through. Signed-off-by: Oleksandr Andrushchenko Signed-off-by: Volodymyr Babchuk Signed-off-by: Stewart Hildebrand --- In v11: - Fixed code formatting - Removed bogus write_unlock() call - Fixed type

[PATCH v12 09/15] vpci/header: program p2m with guest BAR view

2024-01-09 Thread Stewart Hildebrand
mapped, while for domUs the BARs are mapped at the requested guest address without modifying the BAR address in the device PCI config space. Signed-off-by: Oleksandr Andrushchenko Signed-off-by: Volodymyr Babchuk Signed-off-by: Stewart Hildebrand --- In v12: - Update guest_addr in rom_write

[PATCH v12 15/15] arm/vpci: honor access size when returning an error

2024-01-09 Thread Stewart Hildebrand
to read one byte, but we are writing 0x in the target register. Signed-off-by: Volodymyr Babchuk Signed-off-by: Stewart Hildebrand --- xen/arch/arm/vpci.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/xen/arch/arm/vpci.c b/xen/arch/arm/vpci.c index

[PATCH v12 14/15] xen/arm: vpci: permit access to guest vpci space

2024-01-09 Thread Stewart Hildebrand
Move iomem_caps initialization earlier (before arch_domain_create()). Signed-off-by: Stewart Hildebrand --- Changes in v11: * move both iomem_caps and irq_caps initializations earlier, along with NULL check Changes in v10: * fix off-by-one * also permit access to GUEST_VPCI_PREFETCH_MEM_ADDR

[PATCH v12 13/15] xen/arm: account IO handlers for emulated PCI MSI-X

2024-01-09 Thread Stewart Hildebrand
-by: Oleksandr Andrushchenko Acked-by: Julien Grall Signed-off-by: Volodymyr Babchuk Signed-off-by: Stewart Hildebrand --- This actually moved here from the part 2 of the prep work for PCI passthrough on Arm as it seems to be the proper place for it. Since v5: - optimize with IS_ENABLED(CONFIG_HAS_PCI_MSI

[PATCH v12 12/15] xen/arm: translate virtual PCI bus topology for guests

2024-01-09 Thread Stewart Hildebrand
in the physical topology, e.g. it can't be mapped to some physical host bridge. So, all access to the host bridge itself needs to be trapped and emulated. Signed-off-by: Oleksandr Andrushchenko Signed-off-by: Volodymyr Babchuk Signed-off-by: Stewart Hildebrand --- In v11: - Fixed format issues - Added

[PATCH v12 07/15] rangeset: add rangeset_purge() function

2024-01-09 Thread Stewart Hildebrand
From: Volodymyr Babchuk This function can be used when user wants to remove all rangeset entries but do not want to destroy rangeset itself. Signed-off-by: Volodymyr Babchuk Signed-off-by: Stewart Hildebrand --- Changes in v12: - s/rangeset_empty/rangeset_purge/ Changes in v11: - Now

[PATCH v12 06/15] rangeset: add RANGESETF_no_print flag

2024-01-09 Thread Stewart Hildebrand
. Suggested-by: Jan Beulich Signed-off-by: Oleksandr Andrushchenko Signed-off-by: Volodymyr Babchuk Reviewed-by: Jan Beulich Signed-off-by: Stewart Hildebrand --- Since v5: - comment indentation (Jan) Since v1: - update BUG_ON with new flag - simplify the definition of the flags --- xen/common

[PATCH v12 05/15] vpci/header: implement guest BAR register handlers

2024-01-09 Thread Stewart Hildebrand
returning default ~0 on read may confuse guest OS. Introduce is_hwdom convenience variable and convert an existing is_hardware_domain() check. Signed-off-by: Oleksandr Andrushchenko Signed-off-by: Volodymyr Babchuk Reviewed-by: Roger Pau Monné Signed-off-by: Stewart Hildebrand --- In v12

[PATCH v12 04/15] vpci/header: rework exit path in init_header()

2024-01-09 Thread Stewart Hildebrand
Volodymyr Babchuk Acked-by: Roger Pau Monné Signed-off-by: Stewart Hildebrand --- In v12: - s/init_bars/init_header/ - Re-order tags - Fixup scissors line In v11: - Do not remove empty line between "goto fail;" and "continue;" In v10: - Added Roger's A-b tag. In v9: - New in v9

[PATCH v12 03/15] vpci: add hooks for PCI device assign/de-assign

2024-01-09 Thread Stewart Hildebrand
-off-by: Oleksandr Andrushchenko Signed-off-by: Volodymyr Babchuk Reviewed-by: Roger Pau Monné Signed-off-by: Stewart Hildebrand --- In v12: - Add Roger's R-b - Clean up comment in xen/include/xen/vpci.h - Add comment in xen/drivers/passthrough/pci.c:deassign_device() to clarify

[PATCH v12 02/15] vpci: restrict unhandled read/write operations for guests

2024-01-09 Thread Stewart Hildebrand
sure only hardware domain can access the hardware directly and restrict guests from doing so. Suggested-by: Roger Pau Monné Signed-off-by: Oleksandr Andrushchenko Signed-off-by: Volodymyr Babchuk Reviewed-by: Roger Pau Monné Signed-off-by: Stewart Hildebrand --- Since v9: - removed stray

[PATCH v12 01/15] vpci: use per-domain PCI lock to protect vpci structure

2024-01-09 Thread Stewart Hildebrand
her access to pdev->vpci is made 5. Use d->pci_lock around for_each_pdev and pci_get_pdev_by_domain while accessing pdevs in vpci code. Suggested-by: Roger Pau Monné Suggested-by: Jan Beulich Signed-off-by: Oleksandr Andrushchenko Signed-off-by: Volodymyr Babchuk Signed-off-by: Stewart

[PATCH v12 00/15] PCI devices passthrough on Arm, part 3

2024-01-09 Thread Stewart Hildebrand
s per BAR vpci/header: program p2m with guest BAR view vpci/header: emulate PCI_COMMAND register for guests vpci: add initial support for virtual PCI bus topology xen/arm: translate virtual PCI bus topology for guests xen/arm: account IO handlers for emulated PCI MSI-X Stewart Hildebrand

Re: [RFC XEN PATCH v4 1/5] xen/vpci: Clear all vpci status of device

2024-01-09 Thread Stewart Hildebrand
On 1/5/24 02:09, Jiqian Chen wrote: > diff --git a/xen/drivers/pci/physdev.c b/xen/drivers/pci/physdev.c > index 42db3e6d133c..552ccbf747cb 100644 > --- a/xen/drivers/pci/physdev.c > +++ b/xen/drivers/pci/physdev.c > @@ -67,6 +68,39 @@ ret_t pci_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) >

Re: [PATCH v11 11/17] vpci/header: program p2m with guest BAR view

2024-01-04 Thread Stewart Hildebrand
On 12/21/23 10:59, Roger Pau Monné wrote: > On Sat, Dec 02, 2023 at 01:27:05AM +, Volodymyr Babchuk wrote: >> From: Oleksandr Andrushchenko >> >> Take into account guest's BAR view and program its p2m accordingly: >> gfn is guest's view of the BAR and mfn is the physical BAR value. >> This

  1   2   3   4   5   >