* [Qemu-devel] [PATCH qemu] spapr_pci: Fix endianness in assigned-addresses property
@ 2019-02-01 0:56 Alexey Kardashevskiy
2019-02-01 1:00 ` David Gibson
0 siblings, 1 reply; 2+ messages in thread
From: Alexey Kardashevskiy @ 2019-02-01 0:56 UTC (permalink / raw)
To: qemu-devel; +Cc: Alexey Kardashevskiy, qemu-ppc, David Gibson, Michael Roth
reg->phys_hi and assigned->phys_hi are big endian but we do an extra
byteswap anyway when copying reg->phys_hi to assigned->phys_hi.
To make things slightly more messy, we also add a relocatable bit (b_n())
although in the right endianness.
This fixes endianness of assigned->phys_hi.
This is unlikely to produce any visible difference though as we should end up
there only in the case of PCI hotplug and even then I am not sure if
(d->io_regions[i].addr == PCI_BAR_UNMAPPED) == true.
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
---
hw/ppc/spapr_pci.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c
index b74f263..a174952 100644
--- a/hw/ppc/spapr_pci.c
+++ b/hw/ppc/spapr_pci.c
@@ -964,7 +964,7 @@ static void populate_resource_props(PCIDevice *d, ResourceProps *rp)
}
assigned = &rp->assigned[assigned_idx++];
- assigned->phys_hi = cpu_to_be32(reg->phys_hi | b_n(1));
+ assigned->phys_hi = cpu_to_be32(be32_to_cpu(reg->phys_hi) | b_n(1));
assigned->phys_mid = cpu_to_be32(d->io_regions[i].addr >> 32);
assigned->phys_lo = cpu_to_be32(d->io_regions[i].addr);
assigned->size_hi = reg->size_hi;
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH qemu] spapr_pci: Fix endianness in assigned-addresses property
2019-02-01 0:56 [Qemu-devel] [PATCH qemu] spapr_pci: Fix endianness in assigned-addresses property Alexey Kardashevskiy
@ 2019-02-01 1:00 ` David Gibson
0 siblings, 0 replies; 2+ messages in thread
From: David Gibson @ 2019-02-01 1:00 UTC (permalink / raw)
To: Alexey Kardashevskiy; +Cc: qemu-devel, qemu-ppc, Michael Roth
[-- Attachment #1: Type: text/plain, Size: 1619 bytes --]
On Fri, Feb 01, 2019 at 11:56:22AM +1100, Alexey Kardashevskiy wrote:
> reg->phys_hi and assigned->phys_hi are big endian but we do an extra
> byteswap anyway when copying reg->phys_hi to assigned->phys_hi.
> To make things slightly more messy, we also add a relocatable bit (b_n())
> although in the right endianness.
>
> This fixes endianness of assigned->phys_hi.
>
> This is unlikely to produce any visible difference though as we should end up
> there only in the case of PCI hotplug and even then I am not sure if
> (d->io_regions[i].addr == PCI_BAR_UNMAPPED) == true.
>
> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Applied to ppc-for-4.0, thanks.
> ---
> hw/ppc/spapr_pci.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c
> index b74f263..a174952 100644
> --- a/hw/ppc/spapr_pci.c
> +++ b/hw/ppc/spapr_pci.c
> @@ -964,7 +964,7 @@ static void populate_resource_props(PCIDevice *d, ResourceProps *rp)
> }
>
> assigned = &rp->assigned[assigned_idx++];
> - assigned->phys_hi = cpu_to_be32(reg->phys_hi | b_n(1));
> + assigned->phys_hi = cpu_to_be32(be32_to_cpu(reg->phys_hi) | b_n(1));
> assigned->phys_mid = cpu_to_be32(d->io_regions[i].addr >> 32);
> assigned->phys_lo = cpu_to_be32(d->io_regions[i].addr);
> assigned->size_hi = reg->size_hi;
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-02-01 3:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-01 0:56 [Qemu-devel] [PATCH qemu] spapr_pci: Fix endianness in assigned-addresses property Alexey Kardashevskiy
2019-02-01 1:00 ` David Gibson
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).