xen/vpci: Move ecam access functions to common code
authorBertrand Marquis <bertrand.marquis@arm.com>
Fri, 15 Oct 2021 16:51:41 +0000 (17:51 +0100)
committerStefano Stabellini <stefano.stabellini@xilinx.com>
Fri, 15 Oct 2021 18:21:54 +0000 (11:21 -0700)
commitbe4eefbce6cada21b8a17354c1f11d7865d9a603
treeeb454e9bd48b88105f8de30c2b9642a8efc84e8b
parentf791392f82ffe39cc1ea4c4db1d877223754a04a
xen/vpci: Move ecam access functions to common code

PCI standard is using ECAM and not MCFG which is coming from ACPI[1].
Use ECAM/ecam instead of MCFG in common code and in new functions added
in common vpci code by this patch.

Move vpci_access_allowed from arch/x86/hvm/io.c to drivers/vpci/vpci.c.

Create vpci_ecam_{read,write} in drivers/vpci/vpci.c that
contains the common code to perform these operations, changed
vpci_mmcfg_{read,write} accordingly to make use of these functions.

The vpci_ecam_{read,write} functions are returning false on error and
true on success. As the x86 code was previously always returning
X86EMUL_OKAY the return code is ignored. A comment has been added in
the code to show that this is intentional.

Those functions will be used in a following patch inside by arm vpci
implementation.

Rename MMCFG_BDF to VPCI_ECAM_BDF and move it to vpci.h.
This macro is only used by functions calling vpci_ecam helpers.

No functional change intended with this patch.

[1] https://wiki.osdev.org/PCI_Express

Suggested-by: Roger Pau Monné <roger.pau@citrix.com>
Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
Acked-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
xen/arch/x86/hvm/io.c
xen/drivers/vpci/vpci.c
xen/include/asm-x86/pci.h
xen/include/xen/vpci.h