[PATCH v5 04/10] xen/arm: Mark device as PCI while creating one

2021-10-07 Thread Oleksandr Andrushchenko
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

[PATCH v5 05/10] xen/domain: Call pci_release_devices() when releasing domain resources

2021-10-07 Thread Oleksandr Andrushchenko
From: Oleksandr Tyshchenko This is the very same that we already do for DT devices. Moreover, x86 already calls pci_release_devices(). Signed-off-by: Oleksandr Tyshchenko Signed-off-by: Oleksandr Andrushchenko Reviewed-by: Stefano Stabellini Reviewed-by: Rahul Singh Tested-by: Rahul Singh

[PATCH v5 06/10] libxl: Allow removing PCI devices for all types of domains

2021-10-07 Thread Oleksandr Andrushchenko
From: Oleksandr Andrushchenko The PCI device remove path may now be used by PVH on ARM, so the assert is no longer valid. Signed-off-by: Oleksandr Andrushchenko Acked-by: Stefano Stabellini Reviewed-by: Rahul Singh Tested-by: Rahul Singh --- Cc: Ian Jackson Cc: Juergen Gross --- tools

[PATCH v5 07/10] libxl: Only map legacy PCI IRQs if they are supported

2021-10-07 Thread Oleksandr Andrushchenko
From: Oleksandr Andrushchenko Arm's PCI passthrough implementation doesn't support legacy interrupts, but MSI/MSI-X. This can be the case for other platforms too. For that reason introduce a new CONFIG_PCI_SUPP_LEGACY_IRQ and add it to the CFLAGS and compile the relevant code in the

[PATCH v5 08/10] xen/arm: Setup MMIO range trap handlers for hardware domain

2021-10-07 Thread Oleksandr Andrushchenko
From: Oleksandr Andrushchenko In order for vPCI to work it needs to maintain guest and hardware domain's views of the configuration space. For example, BARs and COMMAND registers require emulation for guests and the guest view of the registers needs to be in sync with the real contents o

[PATCH v5 09/10] xen/arm: Do not map PCI ECAM and MMIO space to Domain-0's p2m

2021-10-07 Thread Oleksandr Andrushchenko
From: Oleksandr Andrushchenko PCI host bridges are special devices in terms of implementing PCI passthrough. According to [1] the current implementation depends on Domain-0 to perform the initialization of the relevant PCI host bridge hardware and perform PCI device enumeration. In order to

[PATCH v5 10/10] xen/arm: Process pending vPCI map/unmap operations

2021-10-07 Thread Oleksandr Andrushchenko
From: Oleksandr Andrushchenko vPCI may map and unmap PCI device memory (BARs) being passed through which may take a lot of time. For this those operations may be deferred to be performed later, so that they can be safely preempted. Currently this deferred processing is happening in common IOREQ

Re: [PATCH v5 01/11] xen/arm: xc_domain_ioport_permission(..) not supported on ARM.

2021-10-11 Thread Oleksandr Andrushchenko
Hi, all On 11.10.21 16:40, Bertrand Marquis wrote: > Hi Roger, > > + Oleksandr to have a better PCI expert then me. > >> On 11 Oct 2021, at 14:20, Roger Pau Monné wrote: >> >> On Mon, Oct 11, 2021 at 12:11:04PM +, Bertrand Marquis wrote: >>> Hi Roger, >>> On 11 Oct 2021, at 12:47, Roger

Re: [PATCH v5 06/10] libxl: Allow removing PCI devices for all types of domains

2021-10-11 Thread Oleksandr Andrushchenko
Hi, Anthony! On 11.10.21 19:11, Anthony PERARD wrote: > On Fri, Oct 08, 2021 at 08:55:31AM +0300, Oleksandr Andrushchenko wrote: >> From: Oleksandr Andrushchenko >> >> The PCI device remove path may now be used by PVH on ARM, so the >> assert is no longer valid. &g

Re: [PATCH v5 08/11] xen/arm: Enable the existing x86 virtual PCI support for ARM.

2021-10-11 Thread Oleksandr Andrushchenko
On 11.10.21 19:12, Bertrand Marquis wrote: > Hi Roger, > >> On 11 Oct 2021, at 11:51, Roger Pau Monné wrote: >> >> On Wed, Oct 06, 2021 at 06:40:34PM +0100, Rahul Singh wrote: >>> The existing VPCI support available for X86 is adapted for Arm. >>> When the device is added to XEN via the hyper ca

Re: [PATCH v5 08/11] xen/arm: Enable the existing x86 virtual PCI support for ARM.

2021-10-11 Thread Oleksandr Andrushchenko
On 11.10.21 20:15, Bertrand Marquis wrote: > Hi Roger, > >> On 11 Oct 2021, at 17:43, Roger Pau Monné wrote: >> >> On Mon, Oct 11, 2021 at 04:20:14PM +, Oleksandr Andrushchenko wrote: >>> >>> On 11.10.21 19:12, Bertrand Marquis wrote: >>

Re: [PATCH v5 08/11] xen/arm: Enable the existing x86 virtual PCI support for ARM.

2021-10-11 Thread Oleksandr Andrushchenko
On 11.10.21 22:27, Stefano Stabellini wrote: > On Mon, 11 Oct 2021, Oleksandr Andrushchenko wrote: >> On 11.10.21 20:15, Bertrand Marquis wrote: >>> Hi Roger, >>> >>>> On 11 Oct 2021, at 17:43, Roger Pau Monné wrote: >>>> >>>> On

Re: [PATCH v5 01/11] xen/arm: xc_domain_ioport_permission(..) not supported on ARM.

2021-10-12 Thread Oleksandr Andrushchenko
On 12.10.21 12:32, Jan Beulich wrote: > On 12.10.2021 10:41, Bertrand Marquis wrote: >> Hi Jan, >> >>> On 12 Oct 2021, at 09:29, Jan Beulich wrote: >>> >>> On 11.10.2021 19:11, Bertrand Marquis wrote: > On 11 Oct 2021, at 17:32, Roger Pau Monné wrote: > On Mon, Oct 11, 2021 at 02:16:19P

Re: [PATCH v5 01/11] xen/arm: xc_domain_ioport_permission(..) not supported on ARM.

2021-10-12 Thread Oleksandr Andrushchenko
On 12.10.21 13:01, Jan Beulich wrote: > On 12.10.2021 11:38, Oleksandr Andrushchenko wrote: >> On 12.10.21 12:32, Jan Beulich wrote: >>> On 12.10.2021 10:41, Bertrand Marquis wrote: >>>>> On 12 Oct 2021, at 09:29, Jan Beulich wrote: >>>>> On 11.1

Re: [PATCH v5 08/11] xen/arm: Enable the existing x86 virtual PCI support for ARM.

2021-10-13 Thread Oleksandr Andrushchenko
On 13.10.21 16:00, Jan Beulich wrote: > On 13.10.2021 10:45, Roger Pau Monné wrote: >> On Wed, Oct 06, 2021 at 06:40:34PM +0100, Rahul Singh wrote: >>> The existing VPCI support available for X86 is adapted for Arm. >>> When the device is added to XEN via the hyper call >>> “PHYSDEVOP_pci_device_

Re: [PATCH v8 2/5] xen/arm: Enable the existing x86 virtual PCI support for ARM

2021-10-18 Thread Oleksandr Andrushchenko
Hi, Jan! On 18.10.21 10:47, Jan Beulich wrote: > On 15.10.2021 18:51, Bertrand Marquis wrote: >> --- /dev/null >> +++ b/xen/arch/arm/vpci.c >> @@ -0,0 +1,77 @@ >> +/* >> + * xen/arch/arm/vpci.c >> + * >> + * This program is free software; you can redistribute it and/or modify >> + * it under the t

Re: [PATCH v8 2/5] xen/arm: Enable the existing x86 virtual PCI support for ARM

2021-10-18 Thread Oleksandr Andrushchenko
On 18.10.21 13:29, Jan Beulich wrote: > On 18.10.2021 12:11, Bertrand Marquis wrote: >>> On 18 Oct 2021, at 08:47, Jan Beulich wrote: >>> On 15.10.2021 18:51, Bertrand Marquis wrote: --- /dev/null +++ b/xen/arch/arm/vpci.c @@ -0,0 +1,77 @@ +/* + * xen/arch/arm/vpci.c >>>

Re: [PATCH v8 2/5] xen/arm: Enable the existing x86 virtual PCI support for ARM

2021-10-18 Thread Oleksandr Andrushchenko
On 18.10.21 17:19, Jan Beulich wrote: > On 18.10.2021 16:07, Oleksandr Andrushchenko wrote: >> On 18.10.21 13:29, Jan Beulich wrote: >>> On 18.10.2021 12:11, Bertrand Marquis wrote: >>>>> On 18 Oct 2021, at 08:47, Jan Beulich wrote: >>>>

Re: [PATCH v2 1/2] mm: introduce INVALID_{G,M}FN_RAW

2021-12-10 Thread Oleksandr Andrushchenko
D_PFN is unused, and with x86'es paging_mark_pfn_dirty() > being the only user of pfn_t it also doesn't seem likely that new uses > would appear, remove that one at this same occasion. > > Signed-off-by: Jan Beulich With the above nit fixed: Reviewed-by: Oleksandr Andrushc

[PATCH] tools: remove xenstore entries on vchan server closure

2021-12-10 Thread Oleksandr Andrushchenko
From: Oleksandr Andrushchenko vchan server creates XenStore entries to advertise its event channel and ring, but those are not removed after the server quits. Add additional cleanup step, so those are removed, so clients do not try to connect to a non-existing server. Signed-off-by: Oleksandr

Re: [PATCH v2 2/2] memory: XENMEM_add_to_physmap (almost) wrapping checks

2021-12-10 Thread Oleksandr Andrushchenko
Hi, Jan! On 10.12.21 11:40, Jan Beulich wrote: > Determining that behavior is correct (i.e. results in failure) for a > passed in GFN equaling INVALID_GFN is non-trivial. Make this quite a bit > more obvious by checking input in generic code - both for singular > requests to not match the value an

Re: [PATCH v8 2/4] xen/arm: setup MMIO range trap handlers for hardware domain

2021-12-10 Thread Oleksandr Andrushchenko
Hi, Julien! On 10.12.21 19:52, Julien Grall wrote: > Hi Oleksandr, > > On 09/12/2021 07:29, Oleksandr Andrushchenko wrote: >> +unsigned int domain_vpci_get_num_mmio_handlers(struct domain *d) >> +{ >> +    if ( !has_vpci(d) ) >> +    return 0; >&

Re: [PATCH v5 02/14] vpci: fix function attributes for vpci_process_pending

2021-12-11 Thread Oleksandr Andrushchenko
Hi, Roger! On 11.12.21 10:20, Roger Pau Monné wrote: > On Fri, Dec 10, 2021 at 05:55:03PM +, Julien Grall wrote: >> Hi Oleksandr, >> >> On 25/11/2021 11:02, Oleksandr Andrushchenko wrote: >>> From: Oleksandr Andrushchenko >>> >>> vpci_process_p

Re: [PATCH v5 01/14] rangeset: add RANGESETF_no_print flag

2021-12-14 Thread Oleksandr Andrushchenko
Hi, Volodymyr! On 15.12.21 05:20, Volodymyr Babchuk wrote: > Hi Oleksandr, > > Sorry for jumping in amid v5, but... > > Oleksandr Andrushchenko writes: > >> From: Oleksandr Andrushchenko >> >> There are range sets which should not be printed, so introduce a f

Re: [RFC v1 1/5] xen/arm: add support for Renesas R-Car Gen3 platform

2021-12-14 Thread Oleksandr Andrushchenko
Hi, Oleksii! On 14.12.21 11:34, Oleksii Moisieiev wrote: > Implementation includes platform-specific smc handler for rcar3 platform. > > Signed-off-by: Oleksii Moisieiev Reviewed-by: Oleksandr Andrushchenko > --- > xen/arch/arm/platforms/Makefile | 1 + > xen/arch/arm

Re: [PATCH v5 00/14] PCI devices passthrough on Arm, part 3

2021-12-15 Thread Oleksandr Andrushchenko
Dear rest maintainers! Could you please review this series which seems to get stuck? Thank you in advance, Oleksandr On 25.11.21 13:02, Oleksandr Andrushchenko wrote: > From: Oleksandr Andrushchenko > > Hi, all! > > 1. This patch series is focusing on vPCI and adds support f

Re: [PATCH v5 00/14] PCI devices passthrough on Arm, part 3

2021-12-15 Thread Oleksandr Andrushchenko
Hi, Jan! On 15.12.21 14:07, Jan Beulich wrote: > On 15.12.2021 12:56, Oleksandr Andrushchenko wrote: >> Dear rest maintainers! >> >> Could you please review this series which seems to get stuck? > I don't seem to have any record of you having pinged Roger as the vP

Re: [PATCH v5 00/14] PCI devices passthrough on Arm, part 3

2021-12-15 Thread Oleksandr Andrushchenko
Hi, Roger! On 15.12.21 16:51, Roger Pau Monné wrote: > On Wed, Dec 15, 2021 at 12:22:32PM +0000, Oleksandr Andrushchenko wrote: >> Hi, Jan! >> >> On 15.12.21 14:07, Jan Beulich wrote: >>> On 15.12.2021 12:56, Oleksandr Andrushchenko wrote: >>>> Dear re

Re: [PATCH v8 0/4] PCI devices passthrough on Arm, part 2

2021-12-15 Thread Oleksandr Andrushchenko
Hi, Julien! On 15.12.21 19:48, Julien Grall wrote: > On 09/12/2021 07:29, Oleksandr Andrushchenko wrote: >> From: Oleksandr Andrushchenko >> >> Hi, all! > > Hi Oleksandr, > >> This is an assorted series of patches which aim is to make some further >> bas

Re: [PATCH v4] is_system_domain: replace open-coded instances

2022-01-04 Thread Oleksandr Andrushchenko
id inline function. > > Signed-off-by: Christopher Clark > Signed-off-by: Daniel P. Smith > Acked-by: Dario Faggioli Reviewed-by: Oleksandr Andrushchenko > --- > xen/arch/x86/cpu/mcheck/mce.c | 2 +- > xen/arch/x86/cpu/vpmu.c | 2 +- > xen/common/domain.

Re: [PATCH v5 02/14] vpci: fix function attributes for vpci_process_pending

2022-01-26 Thread Oleksandr Andrushchenko
Hi, Roger! On 11.12.21 10:57, Oleksandr Andrushchenko wrote: > Hi, Roger! > > On 11.12.21 10:20, Roger Pau Monné wrote: >> On Fri, Dec 10, 2021 at 05:55:03PM +, Julien Grall wrote: >>> Hi Oleksandr, >>> >>> On 25/11/2021 11:02, Oleksandr Andrushchenko

Re: [PATCH v5 03/14] vpci: move lock outside of struct vpci

2022-01-26 Thread Oleksandr Andrushchenko
Hello, Roger, Jan! On 12.01.22 16:42, Jan Beulich wrote: > On 11.01.2022 16:17, Roger Pau Monné wrote: >> On Thu, Nov 25, 2021 at 01:02:40PM +0200, Oleksandr Andrushchenko wrote: >>> diff --git a/xen/drivers/vpci/vpci.c b/xen/drivers/vpci/vpci.c >>> index 657697

Re: [PATCH v5 04/14] vpci: cancel pending map/unmap on vpci removal

2022-01-28 Thread Oleksandr Andrushchenko
On 12.01.22 17:27, Jan Beulich wrote: > On 25.11.2021 12:02, Oleksandr Andrushchenko wrote: >> From: Oleksandr Andrushchenko >> >> When a vPCI is removed for a PCI device it is possible that we have >> scheduled a delayed work for map/unmap operations for that

Re: [PATCH v5 14/14] vpci: add TODO for the registers not explicitly handled

2022-01-28 Thread Oleksandr Andrushchenko
Hello, Roger, Jan! On 13.01.22 15:38, Jan Beulich wrote: > On 13.01.2022 14:27, Roger Pau Monné wrote: >> On Thu, Nov 25, 2021 at 12:17:32PM +0100, Jan Beulich wrote: >>> On 25.11.2021 12:02, Oleksandr Andrushchenko wrote: >>>> From: Oleksandr Andrushchenko >

Re: [PATCH v5 03/14] vpci: move lock outside of struct vpci

2022-01-28 Thread Oleksandr Andrushchenko
Hi, Roger, Jan! On 13.01.22 10:58, Roger Pau Monné wrote: > On Wed, Jan 12, 2022 at 04:52:51PM +0100, Jan Beulich wrote: >> On 12.01.2022 16:42, Roger Pau Monné wrote: >>> On Wed, Jan 12, 2022 at 03:57:36PM +0100, Jan Beulich wrote: >>>> On 25.11.2021 12:02,

Re: [PATCH v5 03/14] vpci: move lock outside of struct vpci

2022-01-28 Thread Oleksandr Andrushchenko
Hi, Jan! On 12.01.22 16:57, Jan Beulich wrote: > On 25.11.2021 12:02, Oleksandr Andrushchenko wrote: >> @@ -68,12 +84,13 @@ int vpci_add_handlers(struct pci_dev *pdev) >> /* We should not get here twice for the same device. */ >> ASSERT(!pdev->vpci); >>

Re: [PATCH v5 03/14] vpci: move lock outside of struct vpci

2022-01-30 Thread Oleksandr Andrushchenko
Hi, Jan, Roger! On 26.01.22 13:13, Roger Pau Monné wrote: > On Wed, Jan 26, 2022 at 08:40:09AM +0000, Oleksandr Andrushchenko wrote: >> Hello, Roger, Jan! >> >> On 12.01.22 16:42, Jan Beulich wrote: >>> On 11.01.2022 16:17, Roger Pau Monné wrote: >>>>

Re: [PATCH v5 04/14] vpci: cancel pending map/unmap on vpci removal

2022-01-30 Thread Oleksandr Andrushchenko
I am going to postpone this patch as it does need major re-thinking on the approach to take. This is possible as it fixes a really rare use-case seen during development phase, so shouldn't hurt the run-time Thank you, Oleksandr On 25.11.21 13:02, Oleksandr Andrushchenko wrote: > From: O

Re: [PATCH v5 05/14] vpci: add hooks for PCI device assign/de-assign

2022-01-31 Thread Oleksandr Andrushchenko
Hi, Roger! On 12.01.22 14:12, Roger Pau Monné wrote: > On Thu, Nov 25, 2021 at 01:02:42PM +0200, Oleksandr Andrushchenko wrote: >> From: Oleksandr Andrushchenko >> >> When a PCI device gets assigned/de-assigned some work on vPCI side needs >> to be done for that device

Re: [PATCH v5 05/14] vpci: add hooks for PCI device assign/de-assign

2022-01-31 Thread Oleksandr Andrushchenko
Hi, Roger! On 13.01.22 13:40, Roger Pau Monné wrote: > On Thu, Nov 25, 2021 at 01:02:42PM +0200, Oleksandr Andrushchenko wrote: >> From: Oleksandr Andrushchenko >> +#ifdef CONFIG_HAS_VPCI_GUEST_SUPPORT >> +/* Notify vPCI that device is assigned to guest. */ >> +in

Re: [PATCH v5 03/14] vpci: move lock outside of struct vpci

2022-01-31 Thread Oleksandr Andrushchenko
Hi, Roger! On 31.01.22 10:56, Roger Pau Monné wrote: > On Fri, Jan 28, 2022 at 02:15:08PM +0000, Oleksandr Andrushchenko wrote: >> Hi, Roger, Jan! >> >> On 13.01.22 10:58, Roger Pau Monné wrote: >>> On Wed, Jan 12, 2022 at 04:52:51PM +0100, Jan Beulich wrote: >&

Re: [PATCH v5 06/14] vpci/header: implement guest BAR register handlers

2022-01-31 Thread Oleksandr Andrushchenko
Hi, Roger! On 12.01.22 14:35, Roger Pau Monné wrote: > On Thu, Nov 25, 2021 at 01:02:43PM +0200, Oleksandr Andrushchenko wrote: >> From: Oleksandr Andrushchenko >> >> Add relevant vpci register handlers when assigning PCI device to a domain >> and remove those whe

Re: [PATCH v5 06/14] vpci/header: implement guest BAR register handlers

2022-01-31 Thread Oleksandr Andrushchenko
Hi, Roger! On 12.01.22 19:34, Roger Pau Monné wrote: > A couple more comments I realized while walking the dog. > > On Thu, Nov 25, 2021 at 01:02:43PM +0200, Oleksandr Andrushchenko wrote: >> From: Oleksandr Andrushchenko >> >> Add relevant vpci register handlers whe

Re: [PATCH v5 06/14] vpci/header: implement guest BAR register handlers

2022-01-31 Thread Oleksandr Andrushchenko
On 31.01.22 11:47, Oleksandr Andrushchenko wrote: > Hi, Roger! > > On 12.01.22 14:35, Roger Pau Monné wrote: >> >>> +static void guest_rom_write(const struct pci_dev *pdev, unsigned int reg, >>> +uint32_t val, void *data) >>

Re: [PATCH v5 06/14] vpci/header: implement guest BAR register handlers

2022-01-31 Thread Oleksandr Andrushchenko
Hi, Jan! On 31.01.22 12:54, Jan Beulich wrote: > On 31.01.2022 11:40, Oleksandr Andrushchenko wrote: >> On 31.01.22 11:47, Oleksandr Andrushchenko wrote: >>> Hi, Roger! >>> >>> On 12.01.22 14:35, Roger Pau Monné wrote: >>>>> +static void guest

Re: [PATCH v5 06/14] vpci/header: implement guest BAR register handlers

2022-01-31 Thread Oleksandr Andrushchenko
On 31.01.22 13:10, Roger Pau Monné wrote: > On Mon, Jan 31, 2022 at 10:40:47AM +0000, Oleksandr Andrushchenko wrote: >> On 31.01.22 11:47, Oleksandr Andrushchenko wrote: >>> Hi, Roger! >>> >>> On 12.01.22 14:35, Roger Pau Monné wrote: >>>>> +sta

Re: [PATCH v5 06/14] vpci/header: implement guest BAR register handlers

2022-01-31 Thread Oleksandr Andrushchenko
On 31.01.22 13:27, Roger Pau Monné wrote: > On Mon, Jan 31, 2022 at 11:04:29AM +0000, Oleksandr Andrushchenko wrote: >> Hi, Jan! >> >> On 31.01.22 12:54, Jan Beulich wrote: >>> On 31.01.2022 11:40, Oleksandr Andrushchenko wrote: >>>> On 31.01.22 11:4

Re: [PATCH v5 06/14] vpci/header: implement guest BAR register handlers

2022-01-31 Thread Oleksandr Andrushchenko
On 31.01.22 13:39, Jan Beulich wrote: > On 31.01.2022 12:23, Oleksandr Andrushchenko wrote: >> On 31.01.22 13:10, Roger Pau Monné wrote: >>> Right (see my previous reply to this comment). I think it would be >>> easier (and cleaner) if you switched the default behav

Re: [PATCH v5 06/14] vpci/header: implement guest BAR register handlers

2022-01-31 Thread Oleksandr Andrushchenko
On 31.01.22 15:36, Jan Beulich wrote: > On 31.01.2022 14:30, Oleksandr Andrushchenko wrote: >> >> On 31.01.22 13:39, Jan Beulich wrote: >>> On 31.01.2022 12:23, Oleksandr Andrushchenko wrote: >>>> On 31.01.22 13:10, Roger Pau Monné wrote: >>>>&g

Re: [PATCH v5 06/14] vpci/header: implement guest BAR register handlers

2022-01-31 Thread Oleksandr Andrushchenko
On 31.01.22 15:51, Jan Beulich wrote: > On 31.01.2022 14:41, Oleksandr Andrushchenko wrote: >> On 31.01.22 15:36, Jan Beulich wrote: >>> On 31.01.2022 14:30, Oleksandr Andrushchenko wrote: >>>> On 31.01.22 13:39, Jan Beulich wrote: >>>>> On 31

Re: [PATCH v5 06/14] vpci/header: implement guest BAR register handlers

2022-01-31 Thread Oleksandr Andrushchenko
>>> I wonder whether we need to protect the added code with >>> CONFIG_HAS_VPCI_GUEST_SUPPORT, this would effectively be dead code >>> otherwise. Long term I don't think we wish to differentiate between >>> dom0 and domU vPCI support at build time, so I'm unsure whether it's >>> helpful to pollute

Re: [PATCH v5 06/14] vpci/header: implement guest BAR register handlers

2022-01-31 Thread Oleksandr Andrushchenko
Hi, Roger! >> rom->type = VPCI_BAR_EMPTY; >> } >> diff --git a/xen/include/xen/vpci.h b/xen/include/xen/vpci.h >> index ed127a08a953..0a73b14a92dc 100644 >> --- a/xen/include/xen/vpci.h >> +++ b/xen/include/xen/vpci.h >> @@ -68,7 +68,10 @@ struct vpci { >> struct vpci_head

Re: [PATCH v5 06/14] vpci/header: implement guest BAR register handlers

2022-01-31 Thread Oleksandr Andrushchenko
On 31.01.22 17:50, Jan Beulich wrote: > On 31.01.2022 16:06, Oleksandr Andrushchenko wrote: >> Hi, Roger! >>>>rom->type = VPCI_BAR_EMPTY; >>>>} >>>> diff --git a/xen/include/xen/vpci.h b/xen/include/xen/vpci.h >>>

Re: [PATCH v5 05/14] vpci: add hooks for PCI device assign/de-assign

2022-02-01 Thread Oleksandr Andrushchenko
Hi, Roger! On 31.01.22 10:45, Oleksandr Andrushchenko wrote: > Hi, Roger! > > On 13.01.22 13:40, Roger Pau Monné wrote: >> On Thu, Nov 25, 2021 at 01:02:42PM +0200, Oleksandr Andrushchenko wrote: >>> From: Oleksandr Andrushchenko >>> +#ifdef CONFIG_HAS_VPCI_GUEST

Re: [PATCH v5 06/14] vpci/header: implement guest BAR register handlers

2022-02-01 Thread Oleksandr Andrushchenko
Hi, Roger! On 01.02.22 12:10, Roger Pau Monné wrote: > On Tue, Feb 01, 2022 at 07:31:31AM +0000, Oleksandr Andrushchenko wrote: >> >> On 31.01.22 17:50, Jan Beulich wrote: >>> On 31.01.2022 16:06, Oleksandr Andrushchenko wrote: >>>> Hi, Roger! >>>&

[PATCH 2/4] rangeset: add rangeset_reset helper function

2022-02-01 Thread Oleksandr Andrushchenko
From: Oleksandr Andrushchenko This helper destroys all the ranges of the rangeset given. Please note, that it uses rangeset_remove_range which returns an error code on failure. This error code can be ignored as while destroying all the ranges no memory allocation is expected, so in this case it

[PATCH 0/4] PCI devices passthrough pre-req patches

2022-02-01 Thread Oleksandr Andrushchenko
From: Oleksandr Andrushchenko Hi, all! While working on vPCI series [1] I have created number of patches that either add some useful helpers or serve as the ground for the upcoming vPCI changes or both. To ease the task of reviewing the bigger vPCI series I am sending these now with the hope

[PATCH 3/4] vpci: shrink critical section in vpci_{read/write}

2022-02-01 Thread Oleksandr Andrushchenko
From: Oleksandr Andrushchenko Shrink critical section in vpci_{read/write} as racing calls to vpci_{read,write}_hw() shouldn't be a problem. Those are just wrappers around pci_conf_{read,write} functions, and the required locking (in case of using the IO ports) is already taken care in pci_

[PATCH 4/4] vpci: move lock outside of struct vpci

2022-02-01 Thread Oleksandr Andrushchenko
dropped prior to freeing pdev->vpci. Signed-off-by: Roger Pau Monné Signed-off-by: Oleksandr Andrushchenko --- Cc: Andrew Cooper Cc: Jan Beulich Cc: Julien Grall Cc: Stefano Stabellini --- New in v5 of this series: this is an updated version of the patch published at https://lore.kernel.

[PATCH 1/4] rangeset: add RANGESETF_no_print flag

2022-02-01 Thread Oleksandr Andrushchenko
From: Oleksandr Andrushchenko There are range sets which should not be printed, so introduce a flag which allows marking those as such. Implement relevant logic to skip such entries while printing. While at it also simplify the definition of the flags by directly defining those without helpers

Re: [PATCH 2/4] rangeset: add rangeset_reset helper function

2022-02-01 Thread Oleksandr Andrushchenko
Hi, Julien! On 01.02.22 19:05, Julien Grall wrote: > Hi, > > On 01/02/2022 16:25, Oleksandr Andrushchenko wrote: >> From: Oleksandr Andrushchenko >> >> This helper destroys all the ranges of the rangeset given. >> Please note, that it uses rangeset_remove_range

Re: [PATCH 2/4] rangeset: add rangeset_reset helper function

2022-02-01 Thread Oleksandr Andrushchenko
On 01.02.22 19:33, Julien Grall wrote: > > > On 01/02/2022 17:14, Oleksandr Andrushchenko wrote: >> On 01.02.22 19:05, Julien Grall wrote: >>> On 01/02/2022 16:25, Oleksandr Andrushchenko wrote: >>>> From: Oleksandr Andrushchenko >>>> >>

Re: [PATCH v5 07/14] vpci/header: handle p2m range sets per BAR

2022-02-01 Thread Oleksandr Andrushchenko
Hi, Roger! On 12.01.22 17:15, Roger Pau Monné wrote: > On Thu, Nov 25, 2021 at 01:02:44PM +0200, Oleksandr Andrushchenko wrote: >> From: Oleksandr Andrushchenko >> >> Instead of handling a single range set, that contains all the memory >> regions of all the BARs and RO

Re: [PATCH v5 08/14] vpci/header: program p2m with guest BAR view

2022-02-02 Thread Oleksandr Andrushchenko
Hi, Roger! On 13.01.22 12:22, Roger Pau Monné wrote: > On Thu, Nov 25, 2021 at 01:02:45PM +0200, Oleksandr Andrushchenko wrote: >> From: Oleksandr Andrushchenko >> >> Take into account guest's BAR view and program its p2m accordingly: >> gfn is guest's view o

Re: [PATCH 0/4] PCI devices passthrough pre-req patches

2022-02-02 Thread Oleksandr Andrushchenko
Hi, Jan! On 02.02.22 10:48, Jan Beulich wrote: > On 01.02.2022 17:25, Oleksandr Andrushchenko wrote: >> Oleksandr Andrushchenko (3): >>rangeset: add RANGESETF_no_print flag >>rangeset: add rangeset_reset helper function >>vpci: shrink critical section in vp

Re: [PATCH 3/4] vpci: shrink critical section in vpci_{read/write}

2022-02-02 Thread Oleksandr Andrushchenko
Hi, Jan! On 02.02.22 11:05, Jan Beulich wrote: > On 02.02.2022 09:44, Roger Pau Monné wrote: >> On Tue, Feb 01, 2022 at 06:25:07PM +0200, Oleksandr Andrushchenko wrote: >>> From: Oleksandr Andrushchenko > Oleksandr, can you please clarify authorship here? The rule of

Re: [PATCH v5 08/14] vpci/header: program p2m with guest BAR view

2022-02-02 Thread Oleksandr Andrushchenko
>>> +gdprintk(XENLOG_G_DEBUG, >>> + "%smap [%lx, %lx] -> %#"PRI_gfn" for %pd\n", >>> + map->map ? "" : "un", s, e, gfn_x(start_gfn), >>> + map->d); >> That's too chatty IMO, I could be fine with printing something along >> this lines from mod

Re: [PATCH 3/4] vpci: shrink critical section in vpci_{read/write}

2022-02-02 Thread Oleksandr Andrushchenko
On 02.02.22 11:45, Jan Beulich wrote: > On 02.02.2022 10:38, Oleksandr Andrushchenko wrote: >> On 02.02.22 11:05, Jan Beulich wrote: >>> On 02.02.2022 09:44, Roger Pau Monné wrote: >>>> On Tue, Feb 01, 2022 at 06:25:07PM +0200, Oleksandr Andrushchenko wrote: >&

Re: [PATCH v5 07/14] vpci/header: handle p2m range sets per BAR

2022-02-02 Thread Oleksandr Andrushchenko
Hi, Roger! On 02.02.22 11:56, Roger Pau Monné wrote: > On Wed, Feb 02, 2022 at 06:44:41AM +0000, Oleksandr Andrushchenko wrote: >> Hi, Roger! >> >> On 12.01.22 17:15, Roger Pau Monné wrote: >>> On Thu, Nov 25, 2021 at 01:02:44PM +0200, Oleksandr Andrushchenko wrote:

Re: [PATCH 4/4] vpci: move lock outside of struct vpci

2022-02-02 Thread Oleksandr Andrushchenko
Hi, Roger! On 02.02.22 11:45, Roger Pau Monné wrote: > On Tue, Feb 01, 2022 at 06:25:08PM +0200, Oleksandr Andrushchenko wrote: >> From: Roger Pau Monne >> >> This way the lock can be used to check whether vpci is present, and >> removal can be performed while holding

Re: [PATCH v5 08/14] vpci/header: program p2m with guest BAR view

2022-02-02 Thread Oleksandr Andrushchenko
On 02.02.22 12:34, Roger Pau Monné wrote: > On Wed, Feb 02, 2022 at 09:46:21AM +0000, Oleksandr Andrushchenko wrote: >>>>> +gdprintk(XENLOG_G_DEBUG, >>>>> + "%smap [%lx, %lx] -> %#"PRI_gfn" for %pd\n", >>>

Re: [PATCH 4/4] vpci: move lock outside of struct vpci

2022-02-02 Thread Oleksandr Andrushchenko
Hi, Jan! On 02.02.22 11:22, Jan Beulich wrote: > On 01.02.2022 17:25, Oleksandr Andrushchenko wrote: >> From: Roger Pau Monne >> >> This way the lock can be used to check whether vpci is present, and >> removal can be performed while holding the lock, in order t

Re: [PATCH v5 08/14] vpci/header: program p2m with guest BAR view

2022-02-02 Thread Oleksandr Andrushchenko
On 02.02.22 13:11, Jan Beulich wrote: > On 02.02.2022 11:44, Oleksandr Andrushchenko wrote: >> Again, IMO, adding such a big piece of DEBUG code instead of >> printing a single DEBUG message could be a bit expansive. >> I still hear your concerns on *when* it is printed, b

Re: [PATCH 4/4] vpci: move lock outside of struct vpci

2022-02-02 Thread Oleksandr Andrushchenko
On 02.02.22 13:14, Jan Beulich wrote: > On 02.02.2022 12:03, Oleksandr Andrushchenko wrote: >> On 02.02.22 11:22, Jan Beulich wrote: >>> On 01.02.2022 17:25, Oleksandr Andrushchenko wrote: >>>> From: Roger Pau Monne >>>> >>>> This way the

Re: [PATCH v5 09/14] vpci/header: emulate PCI_COMMAND register for guests

2022-02-02 Thread Oleksandr Andrushchenko
Hi, Roger! On 13.01.22 12:50, Roger Pau Monné wrote: > On Thu, Nov 25, 2021 at 01:02:46PM +0200, Oleksandr Andrushchenko wrote: >> From: Oleksandr Andrushchenko >> >> Add basic emulation support for guests. At the moment only emulate >> PCI_COMMAND_INTX_DISABLE bit, t

Re: [PATCH v5 10/14] vpci/header: reset the command register when adding devices

2022-02-02 Thread Oleksandr Andrushchenko
Hi, Roger! On 13.01.22 13:07, Roger Pau Monné wrote: > On Thu, Nov 25, 2021 at 01:02:47PM +0200, Oleksandr Andrushchenko wrote: >> From: Oleksandr Andrushchenko >> >> Reset the command register when passing through a PCI device: >> it is possible that when passing thro

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

2022-02-02 Thread Oleksandr Andrushchenko
Hi, Jan! On 12.01.22 17:39, Jan Beulich wrote: > On 25.11.2021 12:02, Oleksandr Andrushchenko wrote: >> @@ -145,6 +148,53 @@ int vpci_add_handlers(struct pci_dev *pdev) >> } >> >> #ifdef CONFIG_HAS_VPCI_GUEST_SUPPORT >> +int vpci_add_vi

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

2022-02-02 Thread Oleksandr Andrushchenko
Hi, Roger! On 13.01.22 13:35, Roger Pau Monné wrote: > On Thu, Nov 25, 2021 at 01:02:48PM +0200, Oleksandr Andrushchenko wrote: >> From: Oleksandr Andrushchenko >> >> Assign SBDF to the PCI devices being passed through with bus 0. >> The resulting topology is where PCI

Re: [PATCH v5 09/14] vpci/header: emulate PCI_COMMAND register for guests

2022-02-02 Thread Oleksandr Andrushchenko
On 02.02.22 15:32, Jan Beulich wrote: > On 02.02.2022 13:49, Oleksandr Andrushchenko wrote: >> On 13.01.22 12:50, Roger Pau Monné wrote: >>> On Thu, Nov 25, 2021 at 01:02:46PM +0200, Oleksandr Andrushchenko wrote: >>>> --- a/xen/drivers/vpci/header.c >&g

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

2022-02-02 Thread Oleksandr Andrushchenko
Hi, Roger! On 13.01.22 14:18, Roger Pau Monné wrote: > On Thu, Nov 25, 2021 at 01:02:49PM +0200, Oleksandr Andrushchenko wrote: >> From: Oleksandr Andrushchenko >> >> There are three originators for the PCI configuration space access: >> 1. The domain that owns

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

2022-02-02 Thread Oleksandr Andrushchenko
Hi, Roger! On 13.01.22 15:23, Roger Pau Monné wrote: > On Thu, Nov 25, 2021 at 01:02:50PM +0200, Oleksandr Andrushchenko wrote: >> From: Oleksandr Andrushchenko >> >> At the moment, we always allocate an extra 16 slots for IO handlers >> (see MAX_IO_HANDLER). So while

Re: [PATCH v5 09/14] vpci/header: emulate PCI_COMMAND register for guests

2022-02-02 Thread Oleksandr Andrushchenko
On 02.02.22 16:18, Jan Beulich wrote: > On 02.02.2022 14:47, Oleksandr Andrushchenko wrote: >>> On 02.02.2022 13:49, Oleksandr Andrushchenko wrote: >>>> On 13.01.22 12:50, Roger Pau Monné wrote: >>>>> On Thu, Nov 25, 2021 at 01:02:46PM +0200, Oleksand

Re: [PATCH v5 09/14] vpci/header: emulate PCI_COMMAND register for guests

2022-02-02 Thread Oleksandr Andrushchenko
On 02.02.22 16:31, Jan Beulich wrote: > On 02.02.2022 15:26, Oleksandr Andrushchenko wrote: >> >> On 02.02.22 16:18, Jan Beulich wrote: >>> On 02.02.2022 14:47, Oleksandr Andrushchenko wrote: >>>>> On 02.02.2022 13:49, Oleksandr Andrushchenko wrote: &g

Re: [PATCH v5 09/14] vpci/header: emulate PCI_COMMAND register for guests

2022-02-02 Thread Oleksandr Andrushchenko
On 02.02.22 17:08, Jan Beulich wrote: > On 02.02.2022 16:04, Oleksandr Andrushchenko wrote: >> >> On 02.02.22 16:31, Jan Beulich wrote: >>> On 02.02.2022 15:26, Oleksandr Andrushchenko wrote: >>>> On 02.02.22 16:18, Jan Beulich wrote: >>>>>

Re: [PATCH v5 06/14] vpci/header: implement guest BAR register handlers

2022-02-03 Thread Oleksandr Andrushchenko
Hi, Bertrand! On 26.11.21 14:19, Oleksandr Andrushchenko wrote: > Hi, Bertrand! > > On 25.11.21 18:28, Bertrand Marquis wrote: >> Hi Oleksandr, >> >>> On 25 Nov 2021, at 11:02, Oleksandr Andrushchenko >>> wrote: >>> >>> From: Oleksandr A

Re: [PATCH v5 06/14] vpci/header: implement guest BAR register handlers

2022-02-03 Thread Oleksandr Andrushchenko
Hi, Roger! >> Also memory decoding needs to be initially disabled when used by >> guests, in order to prevent the BAR being placed on top of a RAM >> region. The guest physmap will be different from the host one, so it's >> possible for BARs to end up placed on top of RAM regions initially >> until

Re: [PATCH v5 06/14] vpci/header: implement guest BAR register handlers

2022-02-03 Thread Oleksandr Andrushchenko
Hi, Jan! On 03.02.22 14:44, Jan Beulich wrote: > On 03.02.2022 13:36, Oleksandr Andrushchenko wrote: >> Hi, Bertrand! >> >> On 26.11.21 14:19, Oleksandr Andrushchenko wrote: >>> Hi, Bertrand! >>> >>> On 25.11.21 18:28, Bertrand Marquis wrote: >&g

Re: [PATCH v5 06/14] vpci/header: implement guest BAR register handlers

2022-02-03 Thread Oleksandr Andrushchenko
On 03.02.22 14:50, Jan Beulich wrote: > On 03.02.2022 13:48, Oleksandr Andrushchenko wrote: >> Hi, Jan! >> >> On 03.02.22 14:44, Jan Beulich wrote: >>> On 03.02.2022 13:36, Oleksandr Andrushchenko wrote: >>>> Hi, Bertrand! >>>> >>&

Re: [PATCH v5 06/14] vpci/header: implement guest BAR register handlers

2022-02-03 Thread Oleksandr Andrushchenko
On 03.02.22 14:54, Jan Beulich wrote: > On 03.02.2022 13:45, Oleksandr Andrushchenko wrote: >>>> Also memory decoding needs to be initially disabled when used by >>>> guests, in order to prevent the BAR being placed on top of a RAM >>>> region. The guest

Re: [PATCH v5 06/14] vpci/header: implement guest BAR register handlers

2022-02-03 Thread Oleksandr Andrushchenko
On 03.02.22 16:04, Jan Beulich wrote: > On 03.02.2022 14:30, Oleksandr Andrushchenko wrote: >> >> On 03.02.22 14:54, Jan Beulich wrote: >>> On 03.02.2022 13:45, Oleksandr Andrushchenko wrote: >>>>>> Also memory decoding needs to be initially disabl

Re: [PATCH v5 06/14] vpci/header: implement guest BAR register handlers

2022-02-03 Thread Oleksandr Andrushchenko
On 03.02.22 16:05, Roger Pau Monné wrote: > On Thu, Feb 03, 2022 at 01:30:26PM +0000, Oleksandr Andrushchenko wrote: >> >> On 03.02.22 14:54, Jan Beulich wrote: >>> On 03.02.2022 13:45, Oleksandr Andrushchenko wrote: >>>>>> Also memory decoding n

[PATCH v6 03/13] vpci: move lock outside of struct vpci

2022-02-03 Thread Oleksandr Andrushchenko
vpci_read for example, since the lock was dropped prior to freeing pdev->vpci. Signed-off-by: Roger Pau Monné Signed-off-by: Oleksandr Andrushchenko --- Cc: Andrew Cooper Cc: Jan Beulich Cc: Julien Grall Cc: Stefano Stabellini --- New in v5 of this series: this is an updated version of

[PATCH v6 02/13] rangeset: add RANGESETF_no_print flag

2022-02-03 Thread Oleksandr Andrushchenko
From: Oleksandr Andrushchenko There are range sets which should not be printed, so introduce a flag which allows marking those as such. Implement relevant logic to skip such entries while printing. While at it also simplify the definition of the flags by directly defining those without helpers

[PATCH v6 05/13] vpci: add hooks for PCI device assign/de-assign

2022-02-03 Thread Oleksandr Andrushchenko
From: Oleksandr Andrushchenko When a PCI device gets assigned/de-assigned some work on vPCI side needs to be done for that device. Introduce a pair of hooks so vPCI can handle that. Signed-off-by: Oleksandr Andrushchenko --- Since v5: - do not split code into run_vpci_init - do not check for

[PATCH v6 00/13] PCI devices passthrough on Arm, part 3

2022-02-03 Thread Oleksandr Andrushchenko
From: Oleksandr Andrushchenko Hi, all! 1. This patch series is focusing on vPCI and adds support for non-identity PCI BAR mappings which is required while passing through a PCI device to a guest. The highlights are: - Add relevant vpci register handlers when assigning PCI device to a domain

[PATCH v6 04/13] vpci: restrict unhandled read/write operations for guests

2022-02-03 Thread Oleksandr Andrushchenko
From: Oleksandr Andrushchenko A guest can read and write those registers which are not emulated and have no respective vPCI handlers, so it can access the HW directly. In order to prevent a guest from reads and writes from/to the unhandled registers make sure only hardware domain can access HW

[PATCH v6 07/13] vpci/header: handle p2m range sets per BAR

2022-02-03 Thread Oleksandr Andrushchenko
From: Oleksandr Andrushchenko Instead of handling a single range set, that contains all the memory regions of all the BARs and ROM, have them per BAR. As the range sets are now created when a PCI device is added and destroyed when it is removed so make them named and accounted. Note that

[PATCH v6 01/13] xen/pci: arm: add stub for is_memory_hole

2022-02-03 Thread Oleksandr Andrushchenko
From: Oleksandr Andrushchenko Add a stub for is_memory_hole which is required for PCI passthrough on Arm. Signed-off-by: Oleksandr Andrushchenko --- Cc: Julien Grall Cc: Stefano Stabellini --- New in v6 --- xen/arch/arm/mm.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/xen

[PATCH v6 08/13] vpci/header: program p2m with guest BAR view

2022-02-03 Thread Oleksandr Andrushchenko
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 as set up by the PCI bus driver in the hardware domain. This way hardware domain sees physical BAR values and guest see

[PATCH v6 06/13] vpci/header: implement guest BAR register handlers

2022-02-03 Thread Oleksandr Andrushchenko
From: Oleksandr Andrushchenko Add relevant vpci register handlers when assigning PCI device to a domain and remove those when de-assigning. This allows having different handlers for different domains, e.g. hwdom and other guests. Emulate guest BAR register values: this allows creating a guest

<    1   2   3   4   5   6   7   8   9   10   >