From: Nikos Nikoleris <nikos.nikoleris@arm.com>
To: Andrew Jones <drjones@redhat.com>, kvm@vger.kernel.org
Cc: alexandru.elisei@arm.com, andre.przywara@arm.com, eric.auger@redhat.com
Subject: Re: [PATCH kvm-unit-tests 3/8] pci-testdev: ioremap regions
Date: Tue, 13 Apr 2021 15:12:04 +0100 [thread overview]
Message-ID: <a1ae2fc8-918e-d574-2b3b-ba8a7bfd9944@arm.com> (raw)
In-Reply-To: <20210407185918.371983-4-drjones@redhat.com>
On 07/04/2021 19:59, Andrew Jones wrote:
> Don't assume the physical addresses used with PCI have already been
> identity mapped.
>
> Signed-off-by: Andrew Jones <drjones@redhat.com>
This makes more sense now that I had a look at the next patch (4/8).
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
> ---
> lib/pci-host-generic.c | 5 ++---
> lib/pci-host-generic.h | 4 ++--
> lib/pci-testdev.c | 4 ++++
> 3 files changed, 8 insertions(+), 5 deletions(-)
>
> diff --git a/lib/pci-host-generic.c b/lib/pci-host-generic.c
> index 818150dc0a66..de93b8feac39 100644
> --- a/lib/pci-host-generic.c
> +++ b/lib/pci-host-generic.c
> @@ -122,7 +122,7 @@ static struct pci_host_bridge *pci_dt_probe(void)
> sizeof(host->addr_space[0]) * nr_addr_spaces);
> assert(host != NULL);
>
> - host->start = base.addr;
> + host->start = ioremap(base.addr, base.size);
> host->size = base.size;
> host->bus = bus;
> host->bus_max = bus_max;
> @@ -279,8 +279,7 @@ phys_addr_t pci_host_bridge_get_paddr(u64 pci_addr)
>
> static void __iomem *pci_get_dev_conf(struct pci_host_bridge *host, int devfn)
> {
> - return (void __iomem *)(unsigned long)
> - host->start + (devfn << PCI_ECAM_DEVFN_SHIFT);
> + return (void __iomem *)host->start + (devfn << PCI_ECAM_DEVFN_SHIFT);
> }
>
> u8 pci_config_readb(pcidevaddr_t dev, u8 off)
> diff --git a/lib/pci-host-generic.h b/lib/pci-host-generic.h
> index fd30e7c74ed8..0ffe6380ec8f 100644
> --- a/lib/pci-host-generic.h
> +++ b/lib/pci-host-generic.h
> @@ -18,8 +18,8 @@ struct pci_addr_space {
> };
>
> struct pci_host_bridge {
> - phys_addr_t start;
> - phys_addr_t size;
> + void __iomem *start;
> + size_t size;
> int bus;
> int bus_max;
> int nr_addr_spaces;
> diff --git a/lib/pci-testdev.c b/lib/pci-testdev.c
> index 039bb44781c1..4f2e5663b2d6 100644
> --- a/lib/pci-testdev.c
> +++ b/lib/pci-testdev.c
> @@ -185,7 +185,11 @@ int pci_testdev(void)
> mem = ioremap(addr, PAGE_SIZE);
>
> addr = pci_bar_get_addr(&pci_dev, 1);
> +#if defined(__i386__) || defined(__x86_64__)
> io = (void *)(unsigned long)addr;
> +#else
> + io = ioremap(addr, PAGE_SIZE);
> +#endif
>
> nr_tests += pci_testdev_all(mem, &pci_testdev_mem_ops);
> nr_tests += pci_testdev_all(io, &pci_testdev_io_ops);
>
next prev parent reply other threads:[~2021-04-13 14:12 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-07 18:59 [PATCH kvm-unit-tests 0/8] arm/arm64: Prepare for target-efi Andrew Jones
2021-04-07 18:59 ` [PATCH kvm-unit-tests 1/8] arm/arm64: Reorganize cstart assembler Andrew Jones
2021-04-09 17:18 ` Nikos Nikoleris
2021-04-09 17:28 ` Andrew Jones
2021-04-13 16:34 ` Alexandru Elisei
2021-04-14 8:59 ` Andrew Jones
2021-04-14 15:15 ` Alexandru Elisei
2021-04-15 13:03 ` Andrew Jones
2021-04-07 18:59 ` [PATCH kvm-unit-tests 2/8] arm/arm64: Move setup_vm into setup Andrew Jones
2021-04-09 17:24 ` Nikos Nikoleris
2021-04-14 15:19 ` Alexandru Elisei
2021-04-07 18:59 ` [PATCH kvm-unit-tests 3/8] pci-testdev: ioremap regions Andrew Jones
2021-04-13 14:12 ` Nikos Nikoleris [this message]
2021-04-07 18:59 ` [PATCH kvm-unit-tests 4/8] arm/arm64: mmu: Stop mapping an assumed IO region Andrew Jones
2021-04-13 14:06 ` Nikos Nikoleris
2021-04-14 15:42 ` Alexandru Elisei
2021-04-15 13:09 ` Andrew Jones
2021-04-07 18:59 ` [PATCH kvm-unit-tests 5/8] arm/arm64: mmu: Remove memory layout assumptions Andrew Jones
2021-04-13 14:27 ` Nikos Nikoleris
2021-04-15 15:48 ` Alexandru Elisei
2021-04-15 17:11 ` Andrew Jones
2021-04-19 15:09 ` Alexandru Elisei
2021-04-07 18:59 ` [PATCH kvm-unit-tests 6/8] arm/arm64: setup: Consolidate " Andrew Jones
2021-04-13 16:41 ` Nikos Nikoleris
2021-04-14 9:03 ` Andrew Jones
2021-04-15 16:59 ` Alexandru Elisei
2021-04-15 17:25 ` Andrew Jones
2021-04-19 15:56 ` Alexandru Elisei
2021-04-19 15:59 ` Alexandru Elisei
2021-04-19 17:53 ` Andrew Jones
2021-04-07 18:59 ` [PATCH kvm-unit-tests 7/8] chr-testdev: Silently fail init Andrew Jones
2021-04-13 16:42 ` Nikos Nikoleris
2021-04-15 17:03 ` Alexandru Elisei
2021-04-07 18:59 ` [PATCH kvm-unit-tests 8/8] arm/arm64: psci: don't assume method is hvc Andrew Jones
2021-04-09 17:46 ` Nikos Nikoleris
2021-04-14 9:06 ` Andrew Jones
2021-04-19 16:33 ` Alexandru Elisei
2021-04-19 18:13 ` Andrew Jones
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=a1ae2fc8-918e-d574-2b3b-ba8a7bfd9944@arm.com \
--to=nikos.nikoleris@arm.com \
--cc=alexandru.elisei@arm.com \
--cc=andre.przywara@arm.com \
--cc=drjones@redhat.com \
--cc=eric.auger@redhat.com \
--cc=kvm@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).