[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] Re: [PATCH 09/15] Parse SDR1 on mtspr instead of at transla
From: |
Alexander Graf |
Subject: |
[Qemu-devel] Re: [PATCH 09/15] Parse SDR1 on mtspr instead of at translate time |
Date: |
Sat, 12 Feb 2011 16:37:46 +0100 |
On 12.02.2011, at 15:54, David Gibson wrote:
> On ppc machines with hash table MMUs, the special purpose register SDR1
> contains both the base address of the encoded size (hashed) page tables.
>
> At present, we interpret the SDR1 value within the address translation
> path. But because the encodings of the size for 32-bit and 64-bit are
> different this makes for a confusing branch on the MMU type with a bunch
> of curly shifts and masks in the middle of the translate path.
>
> This patch cleans things up by moving the interpretation on SDR1 into the
> helper function handling the write to the register. This leaves a simple
> pre-sanitized base address and mask for the hash table in the CPUState
> structure which is easier to work with in the translation path.
>
> This makes the translation path more readable. It addresses the FIXME
> comment currently in the mtsdr1 helper, by validating the SDR1 value during
> interpretation. Finally it opens the way for emulating a pSeries-style
> partition where the hash table used for translation is not mapped into
> the guests's RAM.
>
> Signed-off-by: David Gibson <address@hidden>
> ---
> monitor.c | 2 +-
> target-ppc/cpu.h | 11 +++++-
> target-ppc/helper.c | 79 ++++++++++++++++++++++++-------------------
> target-ppc/machine.c | 6 ++-
> target-ppc/translate.c | 2 +-
> target-ppc/translate_init.c | 7 +---
> 6 files changed, 61 insertions(+), 46 deletions(-)
>
> diff --git a/monitor.c b/monitor.c
> index 7fc311d..3f77ffc 100644
> --- a/monitor.c
> +++ b/monitor.c
> @@ -3457,7 +3457,7 @@ static const MonitorDef monitor_defs[] = {
> { "asr", offsetof(CPUState, asr) },
> #endif
> /* Segment registers */
> - { "sdr1", offsetof(CPUState, sdr1) },
> + { "sdr1", offsetof(CPUState, spr[SPR_SDR1]) },
> { "sr0", offsetof(CPUState, sr[0]) },
> { "sr1", offsetof(CPUState, sr[1]) },
> { "sr2", offsetof(CPUState, sr[2]) },
> diff --git a/target-ppc/cpu.h b/target-ppc/cpu.h
> index f9ad3b8..4d30352 100644
> --- a/target-ppc/cpu.h
> +++ b/target-ppc/cpu.h
> @@ -359,6 +359,14 @@ union ppc_tlb_t {
> };
> #endif
>
> +#define SDR_HTABORG_32 0xFFFF0000UL
> +#define SDR_HTABMASK 0x000001FFUL
Please mark this constant as ppc32
> +
> +#if defined(TARGET_PPC64)
> +#define SDR_HTABORG_64 0xFFFFFFFFFFFC0000ULL
> +#define SDR_HTABSIZE 0x000000000000001FULL
Please mark this constant as ppc64
The rest looks good :)
Alex
- [Qemu-devel] Re: [PATCH 08/15] Clean up slb_lookup() function, (continued)
- [Qemu-devel] [PATCH 06/15] Implement missing parts of the logic for the POWER PURR, David Gibson, 2011/02/12
- [Qemu-devel] [PATCH 07/15] Correct ppc popcntb logic, implement popcntw and popcntd, David Gibson, 2011/02/12
- [Qemu-devel] [PATCH 10/15] Use "hash" more consistently in ppc mmu code, David Gibson, 2011/02/12
- [Qemu-devel] [PATCH 11/15] Better factor the ppc hash translation path, David Gibson, 2011/02/12
- [Qemu-devel] [PATCH 09/15] Parse SDR1 on mtspr instead of at translate time, David Gibson, 2011/02/12
- [Qemu-devel] Re: [PATCH 09/15] Parse SDR1 on mtspr instead of at translate time,
Alexander Graf <=
[Qemu-devel] [PATCH 05/15] Implement PowerPC slbmfee and slbmfev instructions, David Gibson, 2011/02/12
[Qemu-devel] [PATCH 12/15] Support 1T segments on ppc, David Gibson, 2011/02/12