[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-ppc] [PATCH] pseries: Implements h_read hcall
From: |
Alexander Graf |
Subject: |
Re: [Qemu-ppc] [PATCH] pseries: Implements h_read hcall |
Date: |
Fri, 15 Feb 2013 01:09:37 +0100 |
On 13.02.2013, at 06:21, David Gibson wrote:
> On Tue, Feb 12, 2013 at 11:07:10PM +0100, Alexander Graf wrote:
>>
>> On 07.02.2013, at 12:28, Erlon Cruz wrote:
>>
>>> From: Erlon Cruz <address@hidden>
>>>
>>> This h_call is useful for DLPAR in future amongst other things. Given an
>>> index
>>> it fetches the corresponding PTE stored in the htab.
>>>
>>> Signed-off-by: Erlon Cruz <address@hidden>
>>> ---
>>> hw/spapr_hcall.c | 58
>>> ++++++++++++++++++++++++++++++++++++++++++++++++++++++
>>> 1 file changed, 58 insertions(+)
>>>
>>> diff --git a/hw/spapr_hcall.c b/hw/spapr_hcall.c
>>> index 2889742..5ba07e5 100644
>>> --- a/hw/spapr_hcall.c
>>> +++ b/hw/spapr_hcall.c
>>> @@ -323,6 +323,63 @@ static target_ulong h_protect(PowerPCCPU *cpu,
>>> sPAPREnvironment *spapr,
>>> return H_SUCCESS;
>>> }
>>>
>>> +static target_ulong h_read(PowerPCCPU *cpu, sPAPREnvironment *spapr,
>>> + target_ulong opcode, target_ulong *args)
>>> +{
>>> + CPUPPCState *env = &cpu->env;
>>> + target_ulong flags = args[0];
>>> + target_ulong pte_index = args[1];
>>> + uint8_t *hpte;
>>> +
>>> + if ((pte_index * HASH_PTE_SIZE_64) & ~env->htab_mask) {
>>> + return H_PARAMETER;
>>> + }
>>> +
>>> + if (!(flags & H_READ_4)) {
>>> + target_ulong v, r;
>>> + target_ulong *pteh = &args[0];
>>> + target_ulong *ptel = &args[1];
>>> +
>>> + hpte = env->external_htab + (pte_index * HASH_PTE_SIZE_64);
>>
>> You are not guaranteed that there is an external htab.
>
> Actually in the case of spapr, you are - the existing hash table
> management calls all assume the existence of an external htab.
Ok, just leave the code using external_htab and we'll make it use the helpers
once they're there.
Alex
>
>> In fact, looking at the external_htab users, we should probably
>> introduce a few helper read functions for the htab that abstract the
>> glorious external_htab/htab_base details away from you.
>
> That said, I actually wrote such helpers about 15 minutes ago as part
> of my MMU cleanup series.
>
> --
> 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