qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Cédric Le Goater" <clg@kaod.org>
To: David Gibson <david@gibson.dropbear.id.au>,
	groug@kaod.org, abologna@redhat.com
Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org, aik@ozlabs.ru
Subject: Re: [Qemu-devel] [PATCH 3/9] spapr: Add cpu_apply hook to capabilities
Date: Thu, 21 Jun 2018 07:34:15 +0200	[thread overview]
Message-ID: <5c3da8b8-32dd-11c6-9739-b42b27f65b4c@kaod.org> (raw)
In-Reply-To: <20180618063606.2513-4-david@gibson.dropbear.id.au>

On 06/18/2018 08:36 AM, David Gibson wrote:
> spapr capabilities have an apply hook to actually activate (or deactivate)
> the feature in the system at reset time.  However, a number of capabilities
> affect the setup of cpus, and need to be applied to each of them -
> including hotplugged cpus for extra complication.  To make this simpler,
> add an optional cpu_apply hook that is called from spapr_cpu_reset().
> 
> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>

Reviewed-by: Cédric Le Goater <clg@kaod.org>


Thanks,

C.

> ---
>  hw/ppc/spapr_caps.c     | 19 +++++++++++++++++++
>  hw/ppc/spapr_cpu_core.c |  2 ++
>  include/hw/ppc/spapr.h  |  1 +
>  3 files changed, 22 insertions(+)
> 
> diff --git a/hw/ppc/spapr_caps.c b/hw/ppc/spapr_caps.c
> index dabed817d1..68a4243efc 100644
> --- a/hw/ppc/spapr_caps.c
> +++ b/hw/ppc/spapr_caps.c
> @@ -59,6 +59,8 @@ typedef struct sPAPRCapabilityInfo {
>      sPAPRCapPossible *possible;
>      /* Make sure the virtual hardware can support this capability */
>      void (*apply)(sPAPRMachineState *spapr, uint8_t val, Error **errp);
> +    void (*cpu_apply)(sPAPRMachineState *spapr, PowerPCCPU *cpu,
> +                      uint8_t val, Error **errp);
>  } sPAPRCapabilityInfo;
>  
>  static void spapr_cap_get_bool(Object *obj, Visitor *v, const char *name,
> @@ -472,6 +474,23 @@ void spapr_caps_apply(sPAPRMachineState *spapr)
>      }
>  }
>  
> +void spapr_caps_cpu_apply(sPAPRMachineState *spapr, PowerPCCPU *cpu)
> +{
> +    int i;
> +
> +    for (i = 0; i < SPAPR_CAP_NUM; i++) {
> +        sPAPRCapabilityInfo *info = &capability_table[i];
> +
> +        /*
> +         * If the apply function can't set the desired level and thinks it's
> +         * fatal, it should cause that.
> +         */
> +        if (info->cpu_apply) {
> +            info->cpu_apply(spapr, cpu, spapr->eff.caps[i], &error_fatal);
> +        }
> +    }
> +}
> +
>  void spapr_caps_add_properties(sPAPRMachineClass *smc, Error **errp)
>  {
>      Error *local_err = NULL;
> diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c
> index aef3be33a3..324623190d 100644
> --- a/hw/ppc/spapr_cpu_core.c
> +++ b/hw/ppc/spapr_cpu_core.c
> @@ -76,6 +76,8 @@ static void spapr_cpu_reset(void *opaque)
>      spapr_cpu->slb_shadow_size = 0;
>      spapr_cpu->dtl_addr = 0;
>      spapr_cpu->dtl_size = 0;
> +
> +    spapr_caps_cpu_apply(SPAPR_MACHINE(qdev_get_machine()), cpu);
>  }
>  
>  void spapr_cpu_set_entry_state(PowerPCCPU *cpu, target_ulong nip, target_ulong r3)
> diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h
> index 9dbd6010f5..9dd46a72f6 100644
> --- a/include/hw/ppc/spapr.h
> +++ b/include/hw/ppc/spapr.h
> @@ -800,6 +800,7 @@ static inline uint8_t spapr_get_cap(sPAPRMachineState *spapr, int cap)
>  
>  void spapr_caps_init(sPAPRMachineState *spapr);
>  void spapr_caps_apply(sPAPRMachineState *spapr);
> +void spapr_caps_cpu_apply(sPAPRMachineState *spapr, PowerPCCPU *cpu);
>  void spapr_caps_add_properties(sPAPRMachineClass *smc, Error **errp);
>  int spapr_caps_post_migration(sPAPRMachineState *spapr);
>  
> 

  parent reply	other threads:[~2018-06-21  5:34 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-18  6:35 [Qemu-devel] [PATCH 0/9] spapr: Clean up pagesize handling David Gibson
2018-06-18  6:35 ` [Qemu-devel] [PATCH 1/9] target/ppc: Allow cpu compatiblity checks based on type, not instance David Gibson
2018-06-18 13:22   ` Greg Kurz
2018-06-21  5:20   ` Cédric Le Goater
2018-06-18  6:35 ` [Qemu-devel] [PATCH 2/9] spapr: Compute effective capability values earlier David Gibson
2018-06-18 13:37   ` Greg Kurz
2018-06-21  5:32   ` Cédric Le Goater
2018-06-18  6:36 ` [Qemu-devel] [PATCH 3/9] spapr: Add cpu_apply hook to capabilities David Gibson
2018-06-18 15:28   ` Greg Kurz
2018-06-21  5:34   ` Cédric Le Goater [this message]
2018-06-18  6:36 ` [Qemu-devel] [PATCH 4/9] target/ppc: Add kvmppc_hpt_needs_host_contiguous_pages() helper David Gibson
2018-06-18 15:32   ` Greg Kurz
2018-06-21  5:56   ` Cédric Le Goater
2018-06-21  6:34     ` David Gibson
2018-06-18  6:36 ` [Qemu-devel] [PATCH 5/9] spapr: Maximum (HPT) pagesize property David Gibson
2018-06-19  9:23   ` Cédric Le Goater
2018-06-19 11:22     ` David Gibson
2018-06-21  6:22   ` Cédric Le Goater
2018-06-21 11:00     ` David Gibson
2018-06-21  9:19   ` Greg Kurz
2018-06-21 11:01     ` David Gibson
2018-06-18  6:36 ` [Qemu-devel] [PATCH 6/9] spapr: Use maximum page size capability to simplify memory backend checking David Gibson
2018-06-21  6:29   ` Cédric Le Goater
2018-06-21 11:06     ` David Gibson
2018-06-21 10:29   ` Greg Kurz
2018-06-21 11:11     ` David Gibson
2018-06-18  6:36 ` [Qemu-devel] [PATCH 7/9] target/ppc: Add ppc_hash64_filter_pagesizes() David Gibson
2018-06-21  6:38   ` Cédric Le Goater
2018-06-21 11:48   ` Greg Kurz
2018-06-18  6:36 ` [Qemu-devel] [PATCH 8/9] spapr: Limit available pagesizes to provide a consistent guest environment David Gibson
2018-06-21  7:01   ` Cédric Le Goater
2018-06-21 11:52     ` David Gibson
2018-06-21 12:50       ` Cédric Le Goater
2018-06-21 13:58         ` David Gibson
2018-06-21 12:24   ` Greg Kurz
2018-06-21 14:01     ` David Gibson
2018-06-21 14:18       ` Greg Kurz
2018-06-18  6:36 ` [Qemu-devel] [PATCH 9/9] spapr: Don't rewrite mmu capabilities in KVM mode David Gibson
2018-06-21  7:53   ` Cédric Le Goater
2018-06-21 12:01     ` David Gibson
2018-06-21 12:51       ` Cédric Le Goater
2018-06-21  1:08 ` [Qemu-devel] [PATCH 0/9] spapr: Clean up pagesize handling David Gibson
2018-06-21  6:52 ` no-reply

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=5c3da8b8-32dd-11c6-9739-b42b27f65b4c@kaod.org \
    --to=clg@kaod.org \
    --cc=abologna@redhat.com \
    --cc=aik@ozlabs.ru \
    --cc=david@gibson.dropbear.id.au \
    --cc=groug@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 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).