* [Qemu-devel] [PATCH v2] target-ppc: Eliminate redundant and incorrect function booke206_page_size_to_tlb
@ 2016-06-28 13:50 Aaron Larson
2016-06-29 1:42 ` David Gibson
0 siblings, 1 reply; 4+ messages in thread
From: Aaron Larson @ 2016-06-28 13:50 UTC (permalink / raw)
To: agraf, alarson, david, qemu-devel, qemu-ppc
Eliminate redundant and incorrect booke206_page_size_to_tlb function
from ppce500_spin.c in preference to previously existing but newly
exported definition from e500.c
Defect analysis:
The booke206_page_size_to_tlb function in e500.c was updated in commit
2bd9543 "ppc: booke206: use MAV=2.0 TSIZE definition, fix 4G pages" to
reflect a change in the definition of MAS1_TSIZE_SHIFT from 8
(corresponding to a min TLB page size of 4kb) to a value of 7 (TLB
page size 2k). The booke206_page_size_to_tlb() function defined in
ppce500_spin.c was never updated to reflect the change in
MAS1_TSIZE_SHIFT.
In http://lists.nongnu.org/archive/html/qemu-ppc/2016-06/msg00533.html,
Scott Wood suggested this "root cause" explanation:
SW> The patch that changed MAS1_TSIZE_SHIFT from 8 to 7 was around the
SW> same time as the patch that added this code, which is probably why
SW> adjusting it got missed. Commit 2bd9543cd3 did update the
SW> equivalent code in ppce500_mpc8544ds.c, which now resides in
SW> hw/ppc/e500.c and has been changed to not assume a power-of-2
SW> size. The ppce500_spin version should be eliminated.
Signed-off-by: Aaron Larson <alarson@ddci.com>
---
hw/ppc/e500.c | 2 +-
hw/ppc/e500.h | 2 ++
hw/ppc/ppce500_spin.c | 7 +------
3 files changed, 4 insertions(+), 7 deletions(-)
diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c
index ee1c60b..0cd534d 100644
--- a/hw/ppc/e500.c
+++ b/hw/ppc/e500.c
@@ -601,7 +601,7 @@ static int ppce500_prep_device_tree(MachineState *machine,
}
/* Create -kernel TLB entries for BookE. */
-static inline hwaddr booke206_page_size_to_tlb(uint64_t size)
+hwaddr booke206_page_size_to_tlb(uint64_t size)
{
return 63 - clz64(size >> 10);
}
diff --git a/hw/ppc/e500.h b/hw/ppc/e500.h
index ef224ea..70ba1d8 100644
--- a/hw/ppc/e500.h
+++ b/hw/ppc/e500.h
@@ -26,4 +26,6 @@ typedef struct PPCE500Params {
void ppce500_init(MachineState *machine, PPCE500Params *params);
+hwaddr booke206_page_size_to_tlb(uint64_t size);
+
#endif
diff --git a/hw/ppc/ppce500_spin.c b/hw/ppc/ppce500_spin.c
index 225177b..22c584e 100644
--- a/hw/ppc/ppce500_spin.c
+++ b/hw/ppc/ppce500_spin.c
@@ -32,6 +32,7 @@
#include "sysemu/sysemu.h"
#include "hw/sysbus.h"
#include "sysemu/kvm.h"
+#include "e500.h"
#define MAX_CPUS 32
@@ -72,12 +73,6 @@ static void spin_reset(void *opaque)
}
}
-/* Create -kernel TLB entries for BookE, linearly spanning 256MB. */
-static inline hwaddr booke206_page_size_to_tlb(uint64_t size)
-{
- return ctz32(size >> 10) >> 1;
-}
-
static void mmubooke_create_initial_mapping(CPUPPCState *env,
target_ulong va,
hwaddr pa,
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH v2] target-ppc: Eliminate redundant and incorrect function booke206_page_size_to_tlb
2016-06-28 13:50 [Qemu-devel] [PATCH v2] target-ppc: Eliminate redundant and incorrect function booke206_page_size_to_tlb Aaron Larson
@ 2016-06-29 1:42 ` David Gibson
2016-06-29 15:14 ` alarson
0 siblings, 1 reply; 4+ messages in thread
From: David Gibson @ 2016-06-29 1:42 UTC (permalink / raw)
To: Aaron Larson; +Cc: agraf, qemu-devel, qemu-ppc
[-- Attachment #1: Type: text/plain, Size: 3247 bytes --]
On Tue, Jun 28, 2016 at 06:50:05AM -0700, Aaron Larson wrote:
>
> Eliminate redundant and incorrect booke206_page_size_to_tlb function
> from ppce500_spin.c in preference to previously existing but newly
> exported definition from e500.c
>
> Defect analysis:
>
> The booke206_page_size_to_tlb function in e500.c was updated in commit
> 2bd9543 "ppc: booke206: use MAV=2.0 TSIZE definition, fix 4G pages" to
> reflect a change in the definition of MAS1_TSIZE_SHIFT from 8
> (corresponding to a min TLB page size of 4kb) to a value of 7 (TLB
> page size 2k). The booke206_page_size_to_tlb() function defined in
> ppce500_spin.c was never updated to reflect the change in
> MAS1_TSIZE_SHIFT.
>
> In http://lists.nongnu.org/archive/html/qemu-ppc/2016-06/msg00533.html,
> Scott Wood suggested this "root cause" explanation:
>
> SW> The patch that changed MAS1_TSIZE_SHIFT from 8 to 7 was around the
> SW> same time as the patch that added this code, which is probably why
> SW> adjusting it got missed. Commit 2bd9543cd3 did update the
> SW> equivalent code in ppce500_mpc8544ds.c, which now resides in
> SW> hw/ppc/e500.c and has been changed to not assume a power-of-2
> SW> size. The ppce500_spin version should be eliminated.
>
> Signed-off-by: Aaron Larson <alarson@ddci.com>
Applied to pppc-for-2.7, thanks.
> ---
> hw/ppc/e500.c | 2 +-
> hw/ppc/e500.h | 2 ++
> hw/ppc/ppce500_spin.c | 7 +------
> 3 files changed, 4 insertions(+), 7 deletions(-)
>
> diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c
> index ee1c60b..0cd534d 100644
> --- a/hw/ppc/e500.c
> +++ b/hw/ppc/e500.c
> @@ -601,7 +601,7 @@ static int ppce500_prep_device_tree(MachineState *machine,
> }
>
> /* Create -kernel TLB entries for BookE. */
> -static inline hwaddr booke206_page_size_to_tlb(uint64_t size)
> +hwaddr booke206_page_size_to_tlb(uint64_t size)
> {
> return 63 - clz64(size >> 10);
> }
> diff --git a/hw/ppc/e500.h b/hw/ppc/e500.h
> index ef224ea..70ba1d8 100644
> --- a/hw/ppc/e500.h
> +++ b/hw/ppc/e500.h
> @@ -26,4 +26,6 @@ typedef struct PPCE500Params {
>
> void ppce500_init(MachineState *machine, PPCE500Params *params);
>
> +hwaddr booke206_page_size_to_tlb(uint64_t size);
> +
> #endif
> diff --git a/hw/ppc/ppce500_spin.c b/hw/ppc/ppce500_spin.c
> index 225177b..22c584e 100644
> --- a/hw/ppc/ppce500_spin.c
> +++ b/hw/ppc/ppce500_spin.c
> @@ -32,6 +32,7 @@
> #include "sysemu/sysemu.h"
> #include "hw/sysbus.h"
> #include "sysemu/kvm.h"
> +#include "e500.h"
>
> #define MAX_CPUS 32
>
> @@ -72,12 +73,6 @@ static void spin_reset(void *opaque)
> }
> }
>
> -/* Create -kernel TLB entries for BookE, linearly spanning 256MB. */
> -static inline hwaddr booke206_page_size_to_tlb(uint64_t size)
> -{
> - return ctz32(size >> 10) >> 1;
> -}
> -
> static void mmubooke_create_initial_mapping(CPUPPCState *env,
> target_ulong va,
> hwaddr pa,
--
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: 819 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH v2] target-ppc: Eliminate redundant and incorrect function booke206_page_size_to_tlb
2016-06-29 1:42 ` David Gibson
@ 2016-06-29 15:14 ` alarson
2016-06-29 15:37 ` Thomas Huth
0 siblings, 1 reply; 4+ messages in thread
From: alarson @ 2016-06-29 15:14 UTC (permalink / raw)
To: David Gibson; +Cc: agraf, qemu-devel, qemu-ppc
David Gibson <david@gibson.dropbear.id.au> wrote on 06/28/2016 08:42:01
PM:
> On Tue, Jun 28, 2016 at 06:50:05AM -0700, Aaron Larson wrote:
> >
> > Eliminate redundant and incorrect booke206_page_size_to_tlb function
> > from ppce500_spin.c in preference to previously existing but newly
> > exported definition from e500.c
> > ...
> > Signed-off-by: Aaron Larson <alarson@ddci.com>
>
> Applied to pppc-for-2.7, thanks.
I had previously created a bug for this at:
https://bugs.launchpad.net/qemu/+bug/1587535
Do you want me to do anything with that bug?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH v2] target-ppc: Eliminate redundant and incorrect function booke206_page_size_to_tlb
2016-06-29 15:14 ` alarson
@ 2016-06-29 15:37 ` Thomas Huth
0 siblings, 0 replies; 4+ messages in thread
From: Thomas Huth @ 2016-06-29 15:37 UTC (permalink / raw)
To: alarson, David Gibson; +Cc: qemu-ppc, agraf, qemu-devel
On 29.06.2016 17:14, alarson@ddci.com wrote:
> David Gibson <david@gibson.dropbear.id.au> wrote on 06/28/2016 08:42:01
> PM:
>
>> On Tue, Jun 28, 2016 at 06:50:05AM -0700, Aaron Larson wrote:
>>>
>>> Eliminate redundant and incorrect booke206_page_size_to_tlb function
>>> from ppce500_spin.c in preference to previously existing but newly
>>> exported definition from e500.c
>>> ...
>>> Signed-off-by: Aaron Larson <alarson@ddci.com>
>>
>> Applied to pppc-for-2.7, thanks.
>
> I had previously created a bug for this at:
> https://bugs.launchpad.net/qemu/+bug/1587535
>
> Do you want me to do anything with that bug?
Please add a comment with the title of your patch there, stating that it
has been accepted, and set the status of the bug to "Fix committed".
Thanks!
Thomas
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-06-29 15:37 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-28 13:50 [Qemu-devel] [PATCH v2] target-ppc: Eliminate redundant and incorrect function booke206_page_size_to_tlb Aaron Larson
2016-06-29 1:42 ` David Gibson
2016-06-29 15:14 ` alarson
2016-06-29 15:37 ` Thomas Huth
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).