All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nicholas Piggin <npiggin@gmail.com>
To: "Cédric Le Goater" <clg@kaod.org>, qemu-ppc@nongnu.org
Cc: qemu-devel@nongnu.org
Subject: Re: [RFC PATCH 3/3] spapr: implement nested-hv support for the TCG virtual hypervisor
Date: Tue, 15 Feb 2022 12:57:09 +1000	[thread overview]
Message-ID: <1644893720.zfgyd9jh5k.astroid@bobo.none> (raw)
In-Reply-To: <1644881088.rvm7j0emi0.astroid@bobo.none>

Excerpts from Nicholas Piggin's message of February 15, 2022 9:28 am:
> Excerpts from Cédric Le Goater's message of February 15, 2022 4:31 am:
>> On 2/10/22 07:53, Nicholas Piggin wrote:
>>> +void spapr_enter_nested(PowerPCCPU *cpu)
>>> +{
>>> +    SpaprMachineState *spapr = SPAPR_MACHINE(qdev_get_machine());
>>> +    PowerPCCPUClass *pcc = POWERPC_CPU_GET_CLASS(cpu);
>>> +    CPUState *cs = CPU(cpu);
>>> +    CPUPPCState *env = &cpu->env;
>>> +    target_ulong hv_ptr = env->gpr[4];
>>> +    target_ulong regs_ptr = env->gpr[5];
>>> +    target_ulong hdec, now = cpu_ppc_load_tbl(env);
>>> +    struct kvmppc_hv_guest_state *hvstate;
>>> +    struct kvmppc_hv_guest_state hv_state;
>>> +    struct kvmppc_pt_regs *regs;
>>> +    hwaddr len;
>>> +    uint32_t cr;
>>> +    int i;
>>> +
>>> +    if (cpu->in_spapr_nested) {
>>> +        env->gpr[3] = H_FUNCTION;
>>> +        return;
>>> +    }
>>> +    if (spapr->nested_ptcr == 0) {
>>> +        env->gpr[3] = H_NOT_AVAILABLE;
>>> +        return;
>>> +    }
>>> +
>>> +    len = sizeof(*hvstate);
>>> +    hvstate = cpu_physical_memory_map(hv_ptr, &len, 
>> 
>> Are you writing to the state ? address_space_map() is a better pratice.
> 
> Yes, in exit_nested it gets written. I'll take a look at 
> address_space_map().

Hmm, address_space_map() says only use it for reads OR writes. Some o 
these are doing both.

Why is it better practice to use address_space_map()? I could split the
operations out into read, then write if necessary. For now I will re
submit the series with cpu_physical_memory_map because there has been a
lot of changes and cleanups includng all your and Fabiano's suggestions
except this one so it should make it easier to review.

Thanks,
Nick


      reply	other threads:[~2022-02-15  2:59 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-10  6:53 [RFC PATCH 0/3] spapr: nested-hv support for TCG Nicholas Piggin
2022-02-10  6:53 ` [RFC PATCH 1/3] target/ppc: raise HV interrupts for partition table entry problems Nicholas Piggin
2022-02-10  6:53 ` [RFC PATCH 2/3] spapr: prevent hdec timer being set up under virtual hypervisor Nicholas Piggin
2022-02-10  6:53 ` [RFC PATCH 3/3] spapr: implement nested-hv support for the TCG " Nicholas Piggin
2022-02-14 14:32   ` Fabiano Rosas
2022-02-14 23:24     ` Nicholas Piggin
2022-02-14 18:31   ` Cédric Le Goater
2022-02-14 23:28     ` Nicholas Piggin
2022-02-15  2:57       ` Nicholas Piggin [this message]

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=1644893720.zfgyd9jh5k.astroid@bobo.none \
    --to=npiggin@gmail.com \
    --cc=clg@kaod.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.